I want to perform a number of tasks if a specific apt package is missing.
eg:
if carbon graphite is NOT installed:
- apt: name=debconf-utils state=present - shell: echo 'graphite-carbon/postrm_remove_databases boolean false' | debconf-set-selections - apt: name=debconf-utils state=absent
another example:
if statsd is NOT installed:
- file: path=/tmp/build state=directory - shell: cd /tmp/build ; git clone https://github.com/etsy/statsd.git ; cd statsd ; dpkg-buildpackage - shell: dpkg -i /tmp/build/statsd*.deb
How do I start hacking this?
I think maybe I can do -shell: dpkg -l|grep <package name> and somehow capture the return code.
apt conditional-statements ansible ansible-playbook
Simply Seth
source share