From ec3568e68cab3def6c612f31c5eabb2e78de6caf Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Tue, 23 Jun 2020 17:50:57 -0400 Subject: [PATCH] Generate container startup configs with a new module Remove container_startup_configs_tasks.yaml playbook, and some set_fact tasks that aren't needed anymore; since we now have a module to generate container startup config files. Note: unclean backport, we also have to remove the task: "Write per-step container startup configs for backward compatibility" Which isn't useful anymore. Depends-On: https://review.opendev.org/741356 Change-Id: I8ebe7f5f52f14a14c3911748b2e2063e0c3ad9ac (cherry picked from commit c587d74ae192fa9562b42ed118fc946547a6c899) --- common/container_startup_configs_tasks.yaml | 28 -------------- common/deploy-steps-tasks-step-1.yaml | 43 ++------------------- common/deploy-steps.j2 | 1 - 3 files changed, 3 insertions(+), 69 deletions(-) delete mode 100644 common/container_startup_configs_tasks.yaml diff --git a/common/container_startup_configs_tasks.yaml b/common/container_startup_configs_tasks.yaml deleted file mode 100644 index 4900ad1f24..0000000000 --- a/common/container_startup_configs_tasks.yaml +++ /dev/null @@ -1,28 +0,0 @@ ---- - -# TODO(emilien) convert this whole task in a module -# https://bugs.launchpad.net/tripleo/+bug/1884577 -- name: "Remove old {{ item.0 }} container startup configs" - become: true - file: - 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 {{ item.0 }}" - become: true - copy: - content: "{{ startup_data.value | to_nice_json }}" - dest: "/var/lib/tripleo-config/container-startup-config/{{ item.0 }}/{{ startup_data.key }}.json" - setype: container_file_t - mode: 0600 - no_log: true - loop_control: - loop_var: startup_data - loop: "{{ item.1 | dict2items }}" diff --git a/common/deploy-steps-tasks-step-1.yaml b/common/deploy-steps-tasks-step-1.yaml index b874139d87..1110ce3903 100644 --- a/common/deploy-steps-tasks-step-1.yaml +++ b/common/deploy-steps-tasks-step-1.yaml @@ -242,26 +242,6 @@ tags: - container_config_scripts - # Here we are dumping all the container startup configuration data - # so that we can have access to how they are started outside of heat - # and container cmd. This lets us create command line tools to test containers. - - name: Set container_config_default fact - no_log: True - set_fact: - container_config_default: "{{ container_config_default | default({}) | combine( {'step_' + item: {}} ) }}" - with_sequence: count={{ deploy_steps_max }} - tags: - - container_startup_configs - - - name: Set container_startup_configs_with_default fact - no_log: True - set_fact: - container_config_with_default: "{{ container_config_default | combine(role_data_container_config) }}" - vars: - role_data_container_config: "{{ lookup('file', tripleo_role_name + '/docker_config.yaml', errors='ignore') | default({}, True) | from_yaml }}" - tags: - - container_startup_configs - # This file location is deprecated and the new location is now: # /var/lib/tripleo-config/container-startup-config/step_X/.json # Can be removed in V cycle @@ -276,27 +256,10 @@ tags: - container_startup_configs - # For backward compatibility, the files are still generated. - # However, container_puppet.py won't create their hashed version if - # config changed. - - name: Write per-step container startup configs for backward compatibility - become: true - no_log: True - copy: - content: "{{ item[1] | to_nice_json }}" - dest: /var/lib/tripleo-config/container-startup-config-{{ item[0] }}.json - force: yes - mode: '0600' - loop: "{{ container_config_with_default | dictsort }}" - loop_control: - label: "{{ item[0] }}" - tags: - - container_startup_configs - - name: Generate startup configs files per step and per container - no_log: True - include_tasks: container_startup_configs_tasks.yaml - loop: "{{ container_config_with_default | dictsort }}" + container_startup_config: + config_base_dir: /var/lib/tripleo-config/container-startup-config + config_data: "{{ lookup('file', (tripleo_role_name + '/docker_config.yaml'), errors='ignore') | default({}, True) | from_yaml }}" tags: - container_startup_configs diff --git a/common/deploy-steps.j2 b/common/deploy-steps.j2 index 86508077ab..1437b4f230 100644 --- a/common/deploy-steps.j2 +++ b/common/deploy-steps.j2 @@ -398,7 +398,6 @@ outputs: hiera_steps_tasks: {get_file: hiera-steps-tasks.yaml} deploy_steps_tasks_step_0: {get_file: deploy-steps-tasks-step-0.yaml} common_deploy_steps_tasks_step_1: {get_file: deploy-steps-tasks-step-1.yaml} - container_startup_configs_tasks: {get_file: container_startup_configs_tasks.yaml} docker_puppet_script: {get_file: ./container-puppet.py} container_puppet_script: {get_file: ./container-puppet.sh} all_nodes_validation_script.sh : {get_file: ../validation-scripts/all-nodes.sh}