summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--openstack/usr/share/openstack/neutron.yml48
1 files changed, 26 insertions, 22 deletions
diff --git a/openstack/usr/share/openstack/neutron.yml b/openstack/usr/share/openstack/neutron.yml
index cfab6074..c0f43266 100644
--- a/openstack/usr/share/openstack/neutron.yml
+++ b/openstack/usr/share/openstack/neutron.yml
@@ -76,47 +76,53 @@
# 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/
- - name: Get the name of the network device
- shell: |
- ip addr | perl -pe 'if (/^\d+: ([^:]+)/) { $iface=$1; } if (m@^\s*inet ([^/]+)/@) { print "$iface $1\n"; } $_=undef;' | grep "^e" | head -1 | awk '{ print $1 } '
- register: eth_dev
+ - set_fact: ETH_IP_ADDRESS={{ ansible_default_ipv4.address }}
+ - set_fact: ETH_MAC_ADDRESS={{ ansible_default_ipv4.macaddress }}
+ - set_fact: ETH_INTERFACE={{ ansible_default_ipv4.interface }}
+# 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_dev.stdout }}"
- register: eth_dev_disabled
+ - "{{ ETH_INTERFACE }}"
+ when: ETH_INTERFACE != "br-eth0"
- - name: Get ip of the network device only if dhcp wasn't disabled
- shell: |
- ip addr | perl -pe 'if (/^\d+: ([^:]+)/) { $iface=$1; } if (m@^\s*inet ([^/]+)/@) { print "$iface $1\n"; } $_=undef;' | grep "^e" | head -1 | awk '{ print $2 } '
- register: eth_ip
- when: eth_dev_disabled|changed
+# 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
- dhcp wasn't disabled for that interface
- shell: ip addr del {{ eth_ip.stdout }} dev {{ eth_dev.stdout }}
- when: eth_dev_disabled|changed
+ 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:
+ - ETH_INTERFACE
+ when: ETH_INTERFACE != "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:
- - eth_dev.stdout
- 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 \
@@ -124,15 +130,13 @@
# -- set bridge br-eth0 other-config:hwaddr=$eth_mac
#
- - name: Get mac of the network device only if dhcp wasn't disabled
- shell: ip link show {{ eth_dev.stdout }} | sed -r 's/\s+/\n/g' | sed -n '/link\/ether/{n;p}'
- register: eth_mac
- when: eth_dev_disabled|changed
- openvswitch_bridge: bridge=br-eth0 state=present
- - openvswitch_port: bridge=br-eth0 port={{ eth_dev.stdout }} state=present
- - shell: ovs-vsctl set bridge br-eth0 other-config:hwaddr={{ eth_mac.stdout }}
- when: eth_dev_disabled|changed
+# if is not br-eth0
+ - openvswitch_port: bridge=br-eth0 port={{ ETH_INTERFACE }} state=present
+# 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: >