Include 'tripleo_role_name' in the inventory

"role_name" is internal to Ansible, we should not use it.
As a transition, include "tripleo_role_name" in the inventory and once
we're ready we'll remove our usage of "role_name", in a future patch.

Related-Bug: #1771171
Change-Id: I57c4eac87e2f96dfe5490b111cd2508505715d56
(cherry picked from commit 9ce1c07525)
This commit is contained in:
Emilien Macchi 2018-05-14 11:02:05 -07:00
parent 18324fb412
commit f3970c2db0
2 changed files with 21 additions and 9 deletions

View File

@ -242,7 +242,10 @@ class TripleoInventory(object):
'ansible_ssh_user': self.ansible_ssh_user, 'ansible_ssh_user': self.ansible_ssh_user,
'bootstrap_server_id': role_node_id_map.get( 'bootstrap_server_id': role_node_id_map.get(
'bootstrap_server_id'), 'bootstrap_server_id'),
# Keep "role_name" until we get rid of it
# https://bugs.launchpad.net/tripleo/+bug/1771171
'role_name': role, 'role_name': role,
'tripleo_role_name': role,
} }
} }

View File

@ -192,17 +192,20 @@ class TestInventory(base.TestCase):
'hosts': ['cp-0'], 'hosts': ['cp-0'],
'vars': {'ansible_ssh_user': ansible_ssh_user, 'vars': {'ansible_ssh_user': ansible_ssh_user,
'bootstrap_server_id': 'a', 'bootstrap_server_id': 'a',
'role_name': 'Compute'}}, 'role_name': 'Compute',
'tripleo_role_name': 'Compute'}},
'Controller': { 'Controller': {
'hosts': ['c-0', 'c-1', 'c-2'], 'hosts': ['c-0', 'c-1', 'c-2'],
'vars': {'ansible_ssh_user': ansible_ssh_user, 'vars': {'ansible_ssh_user': ansible_ssh_user,
'bootstrap_server_id': 'a', 'bootstrap_server_id': 'a',
'role_name': 'Controller'}}, 'role_name': 'Controller',
'tripleo_role_name': 'Controller'}},
'CustomRole': { 'CustomRole': {
'hosts': ['cs-0'], 'hosts': ['cs-0'],
'vars': {'ansible_ssh_user': ansible_ssh_user, 'vars': {'ansible_ssh_user': ansible_ssh_user,
'bootstrap_server_id': 'a', 'bootstrap_server_id': 'a',
'role_name': 'CustomRole'}}, 'role_name': 'CustomRole',
'tripleo_role_name': 'CustomRole'}},
'overcloud': { 'overcloud': {
'children': ['Compute', 'Controller', 'CustomRole'], 'children': ['Compute', 'Controller', 'CustomRole'],
@ -262,17 +265,20 @@ class TestInventory(base.TestCase):
'hosts': ['cp-0'], 'hosts': ['cp-0'],
'vars': {'ansible_ssh_user': ansible_ssh_user, 'vars': {'ansible_ssh_user': ansible_ssh_user,
'bootstrap_server_id': 'a', 'bootstrap_server_id': 'a',
'role_name': 'Compute'}}, 'role_name': 'Compute',
'tripleo_role_name': 'Compute'}},
'Controller': { 'Controller': {
'hosts': ['c-0', 'c-1', 'c-2'], 'hosts': ['c-0', 'c-1', 'c-2'],
'vars': {'ansible_ssh_user': ansible_ssh_user, 'vars': {'ansible_ssh_user': ansible_ssh_user,
'bootstrap_server_id': 'a', 'bootstrap_server_id': 'a',
'role_name': 'Controller'}}, 'role_name': 'Controller',
'tripleo_role_name': 'Controller'}},
'CustomRole': { 'CustomRole': {
'hosts': ['cs-0'], 'hosts': ['cs-0'],
'vars': {'ansible_ssh_user': ansible_ssh_user, 'vars': {'ansible_ssh_user': ansible_ssh_user,
'bootstrap_server_id': 'a', 'bootstrap_server_id': 'a',
'role_name': 'CustomRole'}}, 'role_name': 'CustomRole',
'tripleo_role_name': 'CustomRole'}},
'overcloud': { 'overcloud': {
'children': ['Compute', 'Controller', 'CustomRole'], 'children': ['Compute', 'Controller', 'CustomRole'],
'vars': { 'vars': {
@ -328,7 +334,8 @@ class TestInventory(base.TestCase):
'enabled_networks': ['ctlplane']}}, 'enabled_networks': ['ctlplane']}},
'vars': {'ansible_ssh_user': ansible_ssh_user, 'vars': {'ansible_ssh_user': ansible_ssh_user,
'bootstrap_server_id': 'a', 'bootstrap_server_id': 'a',
'role_name': 'Compute'}}, 'role_name': 'Compute',
'tripleo_role_name': 'Compute'}},
'Controller': { 'Controller': {
'hosts': { 'hosts': {
'c-0': { 'c-0': {
@ -348,7 +355,8 @@ class TestInventory(base.TestCase):
'enabled_networks': ['ctlplane']}}, 'enabled_networks': ['ctlplane']}},
'vars': {'ansible_ssh_user': ansible_ssh_user, 'vars': {'ansible_ssh_user': ansible_ssh_user,
'bootstrap_server_id': 'a', 'bootstrap_server_id': 'a',
'role_name': 'Controller'}}, 'role_name': 'Controller',
'tripleo_role_name': 'Controller'}},
'CustomRole': { 'CustomRole': {
'hosts': { 'hosts': {
'cs-0': { 'cs-0': {
@ -358,7 +366,8 @@ class TestInventory(base.TestCase):
'enabled_networks': ['ctlplane']}}, 'enabled_networks': ['ctlplane']}},
'vars': {'ansible_ssh_user': ansible_ssh_user, 'vars': {'ansible_ssh_user': ansible_ssh_user,
'bootstrap_server_id': 'a', 'bootstrap_server_id': 'a',
'role_name': 'CustomRole'}}, 'role_name': 'CustomRole',
'tripleo_role_name': 'CustomRole'}},
'overcloud': {'children': {'Compute': {}, 'overcloud': {'children': {'Compute': {},
'Controller': {}, 'Controller': {},
'CustomRole': {}}, 'CustomRole': {}},