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/2ced1119-8fda-4ace-a27b-db3879280f55%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to