Allocate IPs separately from configuring network

When running one of the `kayobe <seed|seed hypervisor|overcloud> host
configure` commands, in some cases an IP address that is allocated by
the ip-allocation.yml playbook fails to be picked up by the network.yml
playbook, which uses the address 0.0.0.0 instead.

Running ip-allocation.yml separately ensures that the correct IP is used
by network.yml.

Change-Id: I15529398aef5e21049182b0edc11816876331113
Story: 2004800
Task: 28953
This commit is contained in:
Pierre Riteau 2019-02-05 14:18:24 +00:00
parent 29c0ad98c0
commit 599b045636
2 changed files with 32 additions and 6 deletions

View File

@ -314,8 +314,14 @@ class SeedHypervisorHostConfigure(KollaAnsibleMixin, KayobeAnsibleMixin,
self.app.LOG.error("Could not determine kayobe_ansible_user "
"variable for seed hypervisor host")
sys.exit(1)
# Allocate IP addresses.
playbooks = _build_playbook_list("ip-allocation")
self.run_kayobe_playbooks(parsed_args, playbooks,
limit="seed-hypervisor")
playbooks = _build_playbook_list(
"ip-allocation", "ssh-known-host", "kayobe-ansible-user",
"ssh-known-host", "kayobe-ansible-user",
"pip", "kayobe-target-venv")
if parsed_args.wipe_disks:
playbooks += _build_playbook_list("wipe-disks")
@ -451,9 +457,13 @@ class SeedHostConfigure(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin,
python_interpreter = hostvars.get("ansible_python_interpreter")
kolla_target_venv = hostvars.get("kolla_ansible_target_venv")
# Allocate IP addresses.
playbooks = _build_playbook_list("ip-allocation")
self.run_kayobe_playbooks(parsed_args, playbooks, limit="seed")
# Run kayobe playbooks.
playbooks = _build_playbook_list(
"ip-allocation", "ssh-known-host", "kayobe-ansible-user",
"ssh-known-host", "kayobe-ansible-user",
"pip", "kayobe-target-venv")
if parsed_args.wipe_disks:
playbooks += _build_playbook_list("wipe-disks")
@ -848,9 +858,13 @@ class OvercloudHostConfigure(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin,
python_interpreter = hostvars.get("ansible_python_interpreter")
kolla_target_venv = hostvars.get("kolla_ansible_target_venv")
# Allocate IP addresses.
playbooks = _build_playbook_list("ip-allocation")
self.run_kayobe_playbooks(parsed_args, playbooks, limit="overcloud")
# Kayobe playbooks.
playbooks = _build_playbook_list(
"ip-allocation", "ssh-known-host", "kayobe-ansible-user",
"ssh-known-host", "kayobe-ansible-user",
"pip", "kayobe-target-venv")
if parsed_args.wipe_disks:
playbooks += _build_playbook_list("wipe-disks")

View File

@ -248,10 +248,14 @@ class TestCase(unittest.TestCase):
self.assertEqual(expected_calls, mock_dump.call_args_list)
expected_calls = [
mock.call(
mock.ANY,
[utils.get_data_files_path("ansible", "ip-allocation.yml")],
limit="seed-hypervisor",
),
mock.call(
mock.ANY,
[
utils.get_data_files_path("ansible", "ip-allocation.yml"),
utils.get_data_files_path("ansible", "ssh-known-host.yml"),
utils.get_data_files_path(
"ansible", "kayobe-ansible-user.yml"),
@ -344,10 +348,14 @@ class TestCase(unittest.TestCase):
self.assertEqual(expected_calls, mock_dump.call_args_list)
expected_calls = [
mock.call(
mock.ANY,
[utils.get_data_files_path("ansible", "ip-allocation.yml")],
limit="seed",
),
mock.call(
mock.ANY,
[
utils.get_data_files_path("ansible", "ip-allocation.yml"),
utils.get_data_files_path("ansible", "ssh-known-host.yml"),
utils.get_data_files_path(
"ansible", "kayobe-ansible-user.yml"),
@ -949,10 +957,14 @@ class TestCase(unittest.TestCase):
self.assertEqual(expected_calls, mock_dump.call_args_list)
expected_calls = [
mock.call(
mock.ANY,
[utils.get_data_files_path("ansible", "ip-allocation.yml")],
limit="overcloud",
),
mock.call(
mock.ANY,
[
utils.get_data_files_path("ansible", "ip-allocation.yml"),
utils.get_data_files_path("ansible", "ssh-known-host.yml"),
utils.get_data_files_path(
"ansible", "kayobe-ansible-user.yml"),