summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alvarez <pedro.alvarez@codethink.co.uk>2015-04-02 16:57:15 +0000
committerRichard Ipsum <richardipsum@fastmail.co.uk>2015-04-10 20:17:47 +0100
commiteea0c22cf5d768a7d59aacab620e3875f12431df (patch)
tree0b7a4d0ecef8a248d9efbe9afb11fcafe2e84326
parent992037bb11ea78a32c65d748c0691ac2aadffb6a (diff)
downloaddefinitions-eea0c22cf5d768a7d59aacab620e3875f12431df.tar.gz
openstack-network: Move network configuration out of neutron setup.
-rw-r--r--openstack/usr/share/openstack/network.yml113
-rw-r--r--openstack/usr/share/openstack/neutron.yml129
-rw-r--r--openstack/usr/share/openstack/openvswitch.yml1
3 files changed, 113 insertions, 130 deletions
diff --git a/openstack/usr/share/openstack/network.yml b/openstack/usr/share/openstack/network.yml
new file mode 100644
index 00000000..4179145b
--- /dev/null
+++ b/openstack/usr/share/openstack/network.yml
@@ -0,0 +1,113 @@
+---
+- hosts: localhost
+ tasks:
+# Create the bridges to use the External network mapped
+# This configuration is for 1 node and it was taken from:
+# https://fosskb.wordpress.com/2014/10/18/openstack-juno-on-ubuntu-14-10/
+# and https://fosskb.wordpress.com/2014/06/10/managing-openstack-internaldataexternal-network-in-one-interface/
+
+# Count number of network interfaces (interfaces starting with 'e')
+ - shell: ls /sys/class/net | grep ^e.* | wc -l
+ register: number_interfaces
+
+# Abort if there number of interfaces != 1
+ - fail:
+ msg: More than one, or none network interfaces found.
+ when: number_interfaces.stdout != "1"
+
+ - shell: ls /sys/class/net | grep ^e.*
+ register: interface_name
+
+ - set_fact:
+ ETH_INTERFACE: "{{ interface_name.stdout }}"
+ ETH_MAC_ADDRESS: "{{ hostvars['localhost']['ansible_' + interface_name.stdout]['macaddress'] }}"
+
+ - name: Create the /run/systemd/network
+ file:
+ path: /run/systemd/network
+ state: directory
+
+ - name: Disable dhcp on the bound physical interface
+ template:
+ src: /usr/share/openstack/extras/00-disable-device.network
+ dest: /run/systemd/network/00-disable-{{ item }}-config.network
+ with_items:
+ - "{{ ETH_INTERFACE }}"
+
+
+ - name: Disable dhcp on all the internal interfaces
+ template:
+ src: /usr/share/openstack/extras/00-disable-device.network
+ dest: /run/systemd/network/00-disable-{{ item }}-config.network
+ with_items:
+ - br-eth1
+ - br-ex
+ - eth1-br-proxy
+ - proxy-br-eth1
+ - proxy-br-ex
+ - ovs-system
+
+#ovs-vsctl \
+# -- add-br br-eth0 \
+# -- add-port br-eth0 $eth_dev \
+# -- set bridge br-eth0 other-config:hwaddr=$eth_mac
+#
+
+
+ - openvswitch_bridge:
+ bridge: br-eth0
+ state: present
+
+ - openvswitch_port:
+ bridge: br-eth0
+ port: "{{ ETH_INTERFACE }}"
+ state: present
+
+ - shell: ovs-vsctl set bridge br-eth0 other-config:hwaddr={{ ETH_MAC_ADDRESS }}
+
+ - name: Enable dhcp on the Open vSwitch device that replaces our external interface
+ template:
+ src: /usr/share/openstack/extras/10-device-dhcp.network
+ dest: /run/systemd/network/10-{{ item }}-dhcp.network
+ with_items:
+ - br-eth0
+
+#ovs-vsctl \
+# -- add-br br-eth1 \
+# -- add-port br-eth1 eth1-br-proxy \
+# -- set interface eth1-br-proxy type=patch options:peer=proxy-br-eth1 \
+# -- add-port br-eth0 proxy-br-eth1 \
+# -- set interface proxy-br-eth1 type=patch options:peer=eth1-br-proxy \
+# -- add-br br-ex \
+# -- add-port br-ex ex-br-proxy \
+# -- set interface ex-br-proxy type=patch options:peer=proxy-br-ex \
+# -- add-port br-eth0 proxy-br-ex \
+# -- set interface proxy-br-ex type=patch options:peer=ex-br-proxy
+
+
+ - openvswitch_bridge:
+ bridge: br-eth1
+ state: present
+ - openvswitch_port:
+ bridge: br-eth1
+ port: eth1-br-proxy
+ state: present
+ - shell: ovs-vsctl set interface eth1-br-proxy type=patch options:peer=proxy-br-eth1
+ - openvswitch_port:
+ bridge: br-eth0
+ port: proxy-br-eth1
+ state: present
+ - shell: ovs-vsctl set interface proxy-br-eth1 type=patch options:peer=eth1-br-proxy
+ - openvswitch_bridge:
+ bridge: br-ex
+ state: present
+ - openvswitch_port:
+ bridge: br-ex
+ port: ex-br-proxy
+ state: present
+ - shell: ovs-vsctl set interface ex-br-proxy type=patch options:peer=proxy-br-ex
+ - openvswitch_port:
+ bridge: br-eth0
+ port: proxy-br-ex
+ state: present
+ - shell: ovs-vsctl set interface proxy-br-ex type=patch options:peer=ex-br-proxy
diff --git a/openstack/usr/share/openstack/neutron.yml b/openstack/usr/share/openstack/neutron.yml
index 22ab4e18..7529a656 100644
--- a/openstack/usr/share/openstack/neutron.yml
+++ b/openstack/usr/share/openstack/neutron.yml
@@ -94,135 +94,6 @@
sudo: yes
sudo_user: neutron
-# Create the bridges to use the External network mapped
-# This configuration is for 1 node and it was taken from:
-# https://fosskb.wordpress.com/2014/10/18/openstack-juno-on-ubuntu-14-10/
-# and https://fosskb.wordpress.com/2014/06/10/managing-openstack-internaldataexternal-network-in-one-interface/
-
- - set_fact:
- ETH_INTERFACE: "{{ ansible_default_ipv4.interface }}"
- when: ansible_default_ipv4.interface
- - set_fact:
- ETH_INTERFACE: br-eth0
- when: not ansible_default_ipv4.interface
-
- - set_fact:
- ETH_MAC_ADDRESS: "{{ ansible_default_ipv4.macaddress }}"
- ETH_IP_ADDRESS: "{{ ansible_default_ipv4.address }}"
- when: ETH_INTERFACE != "br-eth0"
-
-# if is not br-eth0
- - name: Disable dhcp on the bound physical interface
- template:
- src: /usr/share/openstack/extras/00-disable-device.network
- dest: /etc/systemd/network/00-disable-{{ item }}-config.network
- with_items:
- - "{{ ETH_INTERFACE }}"
- when: ETH_INTERFACE != "br-eth0"
-
-
-# if is not br-eth0
- - name: >
- Deallocate ip address for external interface so we don't try to route
- connections out of an interface that not longer works. Run only when
- we are not connecting through the br-eth0 bridge
- shell: ip addr del {{ ETH_IP_ADDRESS }} dev {{ ETH_INTERFACE }}
- when: ETH_INTERFACE != "br-eth0"
-
-# If is not br-eth0
- - name: Disable dhcp on all the internal interfaces
- template:
- src: /usr/share/openstack/extras/00-disable-device.network
- dest: /etc/systemd/network/00-disable-{{ item }}-config.network
- with_items:
- - br-eth1
- - br-ex
- - eth1-br-proxy
- - proxy-br-eth1
- - proxy-br-ex
- - ovs-system
- register: internal_dhcp_disabled
-
- - name: Restart networkd so it understands to not bring up the interfaces disabled
- service:
- name: systemd-networkd.service
- state: restarted
- when: internal_dhcp_disabled|changed
-
-#ovs-vsctl \
-# -- add-br br-eth0 \
-# -- add-port br-eth0 $eth_dev \
-# -- set bridge br-eth0 other-config:hwaddr=$eth_mac
-#
-
-
- - openvswitch_bridge:
- bridge: br-eth0
- state: present
-# if is not br-eth0
- - openvswitch_port:
- bridge: br-eth0
- port: "{{ ETH_INTERFACE }}"
- state: present
- when: ETH_INTERFACE != "br-eth0"
-# if is not br-eth0
- - shell: ovs-vsctl set bridge br-eth0 other-config:hwaddr={{ ETH_MAC_ADDRESS }}
- when: ETH_INTERFACE != "br-eth0"
-
- - name: Enable dhcp on the Open vSwitch device that replaces our external interface
- template:
- src: /usr/share/openstack/extras/10-device-dhcp.network
- dest: /etc/systemd/network/10-{{ item }}-dhcp.network
- with_items:
- - br-eth0
-
- - name: Restart networkd again so it will DHCP in the Open vSwitch interface
- service:
- name: systemd-networkd.service
- state: restarted
-
-#ovs-vsctl \
-# -- add-br br-eth1 \
-# -- add-port br-eth1 eth1-br-proxy \
-# -- set interface eth1-br-proxy type=patch options:peer=proxy-br-eth1 \
-# -- add-port br-eth0 proxy-br-eth1 \
-# -- set interface proxy-br-eth1 type=patch options:peer=eth1-br-proxy \
-# -- add-br br-ex \
-# -- add-port br-ex ex-br-proxy \
-# -- set interface ex-br-proxy type=patch options:peer=proxy-br-ex \
-# -- add-port br-eth0 proxy-br-ex \
-# -- set interface proxy-br-ex type=patch options:peer=ex-br-proxy
-
-
- - openvswitch_bridge:
- bridge: br-eth1
- state: present
- - openvswitch_port:
- bridge: br-eth1
- port: eth1-br-proxy
- state: present
- - shell: ovs-vsctl set interface eth1-br-proxy type=patch options:peer=proxy-br-eth1
- - openvswitch_port:
- bridge: br-eth0
- port: proxy-br-eth1
- state: present
- - shell: ovs-vsctl set interface proxy-br-eth1 type=patch options:peer=eth1-br-proxy
- - openvswitch_bridge:
- bridge: br-ex
- state: present
- - openvswitch_port:
- bridge: br-ex
- port: ex-br-proxy
- state: present
- - shell: ovs-vsctl set interface ex-br-proxy type=patch options:peer=proxy-br-ex
- - openvswitch_port:
- bridge: br-eth0
- port: proxy-br-ex
- state: present
- - shell: ovs-vsctl set interface proxy-br-ex type=patch options:peer=ex-br-proxy
-
-
-## SERVICES
- name: Enable and start openstack-neutron services
service:
name: "{{ item }}"
diff --git a/openstack/usr/share/openstack/openvswitch.yml b/openstack/usr/share/openstack/openvswitch.yml
index 731d32c4..8331c639 100644
--- a/openstack/usr/share/openstack/openvswitch.yml
+++ b/openstack/usr/share/openstack/openvswitch.yml
@@ -37,4 +37,3 @@
service: name={{ item }} enabled=yes state=started
with_items:
- openvswitch.service
- - openstack-neutron-setup.service