On 04.04.2017 19:11, Gabriel Forster wrote:
I think my issue is that I'm trying to get with_items to do too much. But when I use user.uniq instead of with_items, I'm getting a similar error.
I'm really not understanding what approach to take. Thanks,

Here is the task:

 - name: Create New Version Directories in User's Home Dir
   file: path={{ home_path }}/home/{{ item.uniq }}/validator/{{ item }}
mode=0755 owner={{ item.uniq }} group={{ group_devel }} state=directory
   with_items:
     - "{{ user }}"
     - "{{ validator_ver }}"
     - "{{ validator_ver }}/log"
     - "{{ validator_ver }}/config"

I'm not sure I understand what you are trying to do, since the with_items list is a mix of different data.

with_items will in you code run the module file 4 times.
1. First time with item = "{{ user }}"
2. Second time with item = "{{ validator_ver }}"
3. Third time with item = "{{ validator_ver }}/log"
4. Last time with item = "{{ validator_ver }}/config"

item.uniq will only be avaiable on the first run since that is the only one that contains the key.

So for owner you are probably looking for "{{ user.uniq }}" and remove the - "{{ user }}" form the list.

--
Kai Stian Olstad

--
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/e8b378f72d75d4f014eb0f719b8260c7%40olstad.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to