Merge "Force "Pre-cache" tasks to run in dry run"

This commit is contained in:
Zuul 2019-08-09 17:10:32 +00:00 committed by Gerrit Code Review
commit 52f6cee42f

View File

@ -424,58 +424,51 @@
#########################################
# Pre-cache facts for container-puppet.py
#########################################
- name: Create puppet caching structures
file:
path: /var/lib/container-puppet/puppetlabs
state: directory
setype: svirt_sandbox_file_t
selevel: s0
recurse: True
tags:
- container_config
- container_config_tasks
- name: Write facter cache config
copy:
dest: /var/lib/container-puppet/puppetlabs/facter.conf
content: |
facts : {
ttls: [
{ "kernel" : 8 hour },
{ "memory" : 8 hour },
{ "networking" : 8 hour },
{ "operating system" : 8 hour },
{ "processor" : 8 hour },
]
}
setype: svirt_sandbox_file_t
selevel: s0
tags:
- container_config
- container_config_tasks
- name: Cleanup facter cache if exists
file:
path: /opt/puppetlabs/facter
state: absent
ignore_errors: True
tags:
- container_config
- container_config_tasks
- name: Pre-cache facts
command: facter --config /var/lib/container-puppet/puppetlabs/facter.conf
no_log: True
ignore_errors: True
tags:
- container_config
- container_config_tasks
- name: Sync cached facts
synchronize:
src: /opt/puppetlabs/
dest: /var/lib/container-puppet/puppetlabs/
delegate_to: "{{ inventory_hostname }}"
# We don't want the pre-cache tasks to be skipped in dry-run so we force
# check_mode to "no".
# https://bugzilla.redhat.com/show_bug.cgi?id=1738529
- name: Pre-cache facts for container-puppet.py
check_mode: no
tags:
- container_config
- container_config_tasks
block:
- name: Create puppet caching structures
file:
path: /var/lib/container-puppet/puppetlabs
state: directory
setype: svirt_sandbox_file_t
selevel: s0
recurse: True
- name: Write facter cache config
copy:
dest: /var/lib/container-puppet/puppetlabs/facter.conf
content: |
facts : {
ttls: [
{ "kernel" : 8 hour },
{ "memory" : 8 hour },
{ "networking" : 8 hour },
{ "operating system" : 8 hour },
{ "processor" : 8 hour },
]
}
setype: svirt_sandbox_file_t
selevel: s0
- name: Cleanup facter cache if exists
file:
path: /opt/puppetlabs/facter
state: absent
ignore_errors: True
- name: Pre-cache facts
command: facter --config /var/lib/container-puppet/puppetlabs/facter.conf
no_log: True
ignore_errors: True
- name: Sync cached facts
synchronize:
src: /opt/puppetlabs/
dest: /var/lib/container-puppet/puppetlabs/
delegate_to: "{{ inventory_hostname }}"
######################################
# Generate config via container-puppet.py