Hi,

Thanks a lot it works, that was absolutely what I was waiting for!

I totally missed local_action Ansible function.

Regards

Le vendredi 30 mai 2014 01:47:25 UTC+2, Nathan Howell a écrit :
>
> I haven't tested this, but how about the stat module run as a local action?
>
> - local_action: stat path=init.{{ ansible_hostname }}
>   register: init_file
>
> - name: Install firewall rules
>   copy: ...
>   when: init_file.stat.exists
>
> Nathan
>
> On Thursday, 29 May 2014 10:04:42 UTC-7, Pierre Mavro wrote:
>>
>> Hi,
>>
>> I'm trying to do something with Ansible and I would like to know how to 
>> do something.
>>
>> Is it possible to launch an action if a local (not remote) file exists? E
>> xample:
>>
>> - name: Install firewall rules
>>   copy: src=init.{{ ansible_hostname }} dest=/etc/init.d/iptables 
>> owner=root group=root mode=0755 backup=yes
>>
>> The problem here is my source fails (if init.{{ ansible_hostname }} 
>> doesn't exists), I got an error message. Is it possible to do a such thing?
>>
>> Thanks
>>
>

-- 
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/f17e83ef-51ca-48d6-a371-ea3c45bba5d9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to