3e9df9576b
And move it into its own play called 'Overcloud container setup tasks' This set of tasks covers creating kolla files and container-startup-config files. It makes more sense to split them out of the deployment steps as they need to be run before any deployment step task and this makes it more explicit. This change is needed in order to support a new upcoming set of tasks pre_deployment_setup_tasks that can spawn containers even before any deployment tasks or external deployment task. Change-Id: Idf004f7a13544dfc1a8a6da033debd1a4f8b96e7
197 lines
5.1 KiB
YAML
197 lines
5.1 KiB
YAML
- name: Delete existing /var/lib/tripleo-config/check-mode directory for check mode
|
|
become: true
|
|
file:
|
|
path: /var/lib/tripleo-config/check-mode
|
|
state: absent
|
|
tags:
|
|
- host_config
|
|
- container_config
|
|
- container_config_tasks
|
|
- container_config_scripts
|
|
- container_startup_configs
|
|
when:
|
|
- ansible_check_mode|bool
|
|
check_mode: no
|
|
|
|
- name: Create /var/lib/tripleo-config/check-mode directory for check mode
|
|
become: true
|
|
file:
|
|
path: /var/lib/tripleo-config/check-mode
|
|
state: directory
|
|
setype: container_file_t
|
|
selevel: s0
|
|
recurse: true
|
|
tags:
|
|
- host_config
|
|
- container_config
|
|
- container_config_tasks
|
|
- container_config_scripts
|
|
- container_startup_configs
|
|
when:
|
|
- ansible_check_mode|bool
|
|
check_mode: no
|
|
|
|
# Puppet manifest for baremetal host configuration
|
|
- name: Write the puppet step_config manifest
|
|
become: true
|
|
no_log: True
|
|
copy:
|
|
content: "{{ lookup('file', tripleo_role_name + '/step_config.pp', errors='ignore') | default('', True) }}"
|
|
dest: /var/lib/tripleo-config/{{ ansible_check_mode | bool | ternary('check-mode/', '') }}puppet_step_config.pp
|
|
force: yes
|
|
mode: '0600'
|
|
tags:
|
|
- host_config
|
|
check_mode: no
|
|
diff: no
|
|
|
|
- name: Diff puppet step_config manifest changes for check mode
|
|
command:
|
|
diff -uN /var/lib/tripleo-config/puppet_step_config.pp /var/lib/tripleo-config/check-mode/puppet_step_config.pp
|
|
register: diff_results
|
|
tags:
|
|
- host_config
|
|
check_mode: no
|
|
when:
|
|
- ansible_check_mode|bool
|
|
- ansible_diff_mode
|
|
failed_when: false
|
|
changed_when: diff_results.rc == 1
|
|
|
|
- name: Diff puppet step_config manifest changes for check mode
|
|
debug:
|
|
var: diff_results.stdout_lines
|
|
changed_when: diff_results.rc == 1
|
|
when:
|
|
- ansible_check_mode|bool
|
|
- ansible_diff_mode
|
|
tags:
|
|
- host_config
|
|
|
|
# Puppet Containers Config directory used to generate container configs
|
|
- name: Create /var/lib/container-puppet
|
|
become: true
|
|
file:
|
|
path: /var/lib/container-puppet
|
|
state: directory
|
|
setype: container_file_t
|
|
selevel: s0
|
|
tags:
|
|
- container_config
|
|
- container_config_tasks
|
|
|
|
- name: Delete existing /var/lib/container-puppet/check-mode for check mode
|
|
become: true
|
|
file:
|
|
path: /var/lib/container-puppet/check-mode
|
|
state: absent
|
|
tags:
|
|
- container_config
|
|
check_mode: no
|
|
when:
|
|
- ansible_check_mode|bool
|
|
|
|
- name: Create /var/lib/container-puppet/check-mode for check mode
|
|
become: true
|
|
file:
|
|
path: /var/lib/container-puppet/check-mode
|
|
state: directory
|
|
setype: container_file_t
|
|
selevel: s0
|
|
tags:
|
|
- container_config
|
|
check_mode: no
|
|
when:
|
|
- ansible_check_mode|bool
|
|
|
|
- name: Write container-puppet.json file
|
|
become: true
|
|
no_log: True
|
|
copy:
|
|
content: "{{ lookup('file', tripleo_role_name + '/puppet_config.yaml', errors='ignore') | default([], True) | from_yaml | to_nice_json }}"
|
|
dest: /var/lib/container-puppet/{{ ansible_check_mode | bool | ternary('check-mode/', '') }}container-puppet.json
|
|
force: yes
|
|
mode: '0600'
|
|
tags:
|
|
- container_config
|
|
check_mode: no
|
|
diff: no
|
|
|
|
- name: Diff container-puppet.json changes for check mode
|
|
command:
|
|
diff -uN /var/lib/container-puppet/container-puppet.json /var/lib/container-puppet/check-mode/container-puppet.json
|
|
register: diff_results
|
|
tags:
|
|
- container_config
|
|
check_mode: no
|
|
when:
|
|
- ansible_check_mode|bool
|
|
- ansible_diff_mode
|
|
failed_when: false
|
|
changed_when: diff_results.rc == 1
|
|
|
|
- name: Diff container-puppet.json changes for check mode
|
|
debug:
|
|
var: diff_results.stdout_lines
|
|
changed_when: diff_results.rc == 1
|
|
when:
|
|
- ansible_check_mode|bool
|
|
- ansible_diff_mode
|
|
tags:
|
|
- container_config
|
|
|
|
- name: Ensure config hashes are up-to-date for container startup configs
|
|
become: true
|
|
container_puppet_config:
|
|
update_config_hash_only: true
|
|
tags:
|
|
- container_startup_configs
|
|
|
|
- name: Set host puppet debugging fact string
|
|
set_fact:
|
|
host_puppet_config_debug: "--debug --verbose"
|
|
when:
|
|
- enable_puppet | bool
|
|
- enable_debug | bool
|
|
tags:
|
|
- host_config
|
|
|
|
- name: Check for /etc/puppet/check-mode directory for check mode
|
|
stat:
|
|
path: /etc/puppet/check-mode
|
|
register: check_mode_dir
|
|
when: ansible_check_mode|bool
|
|
tags:
|
|
- host_config
|
|
- container_config
|
|
|
|
- name: Create /etc/puppet/check-mode/hieradata directory for check mode
|
|
become: true
|
|
file:
|
|
path: /etc/puppet/check-mode/hieradata
|
|
state: directory
|
|
setype: container_file_t
|
|
selevel: s0
|
|
recurse: true
|
|
check_mode: no
|
|
when:
|
|
- ansible_check_mode|bool
|
|
- not check_mode_dir.stat.exists
|
|
tags:
|
|
- host_config
|
|
- container_config
|
|
|
|
- name: Create puppet check-mode files if they don't exist for check mode
|
|
become: true
|
|
shell: |
|
|
cp -a /etc/puppet/hiera.yaml /etc/puppet/check-mode/hiera.yaml
|
|
cp -a /etc/puppet/hieradata/* /etc/puppet/check-mode/hieradata/
|
|
sed -i 's/\/etc\/puppet\/hieradata/\/etc\/puppet\/check-mode\/hieradata/' /etc/puppet/check-mode/hiera.yaml
|
|
when:
|
|
- ansible_check_mode|bool
|
|
- not check_mode_dir.stat.exists
|
|
check_mode: no
|
|
tags:
|
|
- host_config
|
|
- container_config
|