# use ansible to check if application is installed

**URL:** <https://forum.ansible.com/t/use-ansible-to-check-if-application-is-installed/37521>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [January 5, 2023, 1:24am UTC](https://forum.ansible.com/t/use-ansible-to-check-if-application-is-installed/37521 "2023-01-05T01:24:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nestor](https://avatars.discourse-cdn.com/v4/letter/n/e495f1/32.png) [@Nestor](https://forum.ansible.com/u/Nestor)\
**Post date:** [January 5, 2023, 1:24am UTC](https://forum.ansible.com/t/use-ansible-to-check-if-application-is-installed/37521/1 "2023-01-05T01:24:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Walter\_Rowe](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/walter_rowe/32/4506_2.png) [@Walter\_Rowe](https://forum.ansible.com/u/Walter_Rowe)\
**Post date:** [January 5, 2023, 12:14pm UTC](https://forum.ansible.com/t/use-ansible-to-check-if-application-is-installed/37521/2 "2023-01-05T12:14:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Nestor](https://avatars.discourse-cdn.com/v4/letter/n/e495f1/32.png) [@Nestor](https://forum.ansible.com/u/Nestor)\
**Post date:** [January 6, 2023, 6:14am UTC](https://forum.ansible.com/t/use-ansible-to-check-if-application-is-installed/37521/3 "2023-01-06T06:14:15Z")

</div>

Thank you. this i will try and share feedback. thank you !
