What's wrong with "with_nested"?
#####
- name: Update ifcfg-* files
ini_file:
path: "{{ net_path }}{{ item[1] }}"
no_extra_spaces: true
section: null
state: present
option: "{{ item[0].option }}"
value: "{{ item[0].value }}"
with_nested:
- [{ option: "NM_CONTROLLED", value: "no" }, { option: "PEERDNS", value:
"no" }, { option: "DNS1", value: "{{ dns1
}}" }, { option: "DNS2", value: "{{ dns2 }}" }]
- '{{ ifcfg_list.stdout_lines }}'
notify:
- Networking
#####
Am 29.01.2018 um 19:07 schrieb John Harmon:
> |
> -name:Gatherlist 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:Updateifcfg-*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/7e1cf33e-f4dc-8e29-fc62-1a8e9ca479a1%40gmail.com.
For more options, visit https://groups.google.com/d/optout.