Revert "Optimized Ansible tasks in deplay-steps-tasks.yaml"
This reverts commit b8065e6709
.
This appears to have broken all the scenarios.
Change-Id: I158de05fdc4874c579c97c82f820641061b426c6
Closes-Bug: #1784078
This commit is contained in:
parent
b8065e6709
commit
d3c791e8f7
|
@ -9,41 +9,47 @@
|
||||||
become: true
|
become: true
|
||||||
block:
|
block:
|
||||||
- name: Create /var/lib/tripleo-config directory
|
- name: Create /var/lib/tripleo-config directory
|
||||||
file:
|
file: path=/var/lib/tripleo-config state=directory setype=svirt_sandbox_file_t selevel=s0 recurse=true
|
||||||
path: /var/lib/tripleo-config
|
|
||||||
state: directory
|
|
||||||
setype: svirt_sandbox_file_t
|
|
||||||
selevel: s0
|
|
||||||
recurse: true
|
|
||||||
|
|
||||||
# Puppet manifest for baremetal host configuration
|
# Puppet manifest for baremetal host configuration
|
||||||
|
- name: Check if puppet step_config.pp manifest exists
|
||||||
|
delegate_to: localhost
|
||||||
|
become: false
|
||||||
|
stat:
|
||||||
|
path: "{{ tripleo_role_name + '/step_config.pp' }}"
|
||||||
|
register: stat_step_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
|
||||||
|
|
||||||
- name: Write the puppet step_config manifest
|
- name: Write the puppet step_config manifest
|
||||||
copy:
|
copy: content="{{role_data_step_config}}" dest=/var/lib/tripleo-config/puppet_step_config.pp force=yes mode=0600
|
||||||
content: "{{ lookup('file', tripleo_role_name + '/step_config.pp', errors='ignore') | default('', True) }}"
|
|
||||||
dest: /var/lib/tripleo-config/puppet_step_config.pp
|
|
||||||
force: yes
|
|
||||||
mode: '0600'
|
|
||||||
|
|
||||||
# Config file for our docker-puppet.py script, used to generate container configs
|
# Config file for our docker-puppet.py script, used to generate container configs
|
||||||
- name: Create /var/lib/docker-puppet
|
- name: Create /var/lib/docker-puppet
|
||||||
file:
|
file: path=/var/lib/docker-puppet state=directory setype=svirt_sandbox_file_t selevel=s0 recurse=true
|
||||||
path: /var/lib/docker-puppet
|
|
||||||
state: directory
|
- name: Check if docker-puppet puppet_config.yaml configuration file exists
|
||||||
setype: svirt_sandbox_file_t
|
delegate_to: localhost
|
||||||
selevel: s0
|
become: false
|
||||||
|
stat:
|
||||||
|
path: "{{ tripleo_role_name + '/puppet_config.yaml' }}"
|
||||||
|
register: stat_puppet_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
|
||||||
|
|
||||||
- name: Write docker-puppet.json file
|
- name: Write docker-puppet.json file
|
||||||
copy:
|
copy: content="{{role_data_puppet_config}}" dest=/var/lib/docker-puppet/docker-puppet.json force=yes mode=0600
|
||||||
content: "{{ lookup('file', tripleo_role_name + '/puppet_config.yaml', errors='ignore') | default([], True) | from_yaml | to_json }}"
|
|
||||||
dest: /var/lib/docker-puppet/docker-puppet.json
|
|
||||||
force: yes
|
|
||||||
mode: '0600'
|
|
||||||
|
|
||||||
- name: Create /var/lib/docker-config-scripts
|
- name: Create /var/lib/docker-config-scripts
|
||||||
file:
|
file: path=/var/lib/docker-config-scripts state=directory
|
||||||
path: /var/lib/docker-config-scripts
|
|
||||||
state: directory
|
|
||||||
|
|
||||||
|
|
||||||
# The container config files
|
# The container config files
|
||||||
# /var/lib/docker-container-startup-configs.json is removed as we now write
|
# /var/lib/docker-container-startup-configs.json is removed as we now write
|
||||||
|
@ -53,65 +59,78 @@
|
||||||
path: /var/lib/docker-container-startup-configs.json
|
path: /var/lib/docker-container-startup-configs.json
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Write docker config scripts
|
- name: Check if docker_config_scripts.yaml file exists
|
||||||
copy:
|
delegate_to: localhost
|
||||||
content: "{{ item.value.content }}"
|
become: false
|
||||||
dest: "/var/lib/docker-config-scripts/{{ item.key }}"
|
stat:
|
||||||
force: yes
|
path: "{{ tripleo_role_name + '/docker_config_scripts.yaml' }}"
|
||||||
mode: "{{ item.value.mode | default('0600', true) }}"
|
register: stat_docker_config_scripts
|
||||||
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 }}"
|
|
||||||
|
|
||||||
|
- 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
|
||||||
|
|
||||||
|
- 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}}"
|
||||||
|
|
||||||
# Here we are dumping all the docker container startup configuration data
|
# 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
|
# so that we can have access to how they are started outside of heat
|
||||||
# and docker-cmd. This lets us create command line tools to test containers.
|
# and docker-cmd. This lets us create command line tools to test containers.
|
||||||
# FIXME We need to update the defaults, e.g in docker-tool, so we can remove the
|
# FIXME We need to update the defaults e.g in docker-toool so we can remove the
|
||||||
# docker-container-startup-configs.json and use per-step configs instead
|
# docker-container-startup-configs.json and use per-step configs instead
|
||||||
- name: Set docker_config_default fact
|
- name: Set docker_config_default fact
|
||||||
no_log: True
|
no_log: True
|
||||||
set_fact:
|
set_fact:
|
||||||
docker_config_default: "{{ docker_config_default | default({}) | combine( {'step_' + item: {}} ) }}"
|
docker_config_default: "{{ docker_config_default|default({}) | combine( {'step_'+item: {}} ) }}"
|
||||||
with_sequence: count={{ deploy_steps_max }}
|
with_sequence: count={{deploy_steps_max}}
|
||||||
|
|
||||||
|
- name: Check if docker_config.yaml file exists
|
||||||
|
delegate_to: localhost
|
||||||
|
become: false
|
||||||
|
stat:
|
||||||
|
path: "{{ tripleo_role_name + '/docker_config.yaml' }}"
|
||||||
|
register: stat_docker_config
|
||||||
|
|
||||||
|
- 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
|
||||||
|
|
||||||
- name: Set docker_startup_configs_with_default fact
|
- name: Set docker_startup_configs_with_default fact
|
||||||
no_log: True
|
no_log: True
|
||||||
set_fact:
|
set_fact:
|
||||||
docker_config_with_default: "{{ docker_config_default | combine(role_data_docker_config) }}"
|
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 }}"
|
|
||||||
|
|
||||||
- name: Write docker-container-startup-configs
|
- name: Write docker-container-startup-configs
|
||||||
copy:
|
copy: content="{{docker_config_with_default | to_json }}" dest=/var/lib/docker-container-startup-configs.json force=yes mode=0600
|
||||||
content: "{{ docker_config_with_default | to_json }}"
|
|
||||||
dest: /var/lib/docker-container-startup-configs.json
|
|
||||||
force: yes
|
|
||||||
mode: '0600'
|
|
||||||
|
|
||||||
- name: Write per-step docker-container-startup-configs
|
- name: Write per-step docker-container-startup-configs
|
||||||
copy:
|
copy: content="{{item.value|to_json}}" dest="/var/lib/tripleo-config/docker-container-startup-config-{{item.key}}.json" force=yes mode=0600
|
||||||
content: "{{ item.value | to_json }}"
|
with_dict: "{{docker_config_with_default}}"
|
||||||
dest: "/var/lib/tripleo-config/docker-container-startup-config-{{ item.key }}.json"
|
|
||||||
force: yes
|
|
||||||
mode: '0600'
|
|
||||||
with_dict: "{{ docker_config_with_default }}"
|
|
||||||
|
|
||||||
- name: Create /var/lib/kolla/config_files directory
|
- name: Create /var/lib/kolla/config_files directory
|
||||||
file:
|
file: path=/var/lib/kolla/config_files state=directory setype=svirt_sandbox_file_t selevel=s0 recurse=true
|
||||||
path: /var/lib/kolla/config_files
|
|
||||||
state: directory
|
- name: Check if kolla_config.yaml file exists
|
||||||
setype: svirt_sandbox_file_t
|
delegate_to: localhost
|
||||||
selevel: s0
|
become: false
|
||||||
recurse: true
|
stat:
|
||||||
|
path: "{{ tripleo_role_name + '/kolla_config.yaml' }}"
|
||||||
|
register: stat_kolla_config
|
||||||
|
|
||||||
|
- 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
|
||||||
|
|
||||||
- name: Write kolla config json files
|
- name: Write kolla config json files
|
||||||
copy:
|
copy: content="{{item.value|to_json}}" dest="{{item.key}}" force=yes mode=0600
|
||||||
content: "{{ item.value | to_json }}"
|
with_dict: "{{role_data_kolla_config}}"
|
||||||
dest: "{{ item.key }}"
|
|
||||||
force: yes
|
|
||||||
mode: '0600'
|
|
||||||
with_dict: "{{ lookup('file', tripleo_role_name + '/kolla_config.yaml', errors='ignore') | default([], True) | from_yaml }}"
|
|
||||||
|
|
||||||
########################################################
|
########################################################
|
||||||
# Bootstrap tasks, only performed on bootstrap_server_id
|
# Bootstrap tasks, only performed on bootstrap_server_id
|
||||||
|
@ -119,19 +138,28 @@
|
||||||
|
|
||||||
- name: Clean /var/lib/docker-puppet/docker-puppet-tasks*.json files
|
- name: Clean /var/lib/docker-puppet/docker-puppet-tasks*.json files
|
||||||
file:
|
file:
|
||||||
path: "{{ item }}"
|
path: "{{item}}"
|
||||||
state: absent
|
state: absent
|
||||||
with_fileglob:
|
with_fileglob:
|
||||||
- /var/lib/docker-puppet/docker-puppet-tasks*.json
|
- /var/lib/docker-puppet/docker-puppet-tasks*.json
|
||||||
when: deploy_server_id == bootstrap_server_id
|
when: deploy_server_id == bootstrap_server_id
|
||||||
|
|
||||||
|
- name: Check if docker_puppet_tasks.yaml file exists
|
||||||
|
delegate_to: localhost
|
||||||
|
become: false
|
||||||
|
stat:
|
||||||
|
path: "{{ tripleo_role_name + '/docker_puppet_tasks.yaml' }}"
|
||||||
|
register: stat_docker_puppet_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
|
||||||
|
|
||||||
- name: Write docker-puppet-tasks json files
|
- name: Write docker-puppet-tasks json files
|
||||||
copy:
|
copy: content="{{item.value|to_json}}" dest=/var/lib/docker-puppet/docker-puppet-tasks{{item.key.replace("step_", "")}}.json force=yes mode=0600
|
||||||
content: "{{item.value|to_json}}"
|
with_dict: "{{role_data_docker_puppet_tasks}}"
|
||||||
dest: /var/lib/docker-puppet/docker-puppet-tasks{{item.key.replace("step_", "")}}.json
|
|
||||||
force: yes
|
|
||||||
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
|
when: deploy_server_id == bootstrap_server_id
|
||||||
|
|
||||||
#####################################################
|
#####################################################
|
||||||
|
@ -144,16 +172,12 @@
|
||||||
when: enable_debug|default(false)|bool
|
when: enable_debug|default(false)|bool
|
||||||
|
|
||||||
- name: Write the config_step hieradata
|
- name: Write the config_step hieradata
|
||||||
copy:
|
copy: content="{{dict(step=step|int)|to_json}}" dest=/etc/puppet/hieradata/config_step.json force=true mode=0600
|
||||||
content: "{{ dict(step=step|int) | to_json }}"
|
|
||||||
dest: /etc/puppet/hieradata/config_step.json
|
|
||||||
force: true
|
|
||||||
mode: '0600'
|
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: Run puppet host configuration for step {{step}}
|
- name: Run puppet host configuration for step {{step}}
|
||||||
command: >-
|
command: >-
|
||||||
puppet apply {{ host_puppet_config_debug | default('') }}
|
puppet apply {{ host_puppet_config_debug|default('') }}
|
||||||
--modulepath=/etc/puppet/modules:/opt/stack/puppet-modules:/usr/share/openstack-puppet/modules
|
--modulepath=/etc/puppet/modules:/opt/stack/puppet-modules:/usr/share/openstack-puppet/modules
|
||||||
--detailed-exitcodes
|
--detailed-exitcodes
|
||||||
--summarize
|
--summarize
|
||||||
|
@ -166,23 +190,21 @@
|
||||||
no_log: true
|
no_log: true
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: "Debug output for task which failed: Run puppet host configuration for step {{ step }}"
|
- name: "Debug output for task which failed: Run puppet host configuration for step {{step}}"
|
||||||
debug:
|
debug: var=outputs.stdout_lines|default([])|union(outputs.stderr_lines|default([]))
|
||||||
var: outputs.stdout_lines | default([]) | union(outputs.stderr_lines | default([]))
|
when: outputs.rc is defined
|
||||||
when:
|
|
||||||
- outputs.rc is defined
|
|
||||||
failed_when: outputs.rc not in [0, 2]
|
failed_when: outputs.rc not in [0, 2]
|
||||||
|
|
||||||
######################################
|
######################################
|
||||||
# Generate config via docker-puppet.py
|
# Generate config via docker-puppet.py
|
||||||
######################################
|
######################################
|
||||||
|
|
||||||
- name: Run docker-puppet tasks (generate config) during step {{ step }}
|
- name: Run docker-puppet tasks (generate config) during step {{step}}
|
||||||
shell: python /var/lib/docker-puppet/docker-puppet.py
|
shell: python /var/lib/docker-puppet/docker-puppet.py
|
||||||
environment:
|
environment:
|
||||||
NET_HOST: 'true'
|
NET_HOST: 'true'
|
||||||
DEBUG: '{{ docker_puppet_debug | default(false) }}'
|
DEBUG: '{{docker_puppet_debug|default(false)}}'
|
||||||
PROCESS_COUNT: '{{ docker_puppet_process_count | default(3) }}'
|
PROCESS_COUNT: '{{docker_puppet_process_count|default(3)}}'
|
||||||
when: step == "1"
|
when: step == "1"
|
||||||
changed_when: false
|
changed_when: false
|
||||||
check_mode: no
|
check_mode: no
|
||||||
|
@ -191,9 +213,8 @@
|
||||||
no_log: true
|
no_log: true
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: "Debug output for task which failed: Run docker-puppet tasks (generate config) during step {{ step }}"
|
- name: "Debug output for task which failed: Run docker-puppet tasks (generate config) during step {{step}}"
|
||||||
debug:
|
debug: var=outputs.stdout_lines|default([])|union(outputs.stderr_lines|default([]))
|
||||||
var: outputs.stdout_lines | default([]) | union(outputs.stderr_lines | default([]))
|
|
||||||
when: outputs.rc is defined
|
when: outputs.rc is defined
|
||||||
failed_when: outputs.rc != 0
|
failed_when: outputs.rc != 0
|
||||||
|
|
||||||
|
@ -204,11 +225,11 @@
|
||||||
# Note docker-puppet.py generates the hashed-*.json file, which is a copy of
|
# Note docker-puppet.py generates the hashed-*.json file, which is a copy of
|
||||||
# the *step_n.json with a hash of the generated external config added
|
# the *step_n.json with a hash of the generated external config added
|
||||||
# This acts as a salt to enable restarting the container if config changes
|
# This acts as a salt to enable restarting the container if config changes
|
||||||
- name: Start containers for step {{ step }}
|
- name: Start containers for step {{step}}
|
||||||
command: >-
|
command: >-
|
||||||
paunch --debug apply
|
paunch --debug apply
|
||||||
--file /var/lib/tripleo-config/hashed-docker-container-startup-config-step_{{ step }}.json
|
--file /var/lib/tripleo-config/hashed-docker-container-startup-config-step_{{step}}.json
|
||||||
--config-id tripleo_step{{ step }} --managed-by tripleo-{{ tripleo_role_name }}
|
--config-id tripleo_step{{step}} --managed-by tripleo-{{tripleo_role_name}}
|
||||||
changed_when: false
|
changed_when: false
|
||||||
check_mode: no
|
check_mode: no
|
||||||
register: outputs
|
register: outputs
|
||||||
|
@ -216,9 +237,8 @@
|
||||||
no_log: true
|
no_log: true
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: "Debug output for task which failed: Start containers for step {{ step }}"
|
- name: "Debug output for task which failed: Start containers for step {{step}}"
|
||||||
debug:
|
debug: var=outputs.stdout_lines|default([])|union(outputs.stderr_lines|default([]))
|
||||||
var: outputs.stdout_lines | default([]) | union(outputs.stderr_lines | default([]))
|
|
||||||
when: outputs.rc is defined
|
when: outputs.rc is defined
|
||||||
failed_when: outputs.rc != 0
|
failed_when: outputs.rc != 0
|
||||||
|
|
||||||
|
@ -226,22 +246,20 @@
|
||||||
# Bootstrap tasks, only performed on bootstrap_server_id
|
# Bootstrap tasks, only performed on bootstrap_server_id
|
||||||
########################################################
|
########################################################
|
||||||
|
|
||||||
- name: Check if /var/lib/docker-puppet/docker-puppet-tasks{{ step }}.json exists
|
- name: Check if /var/lib/docker-puppet/docker-puppet-tasks{{step}}.json exists
|
||||||
stat:
|
stat:
|
||||||
path: /var/lib/docker-puppet/docker-puppet-tasks{{ step }}.json
|
path: /var/lib/docker-puppet/docker-puppet-tasks{{step}}.json
|
||||||
register: docker_puppet_tasks_json
|
register: docker_puppet_tasks_json
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: Run docker-puppet tasks (bootstrap tasks) for step {{ step }}
|
- name: Run docker-puppet tasks (bootstrap tasks) for step {{step}}
|
||||||
shell: python /var/lib/docker-puppet/docker-puppet.py
|
shell: python /var/lib/docker-puppet/docker-puppet.py
|
||||||
environment:
|
environment:
|
||||||
CONFIG: /var/lib/docker-puppet/docker-puppet-tasks{{ step }}.json
|
CONFIG: /var/lib/docker-puppet/docker-puppet-tasks{{step}}.json
|
||||||
NET_HOST: "true"
|
NET_HOST: "true"
|
||||||
NO_ARCHIVE: "true"
|
NO_ARCHIVE: "true"
|
||||||
STEP: "{{ step }}"
|
STEP: "{{step}}"
|
||||||
when:
|
when: deploy_server_id == bootstrap_server_id and docker_puppet_tasks_json.stat.exists
|
||||||
- deploy_server_id == bootstrap_server_id
|
|
||||||
- docker_puppet_tasks_json.stat.exists
|
|
||||||
changed_when: false
|
changed_when: false
|
||||||
check_mode: no
|
check_mode: no
|
||||||
register: outputs
|
register: outputs
|
||||||
|
@ -249,9 +267,8 @@
|
||||||
no_log: true
|
no_log: true
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: "Debug output for task which failed: Run docker-puppet tasks (bootstrap tasks) for step {{ step }}"
|
- name: "Debug output for task which failed: Run docker-puppet tasks (bootstrap tasks) for step {{step}}"
|
||||||
debug:
|
debug: var=outputs.stdout_lines|default([])|union(outputs.stderr_lines|default([]))
|
||||||
var: outputs.stdout_lines | default([]) | union(outputs.stderr_lines | default([]))
|
|
||||||
when: outputs.rc is defined
|
when: outputs.rc is defined
|
||||||
failed_when: outputs.rc != 0
|
failed_when: outputs.rc != 0
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue