On 26.01.2018 00:53, John Harmon wrote:
The more I read about this, the more I think it is working out of luck.
In
fact, I don't understand how it is working now based on the output
previously mentioned. According to that both DNS1 and DNS2 should be
pointing to dns2 or 10.1.1.11. Thoughts?
Your nested has 3 levels and that gets you in trouble since you get this
four combinations
ifcfg-eth0 , ^DNS1.* , DNS1=10.1.1.10
ifcfg-eth0 , ^DNS1.* , DNS2=10.1.1.11
ifcfg-eth0 , ^DNS2.* , DNS1=10.1.1.10
ifcfg-eth0 , ^DNS2.* , DNS2=10.1.1.11
But you only want these two
ifcfg-eth0 , ^DNS1.* , DNS1=10.1.1.10
ifcfg-eth0 , ^DNS2.* , DNS2=10.1.1.11
So try this
- name: Add DNS entries to ifcfg-* files if missing
lineinfile:
path: "{{ net_path }}{{ item[0] }}"
state: present
regexp: "^{{ item[1] }}"
line: "{{ item[1] }}={{ vars[item[1] | lower] }}"
with_nested:
- '{{ ifcfg_list.stdout_lines }}'
- [ 'DNS1', 'DNS2' ]
--
Kai Stian Olstad
--
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/0d3eabce3bac71f5279ea1e179da1db5%40olstad.com.
For more options, visit https://groups.google.com/d/optout.