Ansible: check if a package is installed on a remote system ...
dev.to › setevoy › ansible-check-if-a-packageMar 10, 2019 · $ cat is-package-installed.yml - name: Check to see if a package is installed hosts: "{{ hosts | default('localhost') }}" tasks: - name: Gather the packager facts package_facts: - name: Package status debug: msg: "{{ item }} {{ 'installed' if item in ansible_facts.packages else 'not installed' }}" loop: "{{ pkgs | default([]) }}" $ ansible-playbook -e '{ "pkgs": ["foo", "zip"] }' is-package-installed.yml PLAY [Check to see if a package is installed] ***** TASK [Gathering Facts] ***** ok ...