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.

Conflicts:
    common/deploy-steps-tasks.yaml

Change-Id: Ia7476da222218411caddae887f99c029b4bccf23
(cherry picked from commit 961fdc22ee)
(cherry picked from commit 2ee39f20db)
This commit is contained in:
James Slagle 2018-09-06 08:53:28 -04:00 committed by Luke Short
parent e5e6fd4f11
commit 4f4bd1c28c
2 changed files with 91 additions and 1 deletions

View File

@ -16,8 +16,19 @@
selevel: s0
tags:
- host_config
- container_config
- container_config_tasks
- container_config_scripts
- container_startup_configs
- name: Create /var/lib/tripleo-config directory
file: path=/var/lib/tripleo-config state=directory 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: Check if puppet step_config.pp manifest exists
@ -26,19 +37,27 @@
stat:
path: "{{ tripleo_role_name + '/step_config.pp' }}"
register: stat_step_config
tags:
- host_config
- name: Set fact when file existed
no_log: True
set_fact:
role_data_step_config: "{{lookup('file', tripleo_role_name + '/step_config.pp')}}"
when: stat_step_config.stat.exists
tags:
- host_config
- name: Write the puppet step_config manifest
copy: content="{{role_data_step_config}}" 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
file: path=/var/lib/docker-puppet state=directory setype=svirt_sandbox_file_t selevel=s0 recurse=true
tags:
- container_config
- name: Check if docker-puppet puppet_config.yaml configuration file exists
delegate_to: localhost
@ -46,18 +65,26 @@
stat:
path: "{{ tripleo_role_name + '/puppet_config.yaml' }}"
register: stat_puppet_config
tags:
- container_config
- name: Set fact when file existed
no_log: True
set_fact:
role_data_puppet_config: "{{lookup('file', tripleo_role_name + '/puppet_config.yaml') | from_yaml | to_json}}"
when: stat_puppet_config.stat.exists
tags:
- container_config
- name: Write docker-puppet.json file
copy: content="{{role_data_puppet_config}}" 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
# /var/lib/docker-container-startup-configs.json is removed as we now write
@ -66,6 +93,8 @@
file:
path: /var/lib/docker-container-startup-configs.json
state: absent
tags:
- container_startup_configs
- name: Check if docker_config_scripts.yaml file exists
delegate_to: localhost
@ -73,16 +102,22 @@
stat:
path: "{{ tripleo_role_name + '/docker_config_scripts.yaml' }}"
register: stat_docker_config_scripts
tags:
- container_config_scripts
- name: Set fact when file existed
no_log: True
set_fact:
role_data_docker_config_scripts: "{{lookup('file', tripleo_role_name + '/docker_config_scripts.yaml') | from_yaml}}"
when: stat_docker_config_scripts.stat.exists
tags:
- container_config_scripts
- name: Write docker config scripts
copy: content="{{item.value.content}}" dest="/var/lib/docker-config-scripts/{{item.key}}" force=yes mode="{{item.value.mode|default('0600', true)}}"
with_dict: "{{role_data_docker_config_scripts}}"
tags:
- container_config_scripts
# Here we are dumping all the docker container startup configuration data
# so that we can have access to how they are started outside of heat
@ -94,6 +129,8 @@
set_fact:
docker_config_default: "{{ docker_config_default|default({}) | combine( {'step_'+item: {}} ) }}"
with_sequence: count={{deploy_steps_max}}
tags:
- container_startup_configs
- name: Check if docker_config.yaml file exists
delegate_to: localhost
@ -101,27 +138,39 @@
stat:
path: "{{ tripleo_role_name + '/docker_config.yaml' }}"
register: stat_docker_config
tags:
- container_startup_configs
- name: Set fact when file existed
no_log: True
set_fact:
role_data_docker_config: "{{lookup('file', tripleo_role_name + '/docker_config.yaml') | from_yaml}}"
when: stat_docker_config.stat.exists
tags:
- container_startup_configs
- name: Set docker_startup_configs_with_default fact
no_log: True
set_fact:
docker_config_with_default: "{{docker_config_default | combine(role_data_docker_config)}}"
tags:
- container_startup_configs
- name: Write docker-container-startup-configs
copy: content="{{docker_config_with_default | to_json }}" 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: content="{{item.value|to_json}}" dest="/var/lib/tripleo-config/docker-container-startup-config-{{item.key}}.json" force=yes mode=0600
with_dict: "{{docker_config_with_default}}"
tags:
- container_startup_configs
- name: Create /var/lib/kolla/config_files directory
file: path=/var/lib/kolla/config_files state=directory setype=svirt_sandbox_file_t selevel=s0 recurse=true
tags:
- container_startup_configs
- name: Check if kolla_config.yaml file exists
delegate_to: localhost
@ -129,16 +178,22 @@
stat:
path: "{{ tripleo_role_name + '/kolla_config.yaml' }}"
register: stat_kolla_config
tags:
- container_startup_configs
- name: Set fact when file existed
no_log: True
set_fact:
role_data_kolla_config: "{{lookup('file', tripleo_role_name + '/kolla_config.yaml') | from_yaml}}"
when: stat_kolla_config.stat.exists
tags:
- container_startup_configs
- name: Write kolla config json files
copy: content="{{item.value|to_json}}" dest="{{item.key}}" force=yes mode=0600
with_dict: "{{role_data_kolla_config}}"
tags:
- container_startup_configs
########################################################
# Bootstrap tasks, only performed on bootstrap_server_id
@ -151,6 +206,8 @@
with_fileglob:
- /var/lib/docker-puppet/docker-puppet-tasks*.json
when: deploy_server_id == bootstrap_server_id
tags:
- container_config_tasks
- name: Check if docker_puppet_tasks.yaml file exists
delegate_to: localhost
@ -158,17 +215,23 @@
stat:
path: "{{ tripleo_role_name + '/docker_puppet_tasks.yaml' }}"
register: stat_docker_puppet_tasks
tags:
- container_config_tasks
- name: Set fact when file existed
no_log: True
set_fact:
role_data_docker_puppet_tasks: "{{lookup('file', tripleo_role_name + '/docker_puppet_tasks.yaml') | from_yaml}}"
when: stat_docker_puppet_tasks.stat.exists
tags:
- container_config_tasks
- name: Write docker-puppet-tasks json files
copy: content="{{item.value|to_json}}" dest=/var/lib/docker-puppet/docker-puppet-tasks{{item.key.replace("step_", "")}}.json force=yes mode=0600
with_dict: "{{role_data_docker_puppet_tasks}}"
when: deploy_server_id == bootstrap_server_id
tags:
- container_config_tasks
#####################################################
# Per step puppet configuration of the baremetal host
@ -178,10 +241,14 @@
set_fact:
host_puppet_config_debug: "--debug --verbose"
when: enable_debug|default(false)|bool
tags:
- host_config
- name: Write the config_step hieradata
copy: content="{{dict(step=step|int)|to_json}}" dest=/etc/puppet/hieradata/config_step.json force=true mode=0600
become: true
tags:
- host_config
- name: Run puppet host configuration for step {{step}}
command: >-
@ -197,11 +264,15 @@
failed_when: false
no_log: true
become: true
tags:
- host_config
- name: "Debug output for task: Run puppet host configuration for step {{ step }}"
debug: var=outputs.stdout_lines|default([])|union(outputs.stderr_lines|default([]))
when: outputs.rc is defined
failed_when: outputs.rc not in [0, 2]
tags:
- host_config
######################################
# Generate config via docker-puppet.py
@ -220,11 +291,15 @@
failed_when: false
no_log: true
become: 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
@ -244,11 +319,15 @@
failed_when: false
no_log: true
become: 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
@ -259,6 +338,8 @@
path: /var/lib/docker-puppet/docker-puppet-tasks{{step}}.json
register: docker_puppet_tasks_json
become: true
tags:
- container_config_tasks
- name: Run docker-puppet tasks (bootstrap tasks) for step {{step}}
shell: python /var/lib/docker-puppet/docker-puppet.py
@ -274,9 +355,12 @@
failed_when: false
no_log: true
become: 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

View File

@ -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.