Add nodepool.host_id variable to inventory file

We recently exposed node.host_id in zookeeper from nodepool. Also
include it into the inventory file so jobs can access it.

Change-Id: Ic90af15dd86555aca2ce09120715b0aeb8af8516
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2018-12-07 09:03:55 -05:00
parent ced4584c43
commit 0d31dba6cb
5 changed files with 9 additions and 0 deletions

View File

@ -0,0 +1,5 @@
---
features:
- |
The Ansible inventory file now includes nodepool.host_id variable if the
node was launched using the OpenStack Nodepool driver.

View File

@ -1835,6 +1835,7 @@ class FakeNodepool(object):
region='test-region',
az='test-az',
attributes=self.attributes,
host_id='test-host-id',
interface_ip=remote_ip,
public_ipv4=remote_ip,
private_ipv4=None,

View File

@ -5,6 +5,7 @@
that:
- nodepool.az == 'test-az'
- nodepool.cloud == 'test-cloud'
- nodepool.host_id == 'test-host-id'
- nodepool.region == 'test-region'
- nodepool.provider == 'test-provider'

View File

@ -1227,6 +1227,7 @@ class AnsibleJob(object):
cloud=node.get('cloud'),
provider=node.get('provider'),
region=node.get('region'),
host_id=node.get('host_id'),
interface_ip=node.get('interface_ip'),
public_ipv4=node.get('public_ipv4'),
private_ipv4=node.get('private_ipv4'),

View File

@ -517,6 +517,7 @@ class Node(ConfigObject):
# Attributes from Nodepool
self._state = 'unknown'
self.state_time = time.time()
self.host_id = None
self.interface_ip = None
self.public_ipv4 = None
self.private_ipv4 = None