Merge "Move overcloud common bootstrap tasks out of step1 deploy tasks"

This commit is contained in:
Zuul 2021-04-01 13:59:32 +00:00 committed by Gerrit Code Review
commit 7d48e49301
3 changed files with 138 additions and 105 deletions

View File

@ -0,0 +1,104 @@
- name: Create and ensure setype for /var/log/containers directory
become: true
file:
path: /var/log/containers
state: directory
setype: container_file_t
selevel: s0
mode: 0750
tags:
- host_config
- name: Create ContainerLogStdoutPath directory
become: true
file:
path: "{{ container_log_stdout_path }}"
state: directory
selevel: s0
tags:
- host_config
- name: Create /var/lib/tripleo-config directory
become: true
file:
path: /var/lib/tripleo-config
state: directory
setype: container_file_t
selevel: s0
recurse: true
tags:
- host_config
- container_config
- container_config_tasks
- container_config_scripts
- container_startup_configs
# The container config files
# /var/lib/container-startup-configs.json is removed as we now write
# per-step files instead
- name: Clean old /var/lib/container-startup-configs.json file
become: true
file:
path: /var/lib/container-startup-configs.json
state: absent
tags:
- container_startup_configs
# For legacy, can be removed in Train cycle
- name: Clean old /var/lib/docker-container-startup-configs.json file
become: true
file:
path: /var/lib/docker-container-startup-configs.json
state: absent
tags:
- container_startup_configs
- import_tasks: common_container_config_scripts.yaml
# This file location is deprecated and the new location is now:
# /var/lib/tripleo-config/container-startup-config/step_X/<container_name>.json
# Can be removed in V cycle
- name: Write /var/lib/tripleo-config/container-startup-config-readme.txt
become: true
no_log: True
copy:
content: "Container startup configs moved to /var/lib/tripleo-config/container-startup-config"
dest: /var/lib/tripleo-config/container-startup-config-readme.txt
force: yes
mode: '0600'
tags:
- container_startup_configs
- name: Generate startup configs files per step and per container
become: true
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
- name: Create /var/lib/kolla/config_files directory
become: true
file:
path: /var/lib/kolla/config_files
state: directory
setype: container_file_t
selevel: s0
recurse: true
tags:
- container_startup_configs
- name: Create /var/lib/config-data directory
become: true
file:
path: /var/lib/config-data
state: directory
setype: container_file_t
selevel: s0
- name: Write container config json files
become: true
tripleo_container_configs:
config_data: "{{ lookup('file', tripleo_role_name + '/kolla_config.yaml', errors='ignore') | default({}, True) | from_yaml }}"
tags:
- container_startup_configs

View File

@ -1,38 +1,3 @@
- name: Create and ensure setype for /var/log/containers directory
become: true
file:
path: /var/log/containers
state: directory
setype: container_file_t
selevel: s0
mode: 0750
tags:
- host_config
- name: Create ContainerLogStdoutPath directory
become: true
file:
path: "{{ container_log_stdout_path }}"
state: directory
selevel: s0
tags:
- host_config
- name: Create /var/lib/tripleo-config directory
become: true
file:
path: /var/lib/tripleo-config
state: directory
setype: container_file_t
selevel: s0
recurse: true
tags:
- host_config
- container_config
- container_config_tasks
- container_config_scripts
- container_startup_configs
- name: Delete existing /var/lib/tripleo-config/check-mode directory for check mode - name: Delete existing /var/lib/tripleo-config/check-mode directory for check mode
become: true become: true
file: file:
@ -175,50 +140,6 @@
tags: tags:
- container_config - container_config
# The container config files
# /var/lib/container-startup-configs.json is removed as we now write
# per-step files instead
- name: Clean old /var/lib/container-startup-configs.json file
become: true
file:
path: /var/lib/container-startup-configs.json
state: absent
tags:
- container_startup_configs
# For legacy, can be removed in Train cycle
- name: Clean old /var/lib/docker-container-startup-configs.json file
become: true
file:
path: /var/lib/docker-container-startup-configs.json
state: absent
tags:
- container_startup_configs
- import_tasks: common_container_config_scripts.yaml
# This file location is deprecated and the new location is now:
# /var/lib/tripleo-config/container-startup-config/step_X/<container_name>.json
# Can be removed in V cycle
- name: Write /var/lib/tripleo-config/container-startup-config-readme.txt
become: true
no_log: True
copy:
content: "Container startup configs moved to /var/lib/tripleo-config/container-startup-config"
dest: /var/lib/tripleo-config/container-startup-config-readme.txt
force: yes
mode: '0600'
tags:
- container_startup_configs
- name: Generate startup configs files per step and per container
become: true
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
- name: Ensure config hashes are up-to-date for container startup configs - name: Ensure config hashes are up-to-date for container startup configs
become: true become: true
container_puppet_config: container_puppet_config:
@ -226,32 +147,6 @@
tags: tags:
- container_startup_configs - container_startup_configs
- name: Create /var/lib/kolla/config_files directory
become: true
file:
path: /var/lib/kolla/config_files
state: directory
setype: container_file_t
selevel: s0
recurse: true
tags:
- container_startup_configs
- name: Create /var/lib/config-data directory
become: true
file:
path: /var/lib/config-data
state: directory
setype: container_file_t
selevel: s0
- name: Write container config json files
become: true
tripleo_container_configs:
config_data: "{{ lookup('file', tripleo_role_name + '/kolla_config.yaml', errors='ignore') | default({}, True) | from_yaml }}"
tags:
- container_startup_configs
- name: Set host puppet debugging fact string - name: Set host puppet debugging fact string
set_fact: set_fact:
host_puppet_config_debug: "--debug --verbose" host_puppet_config_debug: "--debug --verbose"

