tripleo-heat-templates/common/generate-config-tasks.yaml
Emilien Macchi 5864167034 Remove /var/lib/config-data context task
The task should not be needed since we set the context in
openstack-selinux:

https://github.com/redhat-openstack/openstack-selinux/blob/master/local_settings.sh.in#L89
fcontext -N -$1 -t container_file_t \"$LOCALSTATEDIR/lib/config-data(/.*)?\"

This task is very expensive at scale and we should avoid these king of
things.

svirt_sandbox_file_t is an alias to container_file_t, so let's use
container_file_t directly to be consistent and not creating confusion.

This patch shouldn't be backported to Train because in Train we'll have
this task not removed but moved to run only under FFU context.

Change-Id: I973a49aec1a263e2a1ec3e5199803c86d6f77b35
Closes-Bug: #1887721
2020-07-20 09:26:03 -04:00

64 lines
2.6 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_hostname | lower }}"
step: "{{ step }}"
- name: "Manage Puppet containers (generate config) for step {{ step }} with tripleo-ansible"
include_role:
name: tripleo_container_manage
vars:
tripleo_container_manage_concurrency: "{{ docker_puppet_process_count }}"
tripleo_container_manage_systemd_order: false
tripleo_container_manage_systemd_teardown: false
tripleo_container_manage_config: "/var/lib/tripleo-config/container-puppet-config/step_{{ step }}"
tripleo_container_manage_config_patterns: 'container-puppet-*.json'
tripleo_container_manage_config_id: "tripleo_puppet_step{{ step }}"
tripleo_container_manage_debug: "{{ docker_puppet_debug | bool }}"
# puppet with --detailed-exitcodes will return 0 for success and
# no changes and 2 for success and resource changes. Other
# numbers are failures
tripleo_container_manage_valid_exit_code: [0, 2]
- 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