This commit is contained in:
Neil Hanlon 2021-10-30 16:55:41 -04:00
parent ec8a24cefa
commit 6e877e59c3
Signed by: neil
GPG Key ID: 705BC21EC3C70F34
4 changed files with 498 additions and 14 deletions

46
terraform/resourse2.tf Normal file
View File

@ -0,0 +1,46 @@
resource "digitalocean_droplet" "openstackaio-2" {
image = "rockylinux-8-x64"
name = "openstackaio-2"
region = "nyc3"
size = "g-8vcpu-32gb"
private_networking = true
ssh_keys = [
data.digitalocean_ssh_key.terraform.id
]
connection {
host = self.ipv4_address
user = "root"
type = "ssh"
private_key = file(var.pvt_key)
timeout = "2m"
}
provisioner "remote-exec" {
inline = [
"export PATH=$PATH:/usr/bin",
"dnf -y upgrade",
"dnf -y install git-core",
"systemctl stop firewalld",
"systemctl mask firewalld",
"sed -i 's/enforcing/disabled/' /etc/sysconfig/selinux",
"dnf -y install git wget python36",
"pip3 install virtualenv",
"git clone https://github.com/NeilHanlon/openstack-ansible.git /opt/openstack-ansible",
"cd /opt/openstack-ansible && git checkout feature/rocky8",
"/opt/openstack-ansible/scripts/bootstrap-ansible.sh",
"/opt/openstack-ansible/scripts/bootstrap-aio.sh",
]
}
provisioner "file" {
source = "files/user_lxc.yml"
destination = "/etc/openstack_deploy/user_lxc.yml"
}
}
resource "digitalocean_project_resources" "openstackaio-2" {
project = data.digitalocean_project.advancedlsa.id
resources = [
digitalocean_droplet.openstackaio-2.urn,
digitalocean_volume.openstackdata.urn
]
}

38
terraform/resourse3.tf Normal file
View File

@ -0,0 +1,38 @@
resource "digitalocean_droplet" "openstackaio-3" {
image = "rockylinux-8-x64"
name = "openstackaio-3"
region = "nyc3"
size = "g-8vcpu-32gb"
private_networking = true
ssh_keys = [
data.digitalocean_ssh_key.terraform.id
]
connection {
host = self.ipv4_address
user = "root"
type = "ssh"
private_key = file(var.pvt_key)
timeout = "2m"
}
provisioner "remote-exec" {
inline = [
"export PATH=$PATH:/usr/bin",
"dnf -y upgrade",
"dnf -y install git-core",
"systemctl stop firewalld",
"systemctl mask firewalld",
"sed -i 's/enforcing/disabled/' /etc/sysconfig/selinux",
"dnf -y install git wget python36",
"pip3 install virtualenv",
]
}
}
resource "digitalocean_project_resources" "openstackaio-3" {
project = data.digitalocean_project.advancedlsa.id
resources = [
digitalocean_droplet.openstackaio-3.urn,
digitalocean_volume.openstackdata.urn
]
}

View File

