Ansible - only run a series of tasks if a precondition is met

Viewed 6453

I have a package I need to install from a remote URL as in:

- get-url: url=http://foo.com/foo.deb dest=/tmp

- command: dpkg --skip-same-version -i /tmp/foo.deb

- apt: update_cache=yes

- apt: pkg=foo state=present

I'd only like to run the first 3 if pkg=foo isn't already present. What's the best way to achieve this?

1 Answers
Related