Add serial option in the inventory

Add serial option in the inventory in order to be able
to set serial value per roles by the user if needed.

Default will still remain the same: 1

Change-Id: I6605aec1d42a714f2f2c72b9233bc3bf510177de
This commit is contained in:
Mathieu Bultel 2019-02-08 16:18:29 +01:00
parent 2c3f7533f6
commit 8852437732
2 changed files with 12 additions and 1 deletions

View File

@ -93,7 +93,7 @@ class TripleoInventory(object):
cacert=None, username=None, ansible_ssh_user=None,
host_network=None, ansible_python_interpreter=None,
undercloud_connection=UNDERCLOUD_CONNECTION_LOCAL,
undercloud_key_file=None):
undercloud_key_file=None, serial=1):
self.session = session
self.hclient = hclient
self.hosts_format_dict = False
@ -109,6 +109,7 @@ class TripleoInventory(object):
self.stack_outputs = StackOutputs(self.plan_name, self.hclient)
self.hostvars = {}
self.undercloud_connection = undercloud_connection
self.serial = serial
@staticmethod
def get_roles_by_service(enabled_services):
@ -256,6 +257,7 @@ class TripleoInventory(object):
'bootstrap_server_id': role_node_id_map.get(
'bootstrap_server_id'),
'tripleo_role_name': role,
'serial': self.serial,
}
}

View File

@ -181,16 +181,19 @@ class TestInventory(base.TestCase):
'hosts': ['cp-0'],
'vars': {'ansible_ssh_user': ansible_ssh_user,
'bootstrap_server_id': 'a',
'serial': 1,
'tripleo_role_name': 'Compute'}},
'Controller': {
'hosts': ['c-0', 'c-1', 'c-2'],
'vars': {'ansible_ssh_user': ansible_ssh_user,
'bootstrap_server_id': 'a',
'serial': 1,
'tripleo_role_name': 'Controller'}},
'CustomRole': {
'hosts': ['cs-0'],
'vars': {'ansible_ssh_user': ansible_ssh_user,
'bootstrap_server_id': 'a',
'serial': 1,
'tripleo_role_name': 'CustomRole'}},
'overcloud': {
@ -261,18 +264,21 @@ class TestInventory(base.TestCase):
'vars': {'ansible_python_interpreter': 'foo',
'ansible_ssh_user': ansible_ssh_user,
'bootstrap_server_id': 'a',
'serial': 1,
'tripleo_role_name': 'Compute'}},
'Controller': {
'hosts': ['c-0', 'c-1', 'c-2'],
'vars': {'ansible_python_interpreter': 'foo',
'ansible_ssh_user': ansible_ssh_user,
'bootstrap_server_id': 'a',
'serial': 1,
'tripleo_role_name': 'Controller'}},
'CustomRole': {
'hosts': ['cs-0'],
'vars': {'ansible_python_interpreter': 'foo',
'ansible_ssh_user': ansible_ssh_user,
'bootstrap_server_id': 'a',
'serial': 1,
'tripleo_role_name': 'CustomRole'}},
'overcloud': {
'children': ['Compute', 'Controller', 'CustomRole'],
@ -335,6 +341,7 @@ class TestInventory(base.TestCase):
'enabled_networks': ['ctlplane']}},
'vars': {'ansible_ssh_user': ansible_ssh_user,
'bootstrap_server_id': 'a',
'serial': 1,
'tripleo_role_name': 'Compute'}},
'Controller': {
'hosts': {
@ -355,6 +362,7 @@ class TestInventory(base.TestCase):
'enabled_networks': ['ctlplane']}},
'vars': {'ansible_ssh_user': ansible_ssh_user,
'bootstrap_server_id': 'a',
'serial': 1,
'tripleo_role_name': 'Controller'}},
'CustomRole': {
'hosts': {
@ -365,6 +373,7 @@ class TestInventory(base.TestCase):
'enabled_networks': ['ctlplane']}},
'vars': {'ansible_ssh_user': ansible_ssh_user,
'bootstrap_server_id': 'a',
'serial': 1,
'tripleo_role_name': 'CustomRole'}},
'overcloud': {'children': {'Compute': {},
'Controller': {},