65fba08c94
Depends-On: https://review.opendev.org/c/openstack/openstack-ansible/+/909694 Change-Id: Id41c4b98d7e973ee85b77d2588ace3e2ce76490f
104 lines
4.4 KiB
YAML
104 lines
4.4 KiB
YAML
# (c) 2018, James Denton <james.denton@rackspace.com>
|
|
#
|
|
# Copyright 2018, Rackspace US, Inc.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
- name: Set openvswitch hostname
|
|
changed_when: false
|
|
command: "ovs-vsctl set open_vswitch . external-ids:hostname='{{ ansible_facts['nodename'] }}'"
|
|
when:
|
|
- (neutron_services['neutron-ovn-controller']['group'] in group_names)
|
|
|
|
- name: Set CMS Options for Gateway Scheduling
|
|
changed_when: false
|
|
command: "ovs-vsctl set Open_vSwitch . external-ids:ovn-cms-options=enable-chassis-as-gw,availability-zones={{ neutron_availability_zone }}"
|
|
when:
|
|
- '"neutron_ovn_gateway" in group_names'
|
|
|
|
- name: Configure OVN Southbound Connection
|
|
changed_when: false
|
|
command: "ovs-vsctl set open . external-ids:ovn-remote={{ neutron_ovn_sb_connection }}"
|
|
when:
|
|
- neutron_services['neutron-ovn-controller']['group'] in group_names
|
|
|
|
- name: Configure Supported OVN Overlay Protocols
|
|
changed_when: false
|
|
command: >-
|
|
ovs-vsctl set open . external-ids:ovn-encap-type={{ neutron_provider_networks.network_types.split(',') | intersect(
|
|
['geneve', 'vxlan', 'stt']) | join(',') }}
|
|
when:
|
|
- neutron_services['neutron-ovn-controller']['group'] in group_names
|
|
|
|
- name: Configure Encapsulation Address for Overlay Traffic
|
|
changed_when: false
|
|
command: "ovs-vsctl set open . external-ids:ovn-encap-ip={{ neutron_local_ip }}"
|
|
when:
|
|
- neutron_services['neutron-ovn-controller']['group'] in group_names
|
|
|
|
# Create an ovsdb manager for Nova (os-vif)
|
|
- name: Register existing OVSDB Manager(s)
|
|
command: ovs-vsctl get-manager
|
|
changed_when: false
|
|
register: existing_ovsdb_manager
|
|
when:
|
|
- neutron_services['neutron-ovn-controller']['group'] in group_names
|
|
|
|
- name: Create OVSDB Manager
|
|
command: ovs-vsctl --id @manager create Manager "target=\"{{ neutron_ovsdb_manager }}\"" -- add Open_vSwitch . manager_options @manager
|
|
changed_when: false
|
|
when:
|
|
- neutron_services['neutron-ovn-controller']['group'] in group_names
|
|
- neutron_ovsdb_manager not in existing_ovsdb_manager.stdout_lines
|
|
|
|
- name: Setup Network Provider Bridges
|
|
openvswitch_bridge:
|
|
bridge: "{{ bridge_mapping.split(':')[1] }}"
|
|
fail_mode: standalone
|
|
state: present
|
|
with_items: "{{ neutron_provider_networks.network_mappings.split(',') }}"
|
|
loop_control:
|
|
loop_var: bridge_mapping
|
|
when:
|
|
- neutron_services['neutron-ovn-controller']['group'] in group_names
|
|
- neutron_provider_networks.network_mappings is defined and (neutron_provider_networks.network_mappings|length > 0)
|
|
|
|
# NOTE(noonedeadpunk): When ovn-bgp-agent is in use, physical interfaces should not be added the OVS
|
|
# bridge directly.
|
|
- name: Add ports to Network Provider Bridges
|
|
vars:
|
|
_neutron_attach_ovs_port_for_bgp: >-
|
|
{{ (neutron_ovn_bgp_enable and neutron_services['neutron-ovn-bgp-agent']['group'] in group_names) | ternary('absent', 'present') }}
|
|
openvswitch_port:
|
|
bridge: "{{ interface_mapping.split(':')[0] }}"
|
|
port: "{{ interface_mapping.split(':')[1] }}"
|
|
state: "{{ _neutron_attach_ovs_port_for_bgp }}"
|
|
with_items: "{{ neutron_provider_networks.network_interface_mappings.split(',') }}"
|
|
loop_control:
|
|
loop_var: interface_mapping
|
|
when:
|
|
- neutron_services['neutron-ovn-controller']['group'] in group_names
|
|
- neutron_provider_networks.network_interface_mappings is defined and (neutron_provider_networks.network_interface_mappings|length > 0)
|
|
|
|
- name: Set the OVN Bridge Mappings in OVS
|
|
command: "ovs-vsctl set open . external-ids:ovn-bridge-mappings={{ neutron_provider_networks.network_mappings }}"
|
|
changed_when: false
|
|
when:
|
|
- neutron_provider_networks.network_mappings is defined and (neutron_provider_networks.network_mappings|length > 0)
|
|
- neutron_services['neutron-ovn-controller']['group'] in group_names
|
|
|
|
- name: Including ovn_cluster_setup tasks
|
|
include_tasks: ovn_cluster_setup.yml
|
|
when:
|
|
- neutron_services['neutron-ovn-northd']['group'] in group_names
|