Fixed ability of usage interfaces/bridges with dots (aliases)

Without quoting network interface, dot in it's name caused json_query
to fail with JMESPathError, as dot was interpreted as a key in dict.

Change-Id: I1702567325f7b4f973cb6fcfc35ccae54d7aa5fa
This commit is contained in:
Dmitriy Rabotjagov 2018-10-18 15:08:26 +03:00
parent b0f4e2cf85
commit 9f6bf94d1a

View File

@ -19,7 +19,7 @@
query: "{{ is_metal | ternary(metal_query, non_metal_query) }}"
non_metal_query: "container_networks.{{ network_address }}.address || ansible_host"
find_bridge: "container_networks.{{ network_address }}.bridge"
metal_query: "ansible_{{ hostvars[inventory_hostname]|json_query(find_bridge) | replace('-','_') }}.ipv4.address || {{ non_metal_query }}"
metal_query: "'ansible_{{ hostvars[inventory_hostname] | json_query(find_bridge) | replace('-','_') }}'.ipv4.address || {{ non_metal_query }}"
tags:
- common-address
- always