Nothing I guess, other than I didn't know how to use it in this scenario.  
Thank you for your example, I will go and work with it.

On Monday, January 29, 2018 at 11:07:24 AM UTC-7, John Harmon wrote:
>
> This is similar to another question I posed a few days ago, but different 
> enough I thought it deserved its own topic.  I have a variable of 
> ifcfg-list.stdout_lines that contains a list of ifcfg-* file names 
> (exlcuding loopback).  I need to iterate the following code over this list 
> (apply it to all ifcfg-* files), but don't know how to do it.  with_nested 
> doesn't seem to be the right solution to me.  I know I can do this in 
> multiple tasks (already done), but I am trying to consolidate all of the 
> tasks down to a single task:
>
> - name: Gather list of ifcfg-* files
>   shell: ls "{{ net_path }}" | grep ^ifcfg- | grep 0$ | grep -ve ifcfg-lo 
> -e \@ # \@ excludes ansible backup files
>   register: ifcfg_list
>   changed_when: false
>
> - name: Update ifcfg-* files
>   ini_file:
>     path: "{{ net_path }}{{ ifcfg_list.stdout_lines }}" #<-- I know this 
> is wrong, but I need to iterate through this list and apply the changes to 
> all files.
>     no_extra_spaces: true
>     section: null
>     state: present
>     option: "{{ item.option }}"
>     value: "{{ item.value }}"
>   with_items:
>     - { option: "NM_CONTROLLED", value: "no" }
>     - { option: "PEERDNS", value: "no" }
>     - { option: "DNS1", value: "{{ dns1 }}" }
>     - { option: "DNS2", value: "{{ dns2 }}" }
>   notify:
>     - Networking
>
>
>

-- 
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/60cb5414-097d-4441-b57c-a4107ed65016%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to