Skip to content

Commit

Permalink
setup br-public interface for provider networking
Browse files Browse the repository at this point in the history
  • Loading branch information
johnstudarus committed Apr 27, 2020
1 parent a6aee92 commit 1ef4104
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 57 deletions.
3 changes: 3 additions & 0 deletions CommonServerSetup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ apt-get -y install python3-openstackclient
# easy modification of .ini configuration files
apt-get -y install crudini

# setup bridge networking for provider networks
apt-get -y install bridge-utils



cat >> admin-openrc << EOF
Expand Down
55 changes: 0 additions & 55 deletions ExternalNetwork.sh

This file was deleted.

3 changes: 2 additions & 1 deletion OpenStack.tf
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ resource "null_resource" "controller-nova" {
}

resource "null_resource" "controller-neutron" {
depends_on = [null_resource.controller-nova]
depends_on = [null_resource.controller-nova,
null_resource.enable-br-public]

connection {
host = packet_device.controller.access_public_ipv4
Expand Down
32 changes: 32 additions & 0 deletions ProviderNetwork.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,38 @@ resource "packet_ip_attachment" "controller_public_ipv6" {

}

data "template_file" "network-interfaces-br-public" {

template = file("templates/network-interfaces-br-public")

vars = {
provider_ipv4_cidr = packet_ip_attachment.controller_private_ipv4.cidr_notation
provider_ipv6_cidr = packet_ip_attachment.controller_public_ipv6.cidr_notation
}
}

resource "null_resource" "enable-br-public" {
depends_on = [null_resource.controller-keystone]

connection {
host = packet_device.controller.access_public_ipv4
private_key = file(var.cloud_ssh_key_path)
}

provisioner "file" {
content = data.template_file.network-interfaces-br-public.rendered
destination = "network-interfaces-br-public"
}

# controller-keystone is required for the bridge-utils package to ifup br-public
provisioner "remote-exec" {
inline = [
"cat network-interfaces-br-public >> /etc/network/interfaces",
"ifup br-public",
]
}
}

data "template_file" "provider-networks" {

template = file("templates/ProviderNetworks.sh")
Expand Down
8 changes: 7 additions & 1 deletion templates/ProviderNetworks.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
#
# associate elastic IP subnet with the controller node via the Packet Web GUI
#

export OS_USERNAME=admin
export OS_PASSWORD=ADMIN_PASS
export OS_PROJECT_NAME=admin
Expand Down Expand Up @@ -33,3 +33,9 @@ for ROUTER_ID in `openstack router list -f value -c ID`
do
openstack router set --external-gateway $PROVIDER_4_ID $ROUTER_ID
done

#
# assign the subnet to an interface attached to the external bridge
#
brctl addbr br-public
ip a add $PROVIDER_4_CIDR dev br-public
5 changes: 5 additions & 0 deletions templates/network-interfaces-br-public
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

auto br-public
iface br-public inet static
address ${provider_ipv4_cidr}
bridge_ports none

0 comments on commit 1ef4104

Please sign in to comment.