-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
generate file to setup provider networking
- Loading branch information
1 parent
4d77661
commit a6aee92
Showing
3 changed files
with
58 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1 @@ | ||
resource "null_resource" "controller-external-network" { | ||
|
||
connection { | ||
host = packet_device.controller.access_public_ipv4 | ||
private_key = file(var.cloud_ssh_key_path) | ||
} | ||
|
||
provisioner "file" { | ||
source = "ExternalNetwork.sh" | ||
destination = "ExternalNetwork.sh" | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# | ||
# | ||
# 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 | ||
export OS_USER_DOMAIN_NAME=Default | ||
export OS_PROJECT_DOMAIN_NAME=Default | ||
export OS_AUTH_URL=http://controller:5000/v3 | ||
export OS_IDENTITY_API_VERSION=3 | ||
|
||
PROVIDER_4_CIDR="${provider_ipv4_cidr}" | ||
PROVIDER_6_CIDR="${provider_ipv6_cidr}" | ||
|
||
export PROVIDER_4_ID=`openstack network create --share \ | ||
--provider-physical-network provider \ | ||
--provider-network-type flat provider \ | ||
--external \ | ||
-f value -c id` | ||
|
||
echo "Provider 4 ID is $PROVIDER_4_ID" | ||
|
||
export SUBNET_4_ID=`openstack subnet create \ | ||
--network $PROVIDER_4_ID \ | ||
--subnet-range $PROVIDER_4_CIDR \ | ||
$PROVIDER_4_CIDR -f value -c id` | ||
|
||
echo "Subnet 4 ID is $SUBNET_4_ID" | ||
|
||
# assign this gateway to all routers | ||
for ROUTER_ID in `openstack router list -f value -c ID` | ||
do | ||
openstack router set --external-gateway $PROVIDER_4_ID $ROUTER_ID | ||
done |