I am not able to figure out which array position is important for the 
current item as:


hosts:
* 1 - noApplication ( ID = 3 )
* 2 - Application ( ID = 2 )
* 3 - Application ( ID = 42 )

would be 

* 1 ( ID = 2 )
* 2 ( ID = 42 )

And I see no way to match those... Any Idea? Or is it possible without a 
lot of problems to create a plugin in ansible to solve this problem?

Am Montag, 25. August 2014 10:46:30 UTC+2 schrieb Bastian Bringenberg:
>
> Hey ho,
>
> I would like to deploy an application to several vhosts is 
> item.useApplication exists. I am possible to do that, download files and so 
> on and so on. But I get a problem as soon as I want to do an action if the 
> application is never installed.
>
> Normally:
>
> - stat: path=/etc/.git
>   register: exists_git
>   ignore_errors: yes
>
> - lineinfile: dest=/etc/rkhunter.conf line='ALLOWHIDDENDIR="/etc/.git"' 
> owner=root group=root mode=0644
>   when: exists_git.stat.exists
>
>
> But how is it possible for me to do this combined with "with_items"? One 
> approach, that (untested) will not work in my opinion:
>
>  - stat: path=/etc/.git
>   register: exists_git_{{ item.name }}
>   with_items: hosts
>   when: item.useApplication
>   ignore_errors: yes
>
> - lineinfile: dest=/etc/rkhunter.conf line='ALLOWHIDDENDIR="/etc/.git"' 
> owner=root group=root mode=0644
>   with_items: hosts
>   when: item.useApplication
>   when: exists_git_{{ item.name }}.stat.exists
>
>
> Is someone able to help me here?
>
> Have a nice week,
> Greetings from Bochum, RuhrArea, Germany,
>
> Bastian
>
>
> PS: rkhunter is just a demonstration how I do this normally^^.
>

-- 
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/ceb291bf-8341-4b9f-a938-5315772725d7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to