Hmm -
I have fixed it with a when statement and then notify a handler that in 
turns install and notifies yet another handler.
Thou this solution does not look nice and I would really like to not relay 
on any other managementsystem other then Ansible.

My sollution to problem looks like this atm:

- name: something
  <do something>
  register: something
  ignore_errors: True

- name: simplejson
  raw: "yum -y install python-simplejson"
  when: something|failed
  notify:
    - somethingAgain

handlers:
  - name: somethingAgain
    <some action again>

...
  
The above one works kinda but is not the best looking.

Preffered would be similar to:
- name: something
  <do something>
  register: something
  notify_when: something|failed
    - simplejson

handlers:
  - name: simplejson
    raw: "yum -y install python-simplejson"


Does anyone know if something like this might be implemented in the near 
future or if anyone can point me to where I can suggest a "patch" :)


Den tisdagen den 15:e april 2014 kl. 17:34:01 UTC+2 skrev Dick Davies:
>
> On 15 April 2014 09:24, Joachim Friberg <[email protected] <javascript:>> 
> wrote: 
>
> > 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. 
>
> In this specific case you'd just assert the python-simplejson package 
> exists right? 
> If it's already installed then nothing happens, and you'll be able to 
> skip on to the 
> other tasks. 
>
> If of course you're in a catch-22 situation (can't run ansible to set 
> up ansible pre-requisites), 
> then you'll need to seed your base image with what's required. 
>
> For example, my kickstarts bring up a machine with 
>
> * SSHd enabled and tcp/22 inbound permitted on the local firewall 
> * an 'ansible' account with a pre-defined list of SSH keys in its 
> authorised_keys file 
> * passwordless sudo configured for that account 
>
> Everything else is managed by Ansible. 
>
> This general approach also applies to CM with puppet, chef, etc. 
> (which typically 
> have much more requirements). 
>

-- 
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/c555063b-b544-4802-b370-54f730fe640d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to