From b742bfc911f86983460acc459d3abcd4d98903e0 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Mon, 1 Jul 2019 13:06:57 +1000 Subject: [PATCH] letsencrypt-install-txt-record: skip disabled hosts We are seeing: fatal: [adns1.opendev.org]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'acme_txt_required' I belive this is because we have a disabled mirror host now. So the iad.rx.opendev.org mirror is in the "letsencrypt" group, but because it is also disabled the prior role (letsencrypt-request-certs) has not run and it has not populated it's "acme_txt_required" variable. We should skip disabled hosts when inspecting the hosts for this variable. Add this to the "with_inventory_hostnames" match. Change-Id: I33a1c8b6f7e8499248e370f69a9f573a2bf106a5 --- playbooks/roles/letsencrypt-install-txt-record/tasks/main.yaml | 3 ++- 1 file changed, 2 insertions(+), 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 db77d5dd8d..fb3d514abe 100644 --- a/playbooks/roles/letsencrypt-install-txt-record/tasks/main.yaml +++ b/playbooks/roles/letsencrypt-install-txt-record/tasks/main.yaml @@ -5,7 +5,8 @@ - name: Build key list set_fact: acme_txt_keys: '{{ acme_txt_keys }} + {{ hostvars[item]["acme_txt_required"] }}' - with_inventory_hostnames: letsencrypt + with_inventory_hostnames: + - letsencrypt:!disabled - name: Final list debug: