Skip to content

Instantly share code, notes, and snippets.

@adenot
Created January 19, 2014 08:07
Show Gist options
  • Select an option

  • Save adenot/8501834 to your computer and use it in GitHub Desktop.

Select an option

Save adenot/8501834 to your computer and use it in GitHub Desktop.
Ansible playbook: Avoid apt module report changed when no packages actually changed.
- name: Ensure packages are installed
apt: pkg={{ item }} state=present
with_items:
- git
- python-keyczar
- php5-cli
- php5-sqlite
- php5-json
- php5-mcrypt
- php-gettext
- gettext
register: apt_output
changed_when: apt_output.stdout.find("0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded") == -1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment