Handle offline hosts in LE role

If a host is offline, Ansible will not have set the required txt
keys host variable for that host.  When the task to update the
dns master with new txt records runs, it will fail due to an
undefined variable:

  'ansible.vars.hostvars.HostVarsVars object' has no attribute 'acme_txt_required'

This supplies a default value so that in that case, the task may
proceed and other hosts will have their LE certs serviced.

Change-Id: I62efbe086d801d803b2f2c3223ece8f608c668a1
This commit is contained in:
James E. Blair 2020-01-08 10:21:53 -08:00
parent 9fead30442
commit 2c03fb1e98
1 changed files with 1 additions and 1 deletions

View File

@ -4,7 +4,7 @@
- name: Build key list
set_fact:
acme_txt_keys: '{{ acme_txt_keys }} + {{ hostvars[item]["acme_txt_required"] }}'
acme_txt_keys: '{{ acme_txt_keys }} + {{ hostvars[item]["acme_txt_required"] | default([]) }}'
with_inventory_hostnames:
- letsencrypt:!disabled