Generate bifrost hostvars prior to provisioning
The 'kayobe overcloud inventory discover' command can be used to discover an overcloud inventory from the nodes in the ironic service running on the seed. This works well for cases where the nodes have been autodiscovered, and as such do not exist in the kayobe inventory. There is another use case where overcloud nodes already exist in the kayobe inventory. In that case we don't want to run the above command, as it will create duplicate hosts in the inventory. We do however want the part of that command that generates bifrost host variables for the overcloud nodes. This change moves the generation of bifrost host variables to the 'kayobe overcloud provision' and 'kayobe overcloud hardware inspect' commands, which are used in each of these cases. Change-Id: I8a69ccd5192c0c5beeb7efb36c09b2c4643ef150 Story: 2004426 Task: 28079
This commit is contained in:
parent
411340b005
commit
bff985330a
@ -578,8 +578,6 @@ class OvercloudInventoryDiscover(KayobeAnsibleMixin, VaultMixin, Command):
|
||||
* Query the ironic inventory on the seed, and use this to populate kayobe's
|
||||
ansible inventory.
|
||||
* Allocate IP addresses for all configured networks.
|
||||
* Configure the bifrost service with host variables for provisioning the
|
||||
overcloud hosts.
|
||||
* Update the kolla-ansible configuration for the new overcloud hosts.
|
||||
"""
|
||||
|
||||
@ -593,9 +591,7 @@ class OvercloudInventoryDiscover(KayobeAnsibleMixin, VaultMixin, Command):
|
||||
# If necessary, allocate IP addresses for the discovered hosts.
|
||||
self.run_kayobe_playbook(parsed_args,
|
||||
"ansible/ip-allocation.yml")
|
||||
# Now populate the Kolla Ansible and Bifrost inventories.
|
||||
self.run_kayobe_playbook(parsed_args,
|
||||
"ansible/kolla-bifrost-hostvars.yml")
|
||||
# Now populate the Kolla Ansible inventory.
|
||||
self.run_kayobe_playbook(parsed_args, "ansible/kolla-ansible.yml",
|
||||
tags="config")
|
||||
|
||||
@ -652,7 +648,8 @@ class OvercloudHardwareInspect(KayobeAnsibleMixin, VaultMixin, Command):
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.app.LOG.debug("Inspecting overcloud")
|
||||
playbooks = _build_playbook_list("overcloud-hardware-inspect")
|
||||
playbooks = _build_playbook_list("kolla-bifrost-hostvars",
|
||||
"overcloud-hardware-inspect")
|
||||
self.run_kayobe_playbooks(parsed_args, playbooks)
|
||||
|
||||
|
||||
@ -666,7 +663,8 @@ class OvercloudProvision(KayobeAnsibleMixin, VaultMixin, Command):
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.app.LOG.debug("Provisioning overcloud")
|
||||
playbooks = _build_playbook_list("overcloud-provision")
|
||||
playbooks = _build_playbook_list("kolla-bifrost-hostvars",
|
||||
"overcloud-provision")
|
||||
self.run_kayobe_playbooks(parsed_args, playbooks)
|
||||
|
||||
|
||||
|
@ -650,7 +650,7 @@ class TestCase(unittest.TestCase):
|
||||
"run_kayobe_playbooks")
|
||||
@mock.patch.object(commands.KollaAnsibleMixin,
|
||||
"run_kolla_ansible_seed")
|
||||
def test_service_deploy(self, mock_kolla_run, mock_run):
|
||||
def test_seed_service_deploy(self, mock_kolla_run, mock_run):
|
||||
command = commands.SeedServiceDeploy(TestApp(), [])
|
||||
parser = command.get_parser("test")
|
||||
parsed_args = parser.parse_args([])
|
||||
@ -688,6 +688,95 @@ class TestCase(unittest.TestCase):
|
||||
]
|
||||
self.assertEqual(expected_calls, mock_kolla_run.call_args_list)
|
||||
|
||||
@mock.patch.object(commands.KayobeAnsibleMixin,
|
||||
"run_kayobe_playbook")
|
||||
def test_overcloud_inventory_discover(self, mock_run):
|
||||
command = commands.OvercloudInventoryDiscover(TestApp(), [])
|
||||
parser = command.get_parser("test")
|
||||
parsed_args = parser.parse_args([])
|
||||
|
||||
result = command.run(parsed_args)
|
||||
self.assertEqual(0, result)
|
||||
|
||||
expected_calls = [
|
||||
mock.call(
|
||||
mock.ANY,
|
||||
'ansible/overcloud-inventory-discover.yml',
|
||||
),
|
||||
mock.call(
|
||||
mock.ANY,
|
||||
'ansible/ip-allocation.yml',
|
||||
),
|
||||
mock.call(
|
||||
mock.ANY,
|
||||
'ansible/kolla-ansible.yml',
|
||||
tags="config",
|
||||
),
|
||||
]
|
||||
self.assertEqual(expected_calls, mock_run.call_args_list)
|
||||
|
||||
@mock.patch.object(commands.KayobeAnsibleMixin,
|
||||
"run_kayobe_playbooks")
|
||||
def test_overcloud_hardware_inspect(self, mock_run):
|
||||
command = commands.OvercloudHardwareInspect(TestApp(), [])
|
||||
parser = command.get_parser("test")
|
||||
parsed_args = parser.parse_args([])
|
||||
|
||||
result = command.run(parsed_args)
|
||||
self.assertEqual(0, result)
|
||||
|
||||
expected_calls = [
|
||||
mock.call(
|
||||
mock.ANY,
|
||||
[
|
||||
'ansible/kolla-bifrost-hostvars.yml',
|
||||
'ansible/overcloud-hardware-inspect.yml',
|
||||
],
|
||||
),
|
||||
]
|
||||
self.assertEqual(expected_calls, mock_run.call_args_list)
|
||||
|
||||
@mock.patch.object(commands.KayobeAnsibleMixin,
|
||||
"run_kayobe_playbooks")
|
||||
def test_overcloud_provision(self, mock_run):
|
||||
command = commands.OvercloudProvision(TestApp(), [])
|
||||
parser = command.get_parser("test")
|
||||
parsed_args = parser.parse_args([])
|
||||
|
||||
result = command.run(parsed_args)
|
||||
self.assertEqual(0, result)
|
||||
|
||||
expected_calls = [
|
||||
mock.call(
|
||||
mock.ANY,
|
||||
[
|
||||
'ansible/kolla-bifrost-hostvars.yml',
|
||||
'ansible/overcloud-provision.yml',
|
||||
],
|
||||
),
|
||||
]
|
||||
self.assertEqual(expected_calls, mock_run.call_args_list)
|
||||
|
||||
@mock.patch.object(commands.KayobeAnsibleMixin,
|
||||
"run_kayobe_playbooks")
|
||||
def test_overcloud_deprovision(self, mock_run):
|
||||
command = commands.OvercloudDeprovision(TestApp(), [])
|
||||
parser = command.get_parser("test")
|
||||
parsed_args = parser.parse_args([])
|
||||
|
||||
result = command.run(parsed_args)
|
||||
self.assertEqual(0, result)
|
||||
|
||||
expected_calls = [
|
||||
mock.call(
|
||||
mock.ANY,
|
||||
[
|
||||
'ansible/overcloud-deprovision.yml',
|
||||
],
|
||||
),
|
||||
]
|
||||
self.assertEqual(expected_calls, mock_run.call_args_list)
|
||||
|
||||
@mock.patch.object(commands.KayobeAnsibleMixin,
|
||||
"run_kayobe_config_dump")
|
||||
@mock.patch.object(commands.KayobeAnsibleMixin,
|
||||
|
Loading…
x
Reference in New Issue
Block a user