8fb3a0b889
Switch container puppet tasks to use the module for management rather than the tripleo_container_manage role which has a bunch of unrelated tasks. Change-Id: I4398322a02f6f899ea226b60336da83fc841812f Depends-On: https://review.opendev.org/c/openstack/tripleo-ansible/+/796884
55 lines
2.0 KiB
YAML
55 lines
2.0 KiB
YAML
- name: Block for container-puppet tasks (generate config) during step {{ step }} with tripleo-ansible
|
|
become: true
|
|
tags:
|
|
- container_config
|
|
block:
|
|
- name: Create base directory puppet configs
|
|
file:
|
|
path: "/var/lib/tripleo-config/container-puppet-config"
|
|
mode: 0700
|
|
recurse: true
|
|
setype: container_file_t
|
|
|
|
- name: "Generate container puppet configs for step {{ step }}"
|
|
container_puppet_config:
|
|
check_mode: '{{ ansible_check_mode | bool | ternary(1, 0) }}'
|
|
config_vol_prefix: "/var/lib/config-data{{ ansible_check_mode | bool | ternary('/check-mode', '') }}"
|
|
debug: "{{ docker_puppet_debug | bool }}"
|
|
net_host: true
|
|
no_archive: false
|
|
puppet_config: "/var/lib/container-puppet/{{ ansible_check_mode | bool | ternary('check-mode/', '') }}container-puppet.json"
|
|
short_hostname: "{{ ansible_facts['hostname'] | lower }}"
|
|
step: "{{ step }}"
|
|
|
|
- name: "Manage Puppet containers (generate config) for step {{ step }}"
|
|
tripleo_container_manage:
|
|
config_id: "tripleo_puppet_step{{ step }}"
|
|
config_dir: "/var/lib/tripleo-config/container-puppet-config/step_{{ step }}"
|
|
config_patterns: "container-puppet-*.json"
|
|
concurrency: "{{ docker_puppet_process_count }}"
|
|
|
|
- name: Diff puppet-generated changes for check mode
|
|
become: true
|
|
shell: |
|
|
diff -ruN --no-dereference -q /var/lib/config-data/puppet-generated /var/lib/config-data/check-mode/puppet-generated
|
|
diff -ruN --no-dereference /var/lib/config-data/puppet-generated /var/lib/config-data/check-mode/puppet-generated
|
|
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 puppet-generated 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
|