Hi,
So what I want to do, and have not yet found a way todo yet, is to run a
handler if a taks fails rather then if it succeeds.
For example I want to do a yum install mysql on a server, but this server
does not have python-simplejson and/or other packages that is neccesary for
Ansible.
How do I then trigger a "fix" and then preferably rerun the failed task. Is
this possible?
Something similar to:
- hosts: mysql
user: admin
vars:
passwd: VeryHardPasswd
user: analytics
tasks:
- name: create user Analytics
mysql_user: name={{ user }}
password={{ passwd }}
priv=*.*:SELECT,'SHOW DATABASES'
state=present
login_user=ROOT
login_password=PASSWORD
register: mysql_result
ignore_errors: True
notify_on_fail: install mysqldb-python
handlers:
- name: Install mysqldb-python
raw: sudo yum install -y MySQL-python
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/494bc168-bce7-4e5a-8fda-1d335cd8a0f2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.