Allow inventories with no "properties"

Without this patch, inventories with hosts without the field
"properties" cannot be used. Currently, the group variable
resolution will fail when parsing properties.is_metal, as
properties wouldn't be defined.

This is a problem, because it forces deployers with an external
inventory to add a useless "properties" field for them.

This patch solves the problem by simplifying the conditions,
making them valid if the deployer has defined is_metal in its
inventory or not.

Change-Id: Ic09b455016dd3d4f7945900d13d37fdc86f80134
This commit is contained in:
Jean-Philippe Evrard 2018-07-05 11:57:36 +02:00
parent e7b3654051
commit 1e4121f5a4
3 changed files with 6 additions and 3 deletions

View File

@ -127,4 +127,7 @@ ansible_ssh_extra_args: >
-T
# Toggle whether the service is deployed in a container or not
is_metal: "{{ properties.is_metal | default(false) }}"
is_metal: >-
{{ (properties is defined) and
(properties.is_metal is defined) and
(properties.is_metal | bool) }}

View File

@ -25,7 +25,7 @@ galera_container_bind_mounts:
# Disable PrivateDevices for MariaDB on CentOS 7
# See https://bugs.launchpad.net/openstack-ansible/+bug/1697531 for details.
galera_disable_privatedevices: "{{ ((properties.is_metal | default(false)) | bool) | ternary('false', 'true') }}"
galera_disable_privatedevices: "{{ not is_metal }}"
# By default galera_monitoring xinetd app is open to 0.0.0.0/0
# This makes sure the monitoring is only restricted to the necessary nodes:

View File

@ -20,4 +20,4 @@ memcached_package_state: "{{ package_state }}"
# Disable PrivateDevices for MemcacheD on CentOS 7
# See https://bugs.launchpad.net/openstack-ansible/+bug/1697531 for details.
memcached_disable_privatedevices: "{{ ((properties.is_metal | default(false)) | bool) | ternary('false', 'true') }}"
memcached_disable_privatedevices: "{{ not is_metal }}"