On Friday, August 25, 2017 at 5:00:41 PM UTC-6, Kai Stian Olstad wrote:
>
> On lørdag 26. august 2017 00.45.07 CEST John Harmon wrote: 
> > - name: Removing existing DNS entries from ifcfg-* files 
> >   lineinfile: 
> >     path: "{{ net_path }}{{ item }}" 
> >     backup: yes 
> >     state: absent 
> >     regexp: '^DNS' 
> >   with_items: "{{ ifcfg_list.stdout_lines }}" 
>
> <snip /> 
>
> > - name: Update DNS in ifcfg files 
> >   blockinfile: 
> >     path: "{{ net_path }}{{ item }}" 
> >     marker: '# {mark} ANSIBLE MANAGED BLOCK -- Manual changes will be 
> > overwritten' 
> >     insertafter: EOF 
> >     block: | 
> >       DNS1="{{ dns1 }}" 
> >       DNS2="{{ dns2 }}" 
> >     with_items: "{{ ifcfg_list.stdout_lines }}" 
>
> Your indentation is wrong, with_items should be at the same level as 
> blockinfile, just as you have in your with_items in the lineinfile. 
>
> When you fix that I still thing it will fail. Since the maker: is the same 
> on 
> every loop it will just replace the same section. 
> You would need to implement some kind of unique marker to make it work, 
> one 
> way is to incorporate the {{ item }}. 
>
> -- 
> Kai Stian Olstad 
>

Thanks again Kai Stian Olstad.  You have been very helpful to me 

-- 
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/f60ef5e4-72d3-4c6e-9adc-a8cc625558ef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to