From 2ee39f20dbc190adc2ba3ead8a00aebd565c14b0 Mon Sep 17 00:00:00 2001 From: James Slagle Date: Thu, 6 Sep 2018 08:53:28 -0400 Subject: [PATCH] Tag tasks in in common tasks Adds the following tags to relevant tasks in deploy-steps-tasks.yaml that are common to all roles: - host_config - container_config - container_config_tasks - container_config_scripts - container_startup_configs The tags are tool agnostic, so hopefully they won't have to be updated over time. They allow users to run only specific parts of the common tasks. Change-Id: Ia7476da222218411caddae887f99c029b4bccf23 (cherry picked from commit 961fdc22ee19a4c6d61a3de7ab08540662825303) --- common/deploy-steps-tasks.yaml | 57 ++++++++++++++++++- .../tag-common-tasks-4a78275787655fdd.yaml | 6 ++ 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/tag-common-tasks-4a78275787655fdd.yaml diff --git a/common/deploy-steps-tasks.yaml b/common/deploy-steps-tasks.yaml index 9d1d6a3b03..8961470d93 100644 --- a/common/deploy-steps-tasks.yaml +++ b/common/deploy-steps-tasks.yaml @@ -14,6 +14,12 @@ setype: svirt_sandbox_file_t selevel: s0 recurse: true + tags: + - host_config + - container_config + - container_config_tasks + - container_config_scripts + - container_startup_configs # Puppet manifest for baremetal host configuration - name: Write the puppet step_config manifest @@ -22,6 +28,8 @@ dest: /var/lib/tripleo-config/puppet_step_config.pp force: yes mode: '0600' + tags: + - host_config # Config file for our docker-puppet.py script, used to generate container configs - name: Create /var/lib/docker-puppet @@ -30,6 +38,8 @@ state: directory setype: svirt_sandbox_file_t selevel: s0 + tags: + - container_config - name: Write docker-puppet.json file copy: @@ -37,11 +47,15 @@ dest: /var/lib/docker-puppet/docker-puppet.json force: yes mode: '0600' + tags: + - container_config - name: Create /var/lib/docker-config-scripts file: path: /var/lib/docker-config-scripts state: directory + tags: + - container_config_scripts # The container config files @@ -51,6 +65,8 @@ file: path: /var/lib/docker-container-startup-configs.json state: absent + tags: + - container_startup_configs - name: Write docker config scripts copy: @@ -61,6 +77,8 @@ with_dict: "{{ role_data_docker_config_scripts }}" vars: role_data_docker_config_scripts: "{{ lookup('file', tripleo_role_name + '/docker_config_scripts.yaml', errors='ignore') | default({}, True) | from_yaml }}" + tags: + - container_config_scripts # Here we are dumping all the docker container startup configuration data @@ -73,6 +91,8 @@ set_fact: docker_config_default: "{{ docker_config_default | default({}) | combine( {'step_' + item: {}} ) }}" with_sequence: count={{ deploy_steps_max }} + tags: + - container_startup_configs - name: Set docker_startup_configs_with_default fact no_log: True @@ -80,6 +100,8 @@ docker_config_with_default: "{{ docker_config_default | combine(role_data_docker_config) }}" vars: role_data_docker_config: "{{ lookup('file', tripleo_role_name + '/docker_config.yaml', errors='ignore') | default({}, True) | from_yaml }}" + tags: + - container_startup_configs - name: Write docker-container-startup-configs copy: @@ -87,6 +109,8 @@ dest: /var/lib/docker-container-startup-configs.json force: yes mode: '0600' + tags: + - container_startup_configs - name: Write per-step docker-container-startup-configs copy: @@ -95,6 +119,8 @@ force: yes mode: '0600' with_dict: "{{ docker_config_with_default }}" + tags: + - container_startup_configs - name: Create /var/lib/kolla/config_files directory file: @@ -103,6 +129,8 @@ setype: svirt_sandbox_file_t selevel: s0 recurse: true + tags: + - container_startup_configs - name: Write kolla config json files copy: @@ -111,6 +139,8 @@ force: yes mode: '0600' with_dict: "{{ lookup('file', tripleo_role_name + '/kolla_config.yaml', errors='ignore') | default([], True) | from_yaml }}" + tags: + - container_startup_configs ######################################################## # Bootstrap tasks, only performed on bootstrap_server_id @@ -123,6 +153,8 @@ with_fileglob: - /var/lib/docker-puppet/docker-puppet-tasks*.json when: deploy_server_id == bootstrap_server_id + tags: + - container_config_tasks - name: Write docker-puppet-tasks json files copy: @@ -132,6 +164,8 @@ mode: '0600' with_dict: "{{ lookup('file', tripleo_role_name + '/docker_puppet_tasks.yaml', errors='ignore') | default({}, True) | from_yaml }}" when: deploy_server_id == bootstrap_server_id + tags: + - container_config_tasks ##################################################### # Per step puppet configuration of the baremetal host @@ -143,6 +177,8 @@ when: - enable_puppet | default(true) | bool - enable_debug | default(false) | bool + tags: + - host_config - name: Write the config_step hieradata copy: @@ -150,6 +186,8 @@ dest: /etc/puppet/hieradata/config_step.json force: true mode: '0600' + tags: + - host_config - name: Run puppet host configuration for step {{ step }} when: enable_puppet|default(true)|bool @@ -165,6 +203,8 @@ register: outputs failed_when: false no_log: true + tags: + - host_config - name: "Debug output for task: Run puppet host configuration for step {{ step }}" debug: @@ -173,6 +213,8 @@ - enable_puppet | default(true) | bool - outputs.rc is defined failed_when: outputs.rc not in [0, 2] + tags: + - host_config ###################################### # Generate config via docker-puppet.py @@ -190,12 +232,16 @@ register: outputs failed_when: false no_log: true + tags: + - container_config - name: "Debug output for task: Run docker-puppet tasks (generate config) during step {{ step }}" debug: var: outputs.stdout_lines | default([]) | union(outputs.stderr_lines | default([])) when: outputs.rc is defined failed_when: outputs.rc != 0 + tags: + - container_config ################################################## # Per step starting of the containers using paunch @@ -214,12 +260,16 @@ register: outputs failed_when: false no_log: true + tags: + - container_startup_configs - name: "Debug output for task: Start containers for step {{ step }}" debug: var: outputs.stdout_lines | default([]) | union(outputs.stderr_lines | default([])) when: outputs.rc is defined failed_when: outputs.rc != 0 + tags: + - container_startup_configs ######################################################## # Bootstrap tasks, only performed on bootstrap_server_id @@ -229,6 +279,8 @@ stat: path: /var/lib/docker-puppet/docker-puppet-tasks{{ step }}.json register: docker_puppet_tasks_json + tags: + - container_config_tasks - name: Run docker-puppet tasks (bootstrap tasks) for step {{ step }} shell: python /var/lib/docker-puppet/docker-puppet.py @@ -245,10 +297,13 @@ register: outputs failed_when: false no_log: true + tags: + - container_config_tasks - name: "Debug output for task: Run docker-puppet tasks (bootstrap tasks) for step {{ step }}" debug: var: outputs.stdout_lines | default([]) | union(outputs.stderr_lines | default([])) when: outputs.rc is defined failed_when: outputs.rc != 0 - + tags: + - container_config_tasks diff --git a/releasenotes/notes/tag-common-tasks-4a78275787655fdd.yaml b/releasenotes/notes/tag-common-tasks-4a78275787655fdd.yaml new file mode 100644 index 0000000000..9e298e75a1 --- /dev/null +++ b/releasenotes/notes/tag-common-tasks-4a78275787655fdd.yaml @@ -0,0 +1,6 @@ +--- +other: + - | + The common tasks in deploy-steps-tasks.yaml that are common to all roles + are now tagged with one of: host_config, container_config, + container_config_tasks, container_config_scripts, or container_startup_configs.