@ -1,8 +1,333 @@
{ {
"version": 4, "version": 4,
"terraform_version": "1.0.8", "terraform_version": "1.0.8",
"serial": 72, "serial": 84,
"lineage": "9cbca1f8-8910-c707-3b0a-5c03c8621271", "lineage": "9cbca1f8-8910-c707-3b0a-5c03c8621271",
"outputs": {}, "outputs": {},
"resources": [] "resources": [
{
"mode": "data",
"type": "digitalocean_project",
"name": "advancedlsa",
"provider": "provider[\"registry.terraform.io/digitalocean/digitalocean\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"created_at": "2021-09-19T03:03:37Z",
"description": "",
"environment": "Development",
"id": "a6b1a713-5a17-40d7-bed1-af2a22d0cd98",
"is_default": false,
"name": "advanced linux sysadmin",
"owner_id": 257793,
"owner_uuid": "797bee93c6f37b206a6194466f1a107df45998a8",
"purpose": "book",
"resources": [
"do:droplet:270868749",
"do:droplet:270868750"
],
"updated_at": "2021-09-19T03:26:37Z"
},
"sensitive_attributes": []
}
]
},
{
"mode": "data",
"type": "digitalocean_ssh_key",
"name": "terraform",
"provider": "provider[\"registry.terraform.io/digitalocean/digitalocean\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"fingerprint": "c5:82:99:8d:c3:e8:f0:dd:ef:81:3c:6e:72:a8:e4:43",
"id": "31322665",
"name": "advancedlsa-ed25519",
"public_key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINjvRik77vZm9Uy8mxnQakfsWLrkpwYLoVT/TdxScoWj advancedlsa_terraform\n"
},
"sensitive_attributes": []
}
]
},
{
"mode": "managed",
"type": "digitalocean_droplet",
"name": "openstackaio-1",
"provider": "provider[\"registry.terraform.io/digitalocean/digitalocean\"]",
"instances": [
{
"schema_version": 1,
"attributes": {
"backups": false,
"created_at": "2021-10-25T23:28:00Z",
"disk": 100,
"id": "270868749",
"image": "rockylinux-8-x64",
"ipv4_address": "165.227.116.131",
"ipv4_address_private": "10.132.0.4",
"ipv6": false,
"ipv6_address": "",
"ipv6_address_private": null,
"locked": false,
"memory": 32768,
"monitoring": false,
"name": "openstackaio-1",
"price_hourly": 0.35714,
"price_monthly": 240,
"private_networking": true,
"region": "nyc3",
"resize_disk": true,
"size": "g-8vcpu-32gb",
"ssh_keys": [
"31322665"
],
"status": "active",
"tags": [],
"urn": "do:droplet:270868749",
"user_data": null,
"vcpus": 8,
"volume_ids": [
"313c90cd-35eb-11ec-864d-0a58ac147386"
],
"vpc_uuid": "9be75620-dc84-11e8-80bc-3cfdfea9fba1"
},
"sensitive_attributes": [],
"private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ==",
"dependencies": [
"data.digitalocean_ssh_key.terraform"
]
}
]
},
{
"mode": "managed",
"type": "digitalocean_droplet",
"name": "openstackaio-2",
"provider": "provider[\"registry.terraform.io/digitalocean/digitalocean\"]",
"instances": [
{
"schema_version": 1,
"attributes": {
"backups": false,
"created_at": "2021-10-25T23:28:00Z",
"disk": 100,
"id": "270868750",
"image": "rockylinux-8-x64",
"ipv4_address": "165.227.125.187",
"ipv4_address_private": "10.132.0.5",
"ipv6": false,
"ipv6_address": "",
"ipv6_address_private": null,
"locked": false,
"memory": 32768,
"monitoring": false,
"name": "openstackaio-2",
"price_hourly": 0.35714,
"price_monthly": 240,
"private_networking": true,
"region": "nyc3",
"resize_disk": true,
"size": "g-8vcpu-32gb",
"ssh_keys": [
"31322665"
],
"status": "active",
"tags": [],
"urn": "do:droplet:270868750",
"user_data": null,
"vcpus": 8,
"volume_ids": [],
"vpc_uuid": "9be75620-dc84-11e8-80bc-3cfdfea9fba1"
},
"sensitive_attributes": [],
"private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ==",
"dependencies": [
"data.digitalocean_ssh_key.terraform"
]
}
]
},
{
"mode": "managed",
"type": "digitalocean_droplet",
"name": "openstackaio-3",
"provider": "provider[\"registry.terraform.io/digitalocean/digitalocean\"]",
"instances": [
{
"schema_version": 1,
"attributes": {
"backups": false,
"created_at": "2021-10-26T01:32:25Z",
"disk": 100,
"id": "270879028",
"image": "rockylinux-8-x64",
"ipv4_address": "159.65.37.160",
"ipv4_address_private": "10.132.0.6",
"ipv6": false,
"ipv6_address": "",
"ipv6_address_private": null,
"locked": false,
"memory": 32768,
"monitoring": false,
"name": "openstackaio-3",
"price_hourly": 0.35714,
"price_monthly": 240,
"private_networking": true,
"region": "nyc3",
"resize_disk": true,
"size": "g-8vcpu-32gb",
"ssh_keys": [
"31322665"
],
"status": "active",
"tags": null,
"urn": "do:droplet:270879028",
"user_data": null,
"vcpus": 8,
"volume_ids": [],
"vpc_uuid": "9be75620-dc84-11e8-80bc-3cfdfea9fba1"
},
"sensitive_attributes": [],
"private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ==",
"dependencies": [
"data.digitalocean_ssh_key.terraform"
]
}
]
},
{
"mode": "managed",
"type": "digitalocean_project_resources",
"name": "openstackaio-1",
"provider": "provider[\"registry.terraform.io/digitalocean/digitalocean\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"id": "a6b1a713-5a17-40d7-bed1-af2a22d0cd98",
"project": "a6b1a713-5a17-40d7-bed1-af2a22d0cd98",
"resources": [
"do:droplet:270868749",
"do:volume:313c90cd-35eb-11ec-864d-0a58ac147386"
]
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"data.digitalocean_project.advancedlsa",
"digitalocean_droplet.openstackaio-1",
"digitalocean_volume.openstackdata"
]
}
]
},
{
"mode": "managed",
"type": "digitalocean_project_resources",
"name": "openstackaio-2",
"provider": "provider[\"registry.terraform.io/digitalocean/digitalocean\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"id": "a6b1a713-5a17-40d7-bed1-af2a22d0cd98",
"project": "a6b1a713-5a17-40d7-bed1-af2a22d0cd98",
"resources": [
"do:droplet:270868750",
"do:volume:313c90cd-35eb-11ec-864d-0a58ac147386"
]
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"data.digitalocean_project.advancedlsa",
"digitalocean_droplet.openstackaio-2",
"digitalocean_volume.openstackdata"
]
}
]
},
{
"mode": "managed",
"type": "digitalocean_project_resources",
"name": "openstackaio-3",
"provider": "provider[\"registry.terraform.io/digitalocean/digitalocean\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"id": "a6b1a713-5a17-40d7-bed1-af2a22d0cd98",
"project": "a6b1a713-5a17-40d7-bed1-af2a22d0cd98",
"resources": [
"do:droplet:270879028",
"do:volume:313c90cd-35eb-11ec-864d-0a58ac147386"
]
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"data.digitalocean_project.advancedlsa",
"data.digitalocean_ssh_key.terraform",
"digitalocean_droplet.openstackaio-3",
"digitalocean_volume.openstackdata"
]
}
]
},
{
"mode": "managed",
"type": "digitalocean_volume",
"name": "openstackdata",
"provider": "provider[\"registry.terraform.io/digitalocean/digitalocean\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"description": "volume for openstack shit",
"droplet_ids": [
270868749
],
"filesystem_label": null,
"filesystem_type": "xfs",
"id": "313c90cd-35eb-11ec-864d-0a58ac147386",
"initial_filesystem_label": null,
"initial_filesystem_type": "xfs",
"name": "kvmdata",
"region": "nyc3",
"size": 100,
"snapshot_id": null,
"tags": [],
"urn": "do:volume:313c90cd-35eb-11ec-864d-0a58ac147386"
},
"sensitive_attributes": [],
"private": "bnVsbA=="
}
]
},
{
"mode": "managed",
"type": "digitalocean_volume_attachment",
"name": "openstackaio_volume1",
"provider": "provider[\"registry.terraform.io/digitalocean/digitalocean\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"droplet_id": 270868749,
"id": "270868749-313c90cd-35eb-11ec-864d-0a58ac147386-20211025233131950500000001",
"volume_id": "313c90cd-35eb-11ec-864d-0a58ac147386"
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"data.digitalocean_ssh_key.terraform",
"digitalocean_droplet.openstackaio-1",
"digitalocean_volume.openstackdata"
]
}
]
}
]
} }

