The great thing about ansible is you are declaring an "end state". After a task 
the system should look like the state you describe. In this case you want the 
state to be the your package is installed. In Ansible if the system is already 
in that state it does nothing. You don't need to "check first". You say you 
want the package installed. It checks. If it is installed, it does nothing. If 
it is not installed, it installs it.

The goal of every task is to achieve the state described in the task.

Walter
--
Walter Rowe, Division Chief
Infrastructure Services, OISM
Mobile: 202.355.4123

On Jan 4, 2023, at 8:24 PM, Nestor <[email protected]> wrote:

Hey everyone,
writing a playbook to check if a package is installed on my windows system. if 
not run the installer from \Temp\software. and if already there, ignore. i have 
the command to run the installer but need to know how to check if the 
application is already installed

- name: install SCCM
  win_package:
   path: c:\Temp\software\CLENT_2203\install.cmd
   state: present
  ingnor_errors: yes

--
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/0bbf03f5-d935-41df-ae0b-c85043a3e195n%40googlegroups.com<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fansible-project%2F0bbf03f5-d935-41df-ae0b-c85043a3e195n%2540googlegroups.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=05%7C01%7Cwalter.rowe%40nist.gov%7C055e06a26665424366ce08daeebb97df%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C638084786717952375%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=s3U7BSJ6ANWcSpo7fAQ5BKkm2iE5i7IKBry5zcT4Duo%3D&reserved=0>.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/F22AE70A-EA26-4029-9CDD-BC07FBAA56C5%40nist.gov.

Reply via email to