Add ethernet support on external network

Today when we need to configure the external network on the undercloud
we can only set an ovs device with type OVSIntPort.
This commit makes you able to set a device as it is (so without any vlan
or additional ovs options), like this:

undercloud_networks:
  external:
    address: 172.20.0.254
    netmask: 255.255.255.0
    device_type: ethernet
    device_name: eth2

Change-Id: I0e57891d845bde21a42746b2babb55c75b336ee7
This commit is contained in:
Raoul Scarazzini 2017-02-23 08:11:40 -05:00
parent b79a0585db
commit 52e6d67924
2 changed files with 67 additions and 8 deletions

View File

@ -1,27 +1,73 @@
Role Name
=========
An Ansible role to copy configuration files to the undercloud prior to deployment.
An Ansible role to copy configuration files to the undercloud prior to
deployment.
Requirements
------------
This playbook expects that the undercloud has been installed and setup using one of the roles relevant to baremetal overcloud deployments.
This playbook expects that the undercloud has been installed and setup using
one of the roles relevant to baremetal overcloud deployments.
Role Variables
--------------
**Note:** Make sure to include all environment file and options from your [initial Overcloud creation](https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux_OpenStack_Platform/7/html/Director_Installation_and_Usage/sect-Scaling_the_Overcloud.html).
- working_dir: <'/home/stack'> -- working directory for the role. Assumes stackrc file is present at this location
- baremetal_instackenv: <"{{ working_dir }}/instackenv.json"> -- location of instackenv.json to copy over
- baremetal_network_environment: <"{{ working_dir }}/network-isolation.yml"> -- location of network-environment file to copy over
- undercloud_type: <virtual> -- can be overwritten with values like 'baremetal' or 'ovb'
- working_dir: <'/home/stack'> -- working directory for the role. Assumes
stackrc file is present at this location
- baremetal_instackenv: <"{{ working_dir }}/instackenv.json"> -- location of
instackenv.json to copy over
- baremetal_network_environment: <"{{ working_dir }}/network-isolation.yml">
-- location of network-environment file to copy over
- undercloud_type: <virtual> -- can be overwritten with values like 'baremetal'
or 'ovb'
- undercloud_networks: by default an external network is defined by
tripleo-quickstart, as follows:
undercloud_networks:
external:
address: "{{ undercloud_external_network_cidr|nthhost(1) }}"
netmask: "{{ undercloud_external_network_cidr|ipaddr('netmask') }}"
address6: "{{ undercloud_external_network_cidr6|nthhost(1) }}"
device_type: ovs
type: OVSIntPort
ovs_bridge: br-ctlplane
ovs_options: '"tag=10"'
tag: 10
But it is possible to override this, when specific vlan options are needed:
undercloud_networks:
external:
address: 172.20.0.254
netmask: 255.255.255.0
device_type: ovs
type: OVSIntPort
ovs_bridge: br-ctlplane
ovs_options: '"tag=1005"'
tag: 1005
Or when the external network on the undercloud is and ethernet device instead
of a bridge:
undercloud_networks:
external:
address: 172.20.0.254
netmask: 255.255.255.0
device_type: ethernet
device_name: eth2
What makes the difference in this case is the *device_type* set to *ethernet*
instead of *ovs* and the *device_name* which must be the name of the ethernet
device on the undercloud.
Dependencies
------------
This playbook does not deploy the overcloud. After this playbook runs, call https://github.com/redhat-openstack/ansible-role-tripleo-overcloud.
This playbook does not deploy the overcloud. After this playbook runs, call
https://github.com/redhat-openstack/ansible-role-tripleo-overcloud.
Example Playbook
----------------

View File

@ -38,7 +38,7 @@ echo "Please use 'single-nic-vlans' and 'bond-with-vlans'"
{% endif %}
{% for name, network in (undercloud_networks|default({})).items() if name == 'external' %}
{% if not overcloud_ipv6|bool %}
{% if not overcloud_ipv6|bool and network.device_type == 'ovs' %}
sudo bash -c 'cat <<EOF > /etc/sysconfig/network-scripts/ifcfg-vlan{{ network.tag }}
DEVICE=vlan{{ network.tag }}
ONBOOT=yes
@ -53,6 +53,19 @@ EOF'
sudo ifup ifcfg-vlan{{ network.tag }}
{% elif not overcloud_ipv6|bool and network.device_type == 'ethernet' %}
sudo bash -c 'cat <<EOF > /etc/sysconfig/network-scripts/ifcfg-{{ network.device_name }}
DEVICE={{ network.device_name }}
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=static
IPADDR={{ network.address }}
NETMASK={{ network.netmask }}
EOF'
sudo ifup ifcfg-{{ network.device_name }}
{% else %}
sudo bash -c 'cat <<EOF > /etc/sysconfig/network-scripts/ifcfg-eth6