From 987f3be41d6ba6290e43284031973620be68947d Mon Sep 17 00:00:00 2001 From: Will Szumski Date: Wed, 15 Feb 2023 14:32:43 +0000 Subject: [PATCH] Fix default when ANSIBLE_SERIAL not set You will see: ``` ERROR! Unexpected Exception, this is probably a bug: invalid literal for int() with base 10: '' ``` This is because the default filter only works on undefined variables and the lookup returns an empty string. We can use the boolean parameter on the default filter, see: https://jinja.palletsprojects.com/en/3.1.x/templates/#jinja-filters.default --- etc/kayobe/ansible/reboot.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/kayobe/ansible/reboot.yml b/etc/kayobe/ansible/reboot.yml index af01e5944..a284dd425 100644 --- a/etc/kayobe/ansible/reboot.yml +++ b/etc/kayobe/ansible/reboot.yml @@ -1,7 +1,7 @@ --- - name: Reboot the host hosts: seed-hypervisor:seed:overcloud:infra-vms - serial: "{{ lookup('env', 'ANSIBLE_SERIAL') | default(0) }}" + serial: "{{ lookup('env', 'ANSIBLE_SERIAL') | default(0, true) }}" tags: - reboot tasks: