diff --git a/terraform/resourse2.tf b/terraform/resourse2.tf new file mode 100644 index 0000000..af6ca2e --- /dev/null +++ b/terraform/resourse2.tf @@ -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 + ] +} + diff --git a/terraform/resourse3.tf b/terraform/resourse3.tf new file mode 100644 index 0000000..266b9cd --- /dev/null +++ b/terraform/resourse3.tf @@ -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 + ] +} + diff --git a/terraform/terraform.tfstate b/terraform/terraform.tfstate index a5110bc..2c94049 100644 --- a/terraform/terraform.tfstate +++ b/terraform/terraform.tfstate @@ -1,8 +1,333 @@ { "version": 4, "terraform_version": "1.0.8", - "serial": 72, + "serial": 84, "lineage": "9cbca1f8-8910-c707-3b0a-5c03c8621271", "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" + ] + } + ] + } + ] } diff --git a/terraform/terraform.tfstate.backup b/terraform/terraform.tfstate.backup index 9de7e68..eda28c8 100644 --- a/terraform/terraform.tfstate.backup +++ b/terraform/terraform.tfstate.backup @@ -1,7 +1,7 @@ { "version": 4, "terraform_version": "1.0.8", - "serial": 65, + "serial": 79, "lineage": "9cbca1f8-8910-c707-3b0a-5c03c8621271", "outputs": {}, "resources": [ @@ -58,11 +58,11 @@ "schema_version": 1, "attributes": { "backups": false, - "created_at": "2021-10-25T01:09:36Z", + "created_at": "2021-10-25T23:28:00Z", "disk": 100, - "id": "270730066", + "id": "270868749", "image": "rockylinux-8-x64", - "ipv4_address": "165.227.69.34", + "ipv4_address": "165.227.116.131", "ipv4_address_private": "10.132.0.4", "ipv6": false, "ipv6_address": "", @@ -82,7 +82,55 @@ ], "status": "active", "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, "vcpus": 8, "volume_ids": [], @@ -108,8 +156,8 @@ "id": "a6b1a713-5a17-40d7-bed1-af2a22d0cd98", "project": "a6b1a713-5a17-40d7-bed1-af2a22d0cd98", "resources": [ - "do:droplet:270730066", - "do:volume:38c6ab8b-3530-11ec-864d-0a58ac147386" + "do:droplet:270868749", + "do:volume:313c90cd-35eb-11ec-864d-0a58ac147386" ] }, "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", "type": "digitalocean_volume", @@ -136,7 +211,7 @@ "droplet_ids": [], "filesystem_label": null, "filesystem_type": "xfs", - "id": "38c6ab8b-3530-11ec-864d-0a58ac147386", + "id": "313c90cd-35eb-11ec-864d-0a58ac147386", "initial_filesystem_label": null, "initial_filesystem_type": "xfs", "name": "kvmdata", @@ -144,7 +219,7 @@ "size": 100, "snapshot_id": null, "tags": null, - "urn": "do:volume:38c6ab8b-3530-11ec-864d-0a58ac147386" + "urn": "do:volume:313c90cd-35eb-11ec-864d-0a58ac147386" }, "sensitive_attributes": [], "private": "bnVsbA==" @@ -160,9 +235,9 @@ { "schema_version": 0, "attributes": { - "droplet_id": 270730066, - "id": "270730066-38c6ab8b-3530-11ec-864d-0a58ac147386-20211025011232355200000001", - "volume_id": "38c6ab8b-3530-11ec-864d-0a58ac147386" + "droplet_id": 270868749, + "id": "270868749-313c90cd-35eb-11ec-864d-0a58ac147386-20211025233131950500000001", + "volume_id": "313c90cd-35eb-11ec-864d-0a58ac147386" }, "sensitive_attributes": [], "private": "bnVsbA==",