Improve facter cache reliability

We don't need to be caching EC2 metadata in our facter runs because we
don't use this. By leaving this on, it can cause problems when run on
VMs in a cloud that might support EC2.  By having this enabled, we can
see deployments failing to configure nodes because it timesout:

2020-05-13 22:38:30.574339 ERROR puppetlabs.facter - EC2 user data
request failed: Timeout was reached

Additionally if facter fails to generate the cache, the subsequent
puppet runs will fail. This change also added retries to the facter
cache call to ensure that we should be able to generate the cache if an
external fact call fails for some reason.

Change-Id: Iaaed0dcf747ca4a08f8e200b43d0f2259ad0ed39
This commit is contained in:
Alex Schultz 2020-05-13 16:52:31 -06:00
parent ed86542418
commit c3b57d6a6c
3 changed files with 6 additions and 3 deletions

View File

@ -21,6 +21,7 @@
tripleo_puppet_cache_base_dir: /var/lib/container-puppet/puppetlabs
tripleo_puppet_cache_config: |
facts : {
blocklist: [ "EC2" ],
ttls: [
{ "kernel" : 8 hour },
{ "memory" : 8 hour },

View File

@ -19,7 +19,7 @@
hosts: all
vars:
required_packages:
- puppet
- facter
- rsync
roles:
- role: test_deps

View File

@ -80,13 +80,15 @@
become: true
check_mode: false
shell: facter --config "{{ tripleo_puppet_cache_base_dir }}/facter.conf"
retries: 5
delay: 5
no_log: true
failed_when: false
register: _facter_cache_run
- name: Facter error output when failed
- name: Failed deployment if facter fails
check_mode: false
debug:
fail:
msg: "{{ _facter_cache_run.stderr }}"
when: _facter_cache_run.rc != 0