Networking-Ansible is a Neutron ML2 driver that abstracts the management and interaction with switching hardware to Ansible Networking. This driver is not tested with all the modules included with Ansible Networking. In theory it should work with any switch that has compatible modules included with Ansible Networking if the provider tasks are added to the Ansible openstack-ml2 role included with this driver. See the contributor documentation for more information about adding support for an Ansible Networking driver to the openstack-ml2 Ansible role.
The Networking-Ansible ML2 Driver consists of the following components:
networking_ansible
ML2 DriverIronic Baremetal Guest Deployment
Ironic uses Networking-Ansible to configure the switch ports for the baremetal guests. Ironic needs to swap the port a baremetal guest is connected to between the Ironic provisioning network and the tenant VLAN that the guest is assigned.
This section describes how to install and configure the networking-ansible ML2 Driver, code-named networking-ansible, on the controller node. This section assumes that you already have a working OpenStack environment with Neutron server included.
Perform installation configuration steps on each controller node that has a Neutron server running.
To successfully install and configure the Networking-Ansible ML2 Driver, you will need a few prerequisites. Collecting this information and ensuring these resources are available will ensure a successful installation.
Switch credentials that allow configuration changes to the ports that the deployed baremetal guests are connected to.
For security purposes it is important that you do not provide administrator access to the switch for networking-ansible. A user should be created and granted access for the permissions needed for networking-ansible.
Networking-Ansible will need to configure a port in access mode and assign a VLAN to that port. It will optionally need access to create VLANs if you choose not to predefine the VLANs that will be used.
OpenStack must be installed with Neutron configured to provide VLAN tenant networking.
This prerequisite is currently outside the scope of this document. Please refer to Neutron’s documentation or other guides to provide VLAN tenant networking.
This section describes how to install and configure the Networking-Ansible Driver, code-named networking_ansible, on the controller node. This section assumes that you already have a working OpenStack environment with Neutron configured to provide VLAN tenant networking.
Note
Note that installation and configuration may vary by distribution.
This section describes how to install the Networking-Ansible ML2 Driver for openSUSE Leap 42.1 and SUSE Linux Enterprise Server 12 SP1.
Install the packages:
# zypper --quiet --non-interactive install python2-networking-ansible
This section describes how to install the Networking-Ansible ML2 Driver for Red Hat Enterprise Linux 7, Fedora, and CentOS 7.
Install the packages:
# yum install python2-networking-ansible
This section decribes how to configure Neutron configuration files to enable the networking-ansible ML2 driver and configure switch devices that will be managed by networking-ansible.
Configure type_drivers and mechanism_drivers and network_vlan_ranges.
Add
vlan
totype_drivers
,ansible
tomechanism_drivers
, and define thenetwork_vlan_range
that will be used by the openstack networks that use this driver.[ml2] type_drivers = vlan mechanism_drivers = ansible [ml2_type_vlan] network_vlan_ranges = physnet1:1000:1099
- Do not remove other values from these comma delimited lists if there are are already values present. Append a comma and your value to the list.
- physnet1 is an identifier configured in the bridge_mapping TODO(radez) doc ref to bridge_mapping
- the VLAN range (1000:1099 in this example) is provided by the switch administor. This range is the VLAN IDs assigned by Neutron when a network is created.
Add a section for each switch device that will be managed by networking-ansible.
Create a section for each host with a section name prefixed by
ansible:
in/etc/neutron/plugins/ml2/ml2_conf.ini
.[ansible:myhostname] ansible_network_os=junos ansible_host=10.10.2.250 ansible_user=ansible ansible_pass=password mac=01:23:45:67:89:AB
- myhostname is an arbitrary internal identifier used only in ironic’s link_local_information.
- ansible_network_os is a valid Ansible Networking value to indicate switch type. Tested with networking-ansible: openvswitch, junos Untested but valid with networking-ansible: eos, nxos See contributor/provider for more information.
- ansible_host is the IP address or hostname used to connect to the switch.
- ansible_user username of the credentials used to connect to the switch.
- ansible_pass password of the credentials used to connect to the switch.
- mac is the MAC address of the switch as provided by lldp. This is optional to provide and specific to OpenStack ML2 use cases. It is used for zero touch provisioning using Ironic introspection. Introspection gathers the switch’s MAC and node’s port provided by lldp and populates the baremetal node’s local_link_information. If this parameter is provided in the ML2 ini configuration it will be used to match against the lldp provided MAC to populate internally generated ansible playbooks with the appropriate host name for the switch.
Additional available parameters:
ansible_ssh_private_key_file=/path/to/ansible-ssh manage_vlans=True
- ansible_ssh_private_key_file can be used as an alternative to ansible_pass to use ssh key authentication instead of password authentication.
- manage_vlans is optional and defaults to True. Set this to False for a switch if networking-ansible should not create and delete VLANs on the device.
Restart the Neutron API service
$ service neturon-server restart
Verify operation of the networking-ansible ML2 Driver service.
Grep the neutron logs for ansible and confirm the driver has been registered and configured. root access CLI commands:
$ grep ansible /var/log/neutron/server.log
INFO neutron.plugins.ml2.managers [-] Configured mechanism driver names: ['ansible']
INFO neutron.plugins.ml2.managers [-] Loaded mechanism driver names: ['ansible']
INFO neutron.plugins.ml2.managers [-] Registered mechanism drivers: ['ansible']
Your OpenStack environment now includes the networking-ansible ML2 Driver.
To add additional services, see https://docs.openstack.org/.
Note
Installation and configuration may vary by distribution.
This chapter assumes a working setup of OpenStack that includes Neutron server. For guides to assist in installing and deploying OpenStack visit OpenStack Docs.
Networking-Ansible is currently tested with one use case, Ironic Baremetal Guests. In this section this use case will be exercised in a set of example commands to show how end users would use ironic to provision baremetal nodes. Provisioning baremetal nodes using ironic with networking-ansible would use networking-ansible to manage the guest’s switch level network configuration. Networking-Ansible is used by ironic to first assign a baremetal guest’s switchport to the Ironic provisoning network to provision the baremetal guest. After provisoning, the baremetal guest’s switchport is assigned to the VLAN assigned by Neutron to guest’s tenant network.
The example shown here mirrors a user’s expereience deploying a guest with Ironic. The end user’s experience using networking-ansible is via Neutron and Nova. Nova will select a baremetal node as its target when a properly configured baremetal flavor is provided to the OpenStack server create command.
openstack baremetal node list openstack flavor list
openstack network create --provider-network-type vlan --provider-physical-network datacentre my-tenant-net openstack subnet create --network tenant-net --subnet-range 192.168.3.0/24 --allocation-pool start=192.168.3.10,end=192.168.3.20 tenant-subnet
openstack server create --image a-baremetal-image --flavor baremetal --nic net-id={my-tenant-net uuid} --key-name my-keypair bm-instance
If you would like to contribute to the development of OpenStack, you must follow the steps in this page:
If you already have a good understanding of how the system works and your OpenStack accounts are set up, you can skip to the development workflow section of this documentation to learn how changes to OpenStack should be submitted for review via the Gerrit tool:
Pull requests submitted through GitHub will be ignored.
Bugs should be filed on Storyboard, not GitHub:
Networking-Ansible contains provider switch specific functionality in an Ansible role that enables specific hardware devices per provider switch added to this role. The openstack-ml2 Ansible role is stored in networking-ansible’s etc/ansible/roles directory. A provider switch will be refered to as just a provider for the remainder of this document.
To add a provider to networking-ansible’s capabilities the provider must be added to the Ansible openstack-ml2 role. To add the provider to the openstack-ml2 role a new directory using the Ansible Networking module name [1] must be added that contains files that will define the Ansible tasks nessessary to perform the respective ML2 action.
Inside the directory for the provider, a file for default values, plus a file for each supported action in netwoking-ansible is required. There are currently five files required to add full functionality for a provider in networking-ansible.
defaults.yaml
Defines default values for segmentation name and ID. For example some switch vendors use the name “default” and VLAN ID 1 as a default VLAN to assign switchports to. Open vSwitch expects no VLAN ID and VLAN name in the case that port is not assigned to a specific VLAN.
create_network.yaml
Defines the Ansible tasks to create a VLAN on a switch.
delete_network.yaml
Defines the Ansible tasks to delete a VLAN on a switch.
update_port.yaml
Defines the Ansible tasks to assign a VLAN to a switchport in access mode.
delete_port.yaml
Defines the Ansible tasks to remove configuration from a switchport.
[1] https://docs.ansible.com/ansible/2.5/modules/list_of_network_modules.html
References of networking-ansible.
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.