You could first check if the package is installed and register a variable to that effect.
- shell: dpkg -l foo
changed_when: False
failed_when: False
register: foo_installed
- service: name=foo enabled=no state=stopped
when: foo_installed.rc == 0
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/37211c6a-2e21-4a92-9e9a-59d6b8afd4b9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.