diff --git a/releasenotes/notes/network-update-var-e5082d1bed8d8cde.yaml b/releasenotes/notes/network-update-var-e5082d1bed8d8cde.yaml new file mode 100644 index 000000000..8e5f91d1b --- /dev/null +++ b/releasenotes/notes/network-update-var-e5082d1bed8d8cde.yaml @@ -0,0 +1,12 @@ +--- +features: + - | + Introduce a new variable tripleo_network_config_update. This will be a + bool. When tripleo_network_config_update is True. Existing network + configurations will be updated. By default, this is False and only + new deployments will have the networks configured. +deprecations: + - | + This change removes the tripleo_network_config_action. Since we can no + longer rely on the Heat stack action when using Ephemeral Heat in + tripleo diff --git a/tripleo_ansible/ansible_plugins/module_utils/baremetal_deploy.py b/tripleo_ansible/ansible_plugins/module_utils/baremetal_deploy.py index a2cda327f..94e08d9b9 100644 --- a/tripleo_ansible/ansible_plugins/module_utils/baremetal_deploy.py +++ b/tripleo_ansible/ansible_plugins/module_utils/baremetal_deploy.py @@ -52,11 +52,7 @@ _NETWORK_CONFIG_SCHEMA = { 'template': {'type': 'string'}, 'physical_bridge_name': {'type': 'string'}, 'public_interface_name': {'type': 'string'}, - 'network_deployment_actions': { - 'type': 'array', - 'items': {'type': 'string', - 'enum': ['CREATE', 'UPDATE']} - }, + 'network_config_update': {'type': 'boolean'}, 'net_config_data_lookup': {'type': 'object'}, 'default_route_network': { 'type': 'array', diff --git a/tripleo_ansible/ansible_plugins/modules/tripleo_generate_inventory_network_config.py b/tripleo_ansible/ansible_plugins/modules/tripleo_generate_inventory_network_config.py index bca7469c0..e854b385c 100644 --- a/tripleo_ansible/ansible_plugins/modules/tripleo_generate_inventory_network_config.py +++ b/tripleo_ansible/ansible_plugins/modules/tripleo_generate_inventory_network_config.py @@ -85,12 +85,12 @@ options: - Which interface to add to the public bridge type: string default: nic1 - network_deployment_actions: + network_config_update: description: - When to apply network configuration changes, allowed values - are CREATE and UPDATE. - type: list - default: ['CREATE'] + are True or False. + type: boolean + default: False networks_skip_config: description: - List of networks that should be skipped when configuring node @@ -123,7 +123,7 @@ Controller: template: templates/multiple_nics/multiple_nics.j2 physical_bridge_name: br-ex public_interface_name: nic1 - network_deployment_actions: ['CREATE'] + network_config_update: False net_config_data_lookup: {} bond_interface_ovs_options: bond_mode=balance-slb vars: @@ -134,14 +134,14 @@ Compute: template: templates/multiple_nics/multiple_nics.j2 physical_bridge_name: br-ex public_interface_name: nic1 - network_deployment_actions: ['CREATE'] + network_config_update: False net_config_data_lookup: {} bond_interface_ovs_options: bond_mode=balance-slb overcloud-compute-1: template: templates/multiple_nics/multiple_nics.j2 physical_bridge_name: br-ex public_interface_name: nic1 - network_deployment_actions: ['CREATE'] + network_config_update: False net_config_data_lookup: {} bond_interface_ovs_options: bond_mode=balance-slb vars: @@ -157,7 +157,7 @@ EXAMPLES = ''' template: templates/multiple_nics/multiple_nics.j2 physical_bridge_name: br-ex public_interface_name: nic1 - network_deployment_actions: ['CREATE'] + network_config_update: False net_config_data_lookup: {} bond_interface_ovs_options: bond_mode=balance-slb - hostname: overcloud-novacompute-0 @@ -165,7 +165,7 @@ EXAMPLES = ''' template: templates/multiple_nics/multiple_nics.j2 physical_bridge_name: br-ex public_interface_name: nic1 - network_deployment_actions: ['CREATE'] + network_config_update: False net_config_data_lookup: {} bond_interface_ovs_options: bond_mode=balance-slb - hostname: overcloud-novacompute-1 @@ -173,7 +173,7 @@ EXAMPLES = ''' template: templates/multiple_nics/multiple_nics.j2 physical_bridge_name: br-ex public_interface_name: nic1 - network_deployment_actions: ['CREATE'] + network_config_update: False net_config_data_lookup: {} bond_interface_ovs_options: bond_mode=balance-slb hostname_role_map: @@ -196,8 +196,7 @@ def translate_opts_for_tripleo_network_config_role(network_config): template='tripleo_network_config_template', physical_bridge_name='neutron_physical_bridge_name', public_interface_name='neutron_public_interface_name', - network_deployment_actions=('tripleo_network_config_' - 'network_deployment_actions'), + network_config_update=('tripleo_network_config_update'), net_config_data_lookup='tripleo_network_config_os_net_config_mappings', ) diff --git a/tripleo_ansible/playbooks/cli-overcloud-node-network-config.yaml b/tripleo_ansible/playbooks/cli-overcloud-node-network-config.yaml index e7819c1c9..fa84e9051 100644 --- a/tripleo_ansible/playbooks/cli-overcloud-node-network-config.yaml +++ b/tripleo_ansible/playbooks/cli-overcloud-node-network-config.yaml @@ -31,14 +31,13 @@ roles: - role: tripleo_network_config vars: - # The conditions in tripleo_network_config role for when we want to - # apply the NetworkConfig are: - # 1. If the stack_action is CREATE - # 2. Or UPDATE is in the network_deployment_actions - # 3. Or the previous run of NetworkConfig failed. - # 4. Or it has never run - # - # Since we don't have stack_action in this case. Set the network - # config action to UPDATE here so that we only apply network - # configuration if 2, 3 or 4 evalueates to TRUE. - tripleo_network_config_action: UPDATE + # The conditions here are when we want to apply the + # NetworkConfig. They are: + # - If tripleo_network_config_update is True + # - Or the previous run of NetworkConfig failed. + # - Or it has never run + # This will match the prior behavior of when a Heat + # SoftwareDeployment was used. + # It also ensures the script does exist as a sine qua non + # condition + tripleo_network_config_update: True diff --git a/tripleo_ansible/roles/tripleo_network_config/defaults/main.yml b/tripleo_ansible/roles/tripleo_network_config/defaults/main.yml index fce3eb29c..30ae26f74 100644 --- a/tripleo_ansible/roles/tripleo_network_config/defaults/main.yml +++ b/tripleo_ansible/roles/tripleo_network_config/defaults/main.yml @@ -18,7 +18,7 @@ # All variables intended for modification should be placed in this file. # All variables within this role should have a prefix of "tripleo_network_config" -tripleo_network_config_action: CREATE +tripleo_network_config_update: False tripleo_network_config_async_poll: 3 tripleo_network_config_async_timeout: 300 tripleo_network_config_bridge_name: br-ex @@ -26,7 +26,6 @@ tripleo_network_config_debug: "{{ (ansible_verbosity | int) >= 2 | bool }}" tripleo_network_config_hide_sensitive_logs: true tripleo_network_config_interface_name: nic1 tripleo_network_config_manage_service: true -tripleo_network_config_network_deployment_actions: [] tripleo_network_config_os_net_config_mappings: {} tripleo_network_config_safe_defaults: true tripleo_network_config_with_ansible: false diff --git a/tripleo_ansible/roles/tripleo_network_config/tasks/main.yml b/tripleo_ansible/roles/tripleo_network_config/tasks/main.yml index 6a32121fe..59f443d89 100644 --- a/tripleo_ansible/roles/tripleo_network_config/tasks/main.yml +++ b/tripleo_ansible/roles/tripleo_network_config/tasks/main.yml @@ -108,8 +108,7 @@ # The conditions here are when we want to apply the # NetworkConfig. They are: - # - If the stack_action is CREATE - # - Or UPDATE is in the network_deployment_actions + # - If tripleo_network_config_update is True # - Or the previous run of NetworkConfig failed. # - Or it has never run # This will match the prior behavior of when a Heat @@ -117,8 +116,7 @@ # It also ensures the script does exist as a sine qua non # condition when: - - (tripleo_network_config_action == "CREATE") or - ("UPDATE" in tripleo_network_config_network_deployment_actions) or + - (tripleo_network_config_update) or (os_net_config_returncode_stat.stat.exists and ((os_net_config_returncode_slurp.content | b64decode | int) != 0)) or (not os_net_config_returncode_stat.stat.exists) diff --git a/tripleo_ansible/tests/modules/test_tripleo_generate_inventory_network_config.py b/tripleo_ansible/tests/modules/test_tripleo_generate_inventory_network_config.py index d13f421ce..f6ed24552 100644 --- a/tripleo_ansible/tests/modules/test_tripleo_generate_inventory_network_config.py +++ b/tripleo_ansible/tests/modules/test_tripleo_generate_inventory_network_config.py @@ -65,8 +65,7 @@ class TestTripleoGenerateInventoryNetworkConfig(tests_base.TestCase): 'networks_skip_config': [], 'neutron_physical_bridge_name': 'br-ex', 'neutron_public_interface_name': 'nic1', - 'tripleo_network_config_network_deployment_actions': - ['CREATE'], + 'tripleo_network_config_update': False, 'tripleo_network_config_os_net_config_mappings': {}, 'tripleo_network_config_template': '/foo/template.j2'} }, @@ -81,8 +80,7 @@ class TestTripleoGenerateInventoryNetworkConfig(tests_base.TestCase): 'networks_skip_config': [], 'neutron_physical_bridge_name': 'br-ex', 'neutron_public_interface_name': 'nic1', - 'tripleo_network_config_network_deployment_actions': - ['CREATE'], + 'tripleo_network_config_update': False, 'tripleo_network_config_template': 'templates/net_config_bridge.j2'}}, 'vars': {