From 2c03fb1e980c5746cfc3b03138d153ccc73b6bd1 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Wed, 8 Jan 2020 10:21:53 -0800 Subject: [PATCH] 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 --- playbooks/roles/letsencrypt-install-txt-record/tasks/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playbooks/roles/letsencrypt-install-txt-record/tasks/main.yaml b/playbooks/roles/letsencrypt-install-txt-record/tasks/main.yaml index fb3d514abe..c626b5af2a 100644 --- a/playbooks/roles/letsencrypt-install-txt-record/tasks/main.yaml +++ b/playbooks/roles/letsencrypt-install-txt-record/tasks/main.yaml @@ -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