From e410759e8d948f6d5b48e07bcc9c174a41692cc8 Mon Sep 17 00:00:00 2001 From: Weezer Su Date: Thu, 26 Jan 2017 10:20:16 -0600 Subject: [PATCH] Change the dpkg -l to dpkg-query -s The dpkg -l python will give 0 as result, because the python has un (not-installed)status on xenial, switch to dpkg-query will give the right status code(1) if the package is not installed. Change-Id: I7faf1d922bdf0673d5daeec6fb2538f1786cbcd1 --- playbooks/openstack-hosts-setup.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/playbooks/openstack-hosts-setup.yml b/playbooks/openstack-hosts-setup.yml index ef21b28418..23201daafb 100644 --- a/playbooks/openstack-hosts-setup.yml +++ b/playbooks/openstack-hosts-setup.yml @@ -36,7 +36,7 @@ exit $result; ;; ubuntu) - dpkg -l python + dpkg-query -s python $> /dev/null result=$? if [ $result -eq 1 ]; then @@ -48,6 +48,7 @@ ;; esac changed_when: "result.rc == 2" + failed_when: "{{ result.rc not in [0, 2] }}" - name: Basic host setup hosts: "{{ openstack_host_group|default('hosts') }}"