View File

@ -426,6 +426,7 @@ outputs:
common_container_config_scripts: {get_file: common-container-config-scripts.yaml} common_container_config_scripts: {get_file: common-container-config-scripts.yaml}
hiera_steps_tasks: {get_file: hiera-steps-tasks.yaml} hiera_steps_tasks: {get_file: hiera-steps-tasks.yaml}
deploy_steps_tasks_step_0: {get_file: deploy-steps-tasks-step-0.yaml} deploy_steps_tasks_step_0: {get_file: deploy-steps-tasks-step-0.yaml}
common_container_setup_tasks: {get_file: common-container-setup-tasks.yaml}
common_deploy_steps_tasks_step_1: {get_file: deploy-steps-tasks-step-1.yaml} common_deploy_steps_tasks_step_1: {get_file: deploy-steps-tasks-step-1.yaml}
container_puppet_script: {get_file: ./container-puppet.sh} container_puppet_script: {get_file: ./container-puppet.sh}
generate-config-tasks: {get_file: generate-config-tasks.yaml} generate-config-tasks: {get_file: generate-config-tasks.yaml}
@ -680,6 +681,39 @@ outputs:
- overcloud - overcloud
- host_prep_steps - host_prep_steps
- hosts: {{primary_role_name}}:DEPLOY_TARGET_HOST
strategy: tripleo_free
name: Overcloud container setup tasks
become: true
gather_facts: "{% raw %}{{ gather_facts | default(false) }}{% endraw %}"
any_errors_fatal: yes
vars:
bootstrap_server_id: BOOTSTRAP_SERVER_ID
deploy_identifier: DEPLOY_IDENTIFIER
enable_debug: ENABLE_DEBUG
enable_puppet: ENABLE_PUPPET
container_cli: CONTAINER_CLI
container_log_stdout_path: CONTAINER_LOG_STDOUT_PATH
container_healthcheck_disabled: CONTAINER_HEALTHCHECK_DISABLED
docker_puppet_debug: DOCKER_PUPPET_DEBUG
docker_puppet_process_count: DOCKER_PUPPET_PROCESS_COUNT
docker_puppet_mount_host_puppet: DOCKER_PUPPET_MOUNT_HOST_PUPPET
tasks:
- name: Overcloud container setup tasks
block:
- name: Overcloud container setup tasks
delegate_to: localhost
run_once: true
debug:
msg: Use --start-at-task 'Overcloud container setup tasks' to resume from this task
- name: Write config data
include_tasks: common_container_setup_tasks.yaml
when:
- (deploy_identifier is defined and deploy_identifier != "" and deploy_identifier is not none)
tags:
- overcloud
- container_setup_tasks
{%- for step in range(1,deploy_steps_max) %} {%- for step in range(1,deploy_steps_max) %}
- hosts: DEPLOY_SOURCE_HOST - hosts: DEPLOY_SOURCE_HOST