Browse Source

Cleanup all container startup configs before generating the new ones

Unlike the container puppet configs [1], we didn't have a mechanism that
was purging the old configs previously generated by the container
startup config tasks. It's problematic when some leftover configs are
still on the host and not needed anymore.

[1] https://opendev.org/openstack/tripleo-ansible/src/branch/master/tripleo_ansible/ansible_plugins/modules/container_puppet_config.py#L157-L159

Change-Id: I24dac79f2351a1ffd4e956584a80f623706cbd00
Closes-Bug: #1884537
(cherry picked from commit b1d3da8666)
changes/40/737340/3
Emilien Macchi 3 weeks ago
parent
commit
1fd3a3654d
1 changed files with 11 additions and 6 deletions
  1. +11
    -6
      common/container_startup_configs_tasks.yaml

+ 11
- 6
common/container_startup_configs_tasks.yaml View File

@@ -1,18 +1,23 @@
---
- set_fact:
step_path: "{{ item.0 }}"

- name: "Create directory for {{ step_path }} container startup configs"
# TODO(emilien) convert this whole task in a module
# https://bugs.launchpad.net/tripleo/+bug/1884577
- name: "Remove old {{ item.0 }} container startup configs"
file:
path: "/var/lib/tripleo-config/container-startup-config/{{ step_path }}/"
path: "/var/lib/tripleo-config/container-startup-config/{{ item.0 }}"
state: absent

- name: "Create directory for {{ item.0 }} container startup configs"
file:
path: "/var/lib/tripleo-config/container-startup-config/{{ item.0 }}/"
mode: 0600
recurse: yes
setype: svirt_sandbox_file_t

- name: "Creating container startup configs for {{ step_path }}"
- name: "Creating container startup configs for {{ item.0 }}"
copy:
content: "{{ startup_data.value | to_nice_json }}"
dest: "/var/lib/tripleo-config/container-startup-config/{{ step_path }}/{{ startup_data.key }}.json"
dest: "/var/lib/tripleo-config/container-startup-config/{{ item.0 }}/{{ startup_data.key }}.json"
setype: container_file_t
mode: 0600
no_log: true


Loading…
Cancel
Save