Fix idempotency for os-lxc-container-setup.yml

Added regexp to avoid multiple entry of lxc.start.order in
os-lxc-container-setup.yml. Remove insertafter to avoid
confusion.

Change-Id: I50ea0ba97c79f9c1509e382643b9aecc805862b7
Closes-Bug: 1862625
This commit is contained in:
ysastri 2020-02-10 16:06:06 +01:00
parent 115a972e1f
commit 4d9b568f6c

View File

@ -61,9 +61,9 @@
- name: Extra lxc config
lineinfile:
dest: "/var/lib/lxc/{{ inventory_hostname }}/config"
path: "/var/lib/lxc/{{ inventory_hostname }}/config"
regexp: "^{{ item.split('=')[0] }} ="
line: "{{ item.split('=')[0] }} = {{ item.split('=', 1)[1] }}"
insertafter: "^{{ item.split('=')[0] }}"
backup: "true"
with_items: "{{ extra_container_config | default([]) }}"
delegate_to: "{{ physical_host }}"
@ -73,9 +73,9 @@
- name: Extra lxc config no restart
lineinfile:
dest: "/var/lib/lxc/{{ inventory_hostname }}/config"
path: "/var/lib/lxc/{{ inventory_hostname }}/config"
regexp: "^{{ item.split('=')[0] }} ="
line: "{{ item.split('=')[0] }} = {{ item.split('=', 1)[1] }}"
insertafter: "^{{ item.split('=')[0] }}"
backup: "true"
with_items: "{{ extra_container_config_no_restart | default(['lxc.start.order=100']) }}"
delegate_to: "{{ physical_host }}"