For editing /etc/network/interfaces I use replace module with some patches.
- name: setup docker0 bridge
replace:
dest: /etc/network/interfaces
regexp: '^(# role docker.*[\n\r]+)?iface\s+docker0\s+.*[\n\r]+([
\t]+.*[\n\r]?)*(# role docker.*[\n\r]?)?'
replace: |
# role docker script config BEGIN
iface docker0 inet static
bridge_ports none
bridge_stp off
bridge_maxwait 0
bridge_fd 0
address {{ docker_net_prefix }}.255.254
netmask 255.255.0.0
# role docker script config END
append: yes
register: redocker
I have only trouble with missing trailing newline.
Dne středa, 9. dubna 2014 16:49:03 UTC+2 Michael Baydoun napsal(a):
>
> I need to insert many lines of configuration and must use lineinfile or
> something similar.
> The particular application in question also writes changes over time to
> other parts of the same file.
>
> What is the best, cleanest way to accomplish this?
> Is there a solution other than to string a bunch of lineinfile modules
> together?
>
--
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/440245fa-647e-4183-9121-c5a9d9fe4c7d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.