View File

@ -1,7 +1,7 @@
{ {
"version": 4, "version": 4,
"terraform_version": "1.0.8", "terraform_version": "1.0.8",
"serial": 65, "serial": 79,
"lineage": "9cbca1f8-8910-c707-3b0a-5c03c8621271", "lineage": "9cbca1f8-8910-c707-3b0a-5c03c8621271",
"outputs": {}, "outputs": {},
"resources": [ "resources": [
@ -58,11 +58,11 @@
"schema_version": 1, "schema_version": 1,
"attributes": { "attributes": {
"backups": false, "backups": false,
"created_at": "2021-10-25T01:09:36Z", "created_at": "2021-10-25T23:28:00Z",
"disk": 100, "disk": 100,
"id": "270730066", "id": "270868749",
"image": "rockylinux-8-x64", "image": "rockylinux-8-x64",
"ipv4_address": "165.227.69.34", "ipv4_address": "165.227.116.131",
"ipv4_address_private": "10.132.0.4", "ipv4_address_private": "10.132.0.4",
"ipv6": false, "ipv6": false,
"ipv6_address": "", "ipv6_address": "",
@ -82,7 +82,55 @@
], ],
"status": "active", "status": "active",
"tags": null, "tags": null,
"urn": "do:droplet:270730066", "urn": "do:droplet:270868749",
"user_data": null,
"vcpus": 8,
"volume_ids": [],
"vpc_uuid": "9be75620-dc84-11e8-80bc-3cfdfea9fba1"
},
"sensitive_attributes": [],
"private": "eyJzY2hlbWFfdmVyc2lvbiI6IjEifQ==",
"dependencies": [
"data.digitalocean_ssh_key.terraform"
]
}
]
},
{
"mode": "managed",
"type": "digitalocean_droplet",
"name": "openstackaio-2",
"provider": "provider[\"registry.terraform.io/digitalocean/digitalocean\"]",
"instances": [
{
"schema_version": 1,
"attributes": {
"backups": false,
"created_at": "2021-10-25T23:28:00Z",
"disk": 100,
"id": "270868750",
"image": "rockylinux-8-x64",
"ipv4_address": "165.227.125.187",
"ipv4_address_private": "10.132.0.5",
"ipv6": false,
"ipv6_address": "",
"ipv6_address_private": null,
"locked": false,
"memory": 32768,
"monitoring": false,
"name": "openstackaio-2",
"price_hourly": 0.35714,
"price_monthly": 240,
"private_networking": true,
"region": "nyc3",
"resize_disk": true,
"size": "g-8vcpu-32gb",
"ssh_keys": [
"31322665"
],
"status": "active",
"tags": null,
"urn": "do:droplet:270868750",
"user_data": null, "user_data": null,
"vcpus": 8, "vcpus": 8,
"volume_ids": [], "volume_ids": [],
@ -108,8 +156,8 @@
"id": "a6b1a713-5a17-40d7-bed1-af2a22d0cd98", "id": "a6b1a713-5a17-40d7-bed1-af2a22d0cd98",
"project": "a6b1a713-5a17-40d7-bed1-af2a22d0cd98", "project": "a6b1a713-5a17-40d7-bed1-af2a22d0cd98",
"resources": [ "resources": [
"do:droplet:270730066", "do:droplet:270868749",
"do:volume:38c6ab8b-3530-11ec-864d-0a58ac147386" "do:volume:313c90cd-35eb-11ec-864d-0a58ac147386"
] ]
}, },
"sensitive_attributes": [], "sensitive_attributes": [],
@ -123,6 +171,33 @@
} }
] ]
}, },
{
"mode": "managed",
"type": "digitalocean_project_resources",
"name": "openstackaio-2",
"provider": "provider[\"registry.terraform.io/digitalocean/digitalocean\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"id": "a6b1a713-5a17-40d7-bed1-af2a22d0cd98",
"project": "a6b1a713-5a17-40d7-bed1-af2a22d0cd98",
"resources": [
"do:droplet:270868750",
"do:volume:313c90cd-35eb-11ec-864d-0a58ac147386"
]
},
"sensitive_attributes": [],
"private": "bnVsbA==",
"dependencies": [
"data.digitalocean_project.advancedlsa",
"data.digitalocean_ssh_key.terraform",
"digitalocean_droplet.openstackaio-2",
"digitalocean_volume.openstackdata"
]
}
]
},
{ {
"mode": "managed", "mode": "managed",
"type": "digitalocean_volume", "type": "digitalocean_volume",
@ -136,7 +211,7 @@
"droplet_ids": [], "droplet_ids": [],
"filesystem_label": null, "filesystem_label": null,
"filesystem_type": "xfs", "filesystem_type": "xfs",
"id": "38c6ab8b-3530-11ec-864d-0a58ac147386", "id": "313c90cd-35eb-11ec-864d-0a58ac147386",
"initial_filesystem_label": null, "initial_filesystem_label": null,
"initial_filesystem_type": "xfs", "initial_filesystem_type": "xfs",
"name": "kvmdata", "name": "kvmdata",
@ -144,7 +219,7 @@
"size": 100, "size": 100,
"snapshot_id": null, "snapshot_id": null,
"tags": null, "tags": null,
"urn": "do:volume:38c6ab8b-3530-11ec-864d-0a58ac147386" "urn": "do:volume:313c90cd-35eb-11ec-864d-0a58ac147386"
}, },
"sensitive_attributes": [], "sensitive_attributes": [],
"private": "bnVsbA==" "private": "bnVsbA=="
@ -160,9 +235,9 @@
{ {
"schema_version": 0, "schema_version": 0,
"attributes": { "attributes": {
"droplet_id": 270730066, "droplet_id": 270868749,
"id": "270730066-38c6ab8b-3530-11ec-864d-0a58ac147386-20211025011232355200000001", "id": "270868749-313c90cd-35eb-11ec-864d-0a58ac147386-20211025233131950500000001",
"volume_id": "38c6ab8b-3530-11ec-864d-0a58ac147386" "volume_id": "313c90cd-35eb-11ec-864d-0a58ac147386"
}, },
"sensitive_attributes": [], "sensitive_attributes": [],
"private": "bnVsbA==", "private": "bnVsbA==",