On 01. aug. 2017 20:57, je...@soundhound.com wrote:
Explain to me how this works when this is the same role playbook?
I want this to be part of what is checked every time the role is run.

It would be easier to explain with some code, but I'm on vacation so I do not have access to the code I use at work.

On the dhcp server create a directory /etc/dhcp/dhcpd.d (or some other directory) In here you need to but files with content that in the end is going to be assembles to dhcpd.conf.

So instead of lineinfile you use template module and create a file in this directory with a unique name. This way if you managing several host they will create it one file and no locking is necessary.

After that you just need to assemble all the file in to one dhcpd.conf
- assemble:
    src: /etc/dhcp/dhcpd.d
    dest: /etc/dhcp/dhcpd.conf

The file will be assembles in sorted order so you need to make files with the correct order.

Hopefully this gives you an idea of how to circumvent the lack of file lock in Ansible.

--
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e3b0c74d-4aec-0b59-8184-d799d5a4148c%40olstad.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to