fix: remove azure from terraform
Some checks failed
Provision & Configure / Terraform Apply (push) Failing after 20s
Some checks failed
Provision & Configure / Terraform Apply (push) Failing after 20s
This commit is contained in:
@@ -1,5 +1,3 @@
|
|||||||
[esxi]
|
[esxi]
|
||||||
${esxi_name}-esxi ansible_host=${esxi_ip} ansible_user=testuser ansible_ssh_private_key_file=${esxi_private_key_file} ansible_ssh_common_args='-o StrictHostKeyChecking=no'
|
${esxi_name}-esxi ansible_host=${esxi_ip} ansible_user=testuser ansible_ssh_private_key_file=${esxi_private_key_file} ansible_ssh_common_args='-o StrictHostKeyChecking=no'
|
||||||
|
|
||||||
[azure]
|
|
||||||
${azure_name}-azure ansible_host=${azure_ip} ansible_user=testuser ansible_ssh_private_key_file=${azure_private_key_file} ansible_ssh_common_args='-o StrictHostKeyChecking=no'
|
|
||||||
|
5
terraform/ansible-inventory_with_azure.tmpl
Normal file
5
terraform/ansible-inventory_with_azure.tmpl
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
[esxi]
|
||||||
|
${esxi_name}-esxi ansible_host=${esxi_ip} ansible_user=testuser ansible_ssh_private_key_file=${esxi_private_key_file} ansible_ssh_common_args='-o StrictHostKeyChecking=no'
|
||||||
|
|
||||||
|
[azure]
|
||||||
|
${azure_name}-azure ansible_host=${azure_ip} ansible_user=testuser ansible_ssh_private_key_file=${azure_private_key_file} ansible_ssh_common_args='-o StrictHostKeyChecking=no'
|
@@ -4,8 +4,8 @@ data "template_file" "esxi_userdata" {
|
|||||||
template = file("${path.module}/userdata.tftpl")
|
template = file("${path.module}/userdata.tftpl")
|
||||||
vars = {
|
vars = {
|
||||||
skylab-ssh-public-key = trimspace(var.skylab_ssh_public_key)
|
skylab-ssh-public-key = trimspace(var.skylab_ssh_public_key)
|
||||||
azure-ssh-private-key = indent(6, trimspace(var.azure_ssh_private_key))
|
# azure-ssh-private-key = indent(6, trimspace(var.azure_ssh_private_key))
|
||||||
azure-vm-ip = azurerm_linux_virtual_machine.week-6.public_ip_address
|
# azure-vm-ip = azurerm_linux_virtual_machine.week-6.public_ip_address
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,109 +40,109 @@ resource "esxi_guest" "week-6" {
|
|||||||
|
|
||||||
# Azure
|
# Azure
|
||||||
|
|
||||||
resource "azurerm_virtual_network" "week-6" {
|
# resource "azurerm_virtual_network" "week-6" {
|
||||||
name = "${var.prefix}-network"
|
# name = "${var.prefix}-network"
|
||||||
address_space = ["10.0.0.0/16"]
|
# address_space = ["10.0.0.0/16"]
|
||||||
location = var.azure_location
|
# location = var.azure_location
|
||||||
resource_group_name = var.azure_resourcegroup
|
# resource_group_name = var.azure_resourcegroup
|
||||||
}
|
# }
|
||||||
|
|
||||||
resource "azurerm_subnet" "week-6" {
|
# resource "azurerm_subnet" "week-6" {
|
||||||
name = "internal"
|
# name = "internal"
|
||||||
resource_group_name = var.azure_resourcegroup
|
# resource_group_name = var.azure_resourcegroup
|
||||||
virtual_network_name = azurerm_virtual_network.week-6.name
|
# virtual_network_name = azurerm_virtual_network.week-6.name
|
||||||
address_prefixes = ["10.0.2.0/24"]
|
# address_prefixes = ["10.0.2.0/24"]
|
||||||
}
|
# }
|
||||||
|
|
||||||
resource "azurerm_public_ip" "week-6" {
|
# resource "azurerm_public_ip" "week-6" {
|
||||||
name = "${var.prefix}-pip"
|
# name = "${var.prefix}-pip"
|
||||||
resource_group_name = var.azure_resourcegroup
|
# resource_group_name = var.azure_resourcegroup
|
||||||
location = var.azure_location
|
# location = var.azure_location
|
||||||
allocation_method = "Static"
|
# allocation_method = "Static"
|
||||||
}
|
# }
|
||||||
|
|
||||||
resource "azurerm_network_interface" "week-6" {
|
# resource "azurerm_network_interface" "week-6" {
|
||||||
name = "${var.prefix}-nic"
|
# name = "${var.prefix}-nic"
|
||||||
location = var.azure_location
|
# location = var.azure_location
|
||||||
resource_group_name = var.azure_resourcegroup
|
# resource_group_name = var.azure_resourcegroup
|
||||||
|
|
||||||
ip_configuration {
|
# ip_configuration {
|
||||||
name = "internal"
|
# name = "internal"
|
||||||
subnet_id = azurerm_subnet.week-6.id
|
# subnet_id = azurerm_subnet.week-6.id
|
||||||
private_ip_address_allocation = "Dynamic"
|
# private_ip_address_allocation = "Dynamic"
|
||||||
public_ip_address_id = azurerm_public_ip.week-6.id
|
# public_ip_address_id = azurerm_public_ip.week-6.id
|
||||||
}
|
# }
|
||||||
}
|
# }
|
||||||
|
|
||||||
resource "azurerm_network_security_group" "week-6" {
|
# resource "azurerm_network_security_group" "week-6" {
|
||||||
name = "${var.prefix}-nsg"
|
# name = "${var.prefix}-nsg"
|
||||||
location = var.azure_location
|
# location = var.azure_location
|
||||||
resource_group_name = var.azure_resourcegroup
|
# resource_group_name = var.azure_resourcegroup
|
||||||
security_rule {
|
# security_rule {
|
||||||
access = "Allow"
|
# access = "Allow"
|
||||||
direction = "Inbound"
|
# direction = "Inbound"
|
||||||
name = "tls"
|
# name = "tls"
|
||||||
priority = 100
|
# priority = 100
|
||||||
protocol = "Tcp"
|
# protocol = "Tcp"
|
||||||
source_port_range = "*"
|
# source_port_range = "*"
|
||||||
source_address_prefix = "*"
|
# source_address_prefix = "*"
|
||||||
destination_port_range = "22"
|
# destination_port_range = "22"
|
||||||
destination_address_prefix = azurerm_network_interface.week-6.private_ip_address
|
# destination_address_prefix = azurerm_network_interface.week-6.private_ip_address
|
||||||
}
|
# }
|
||||||
}
|
# }
|
||||||
|
|
||||||
resource "azurerm_network_interface_security_group_association" "week-6" {
|
# resource "azurerm_network_interface_security_group_association" "week-6" {
|
||||||
network_interface_id = azurerm_network_interface.week-6.id
|
# network_interface_id = azurerm_network_interface.week-6.id
|
||||||
network_security_group_id = azurerm_network_security_group.week-6.id
|
# network_security_group_id = azurerm_network_security_group.week-6.id
|
||||||
}
|
# }
|
||||||
|
|
||||||
# Render userdata template with skylab SSH key
|
# # Render userdata template with skylab SSH key
|
||||||
data "template_file" "azure_cloudinit" {
|
# data "template_file" "azure_cloudinit" {
|
||||||
template = file("${path.module}/cloudinit-azure.yaml")
|
# template = file("${path.module}/cloudinit-azure.yaml")
|
||||||
vars = {
|
# vars = {
|
||||||
hostname = var.prefix
|
# hostname = var.prefix
|
||||||
azure_ssh_public_key = trimspace(var.azure_ssh_public_key)
|
# azure_ssh_public_key = trimspace(var.azure_ssh_public_key)
|
||||||
}
|
# }
|
||||||
}
|
# }
|
||||||
|
|
||||||
resource "azurerm_linux_virtual_machine" "week-6" {
|
# resource "azurerm_linux_virtual_machine" "week-6" {
|
||||||
name = var.prefix
|
# name = var.prefix
|
||||||
location = var.azure_location
|
# location = var.azure_location
|
||||||
resource_group_name = var.azure_resourcegroup
|
# resource_group_name = var.azure_resourcegroup
|
||||||
network_interface_ids = [
|
# network_interface_ids = [
|
||||||
azurerm_network_interface.week-6.id,
|
# azurerm_network_interface.week-6.id,
|
||||||
]
|
# ]
|
||||||
size = "Standard_B2ats_v2"
|
# size = "Standard_B2ats_v2"
|
||||||
|
|
||||||
admin_username = "adminuser"
|
# admin_username = "adminuser"
|
||||||
admin_ssh_key {
|
# admin_ssh_key {
|
||||||
username = "adminuser"
|
# username = "adminuser"
|
||||||
public_key = trimspace(var.azure_ssh_public_key)
|
# public_key = trimspace(var.azure_ssh_public_key)
|
||||||
}
|
# }
|
||||||
|
|
||||||
custom_data = base64encode(data.template_file.azure_cloudinit.rendered)
|
# custom_data = base64encode(data.template_file.azure_cloudinit.rendered)
|
||||||
|
|
||||||
os_disk {
|
# os_disk {
|
||||||
caching = "ReadWrite"
|
# caching = "ReadWrite"
|
||||||
storage_account_type = "Standard_LRS"
|
# storage_account_type = "Standard_LRS"
|
||||||
}
|
# }
|
||||||
|
|
||||||
source_image_reference {
|
# source_image_reference {
|
||||||
publisher = "Canonical"
|
# publisher = "Canonical"
|
||||||
offer = "ubuntu-24_04-lts"
|
# offer = "ubuntu-24_04-lts"
|
||||||
sku = "server"
|
# sku = "server"
|
||||||
version = "latest"
|
# version = "latest"
|
||||||
}
|
# }
|
||||||
}
|
# }
|
||||||
|
|
||||||
locals {
|
locals {
|
||||||
inventory = templatefile("${path.module}/ansible-inventory.tmpl", {
|
inventory = templatefile("${path.module}/ansible-inventory.tmpl", {
|
||||||
esxi_name = esxi_guest.week-6.guest_name
|
esxi_name = esxi_guest.week-6.guest_name
|
||||||
esxi_ip = esxi_guest.week-6.ip_address
|
esxi_ip = esxi_guest.week-6.ip_address
|
||||||
esxi_private_key_file = "~/.ssh/skylab"
|
esxi_private_key_file = "~/.ssh/skylab"
|
||||||
azure_name = azurerm_linux_virtual_machine.week-6.name
|
# azure_name = azurerm_linux_virtual_machine.week-6.name
|
||||||
azure_ip = azurerm_linux_virtual_machine.week-6.public_ip_address
|
# azure_ip = azurerm_linux_virtual_machine.week-6.public_ip_address
|
||||||
azure_private_key_file = "~/.ssh/azure"
|
# azure_private_key_file = "~/.ssh/azure"
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -5,23 +5,22 @@ users:
|
|||||||
- ${skylab-ssh-public-key}
|
- ${skylab-ssh-public-key}
|
||||||
shell: /bin/bash
|
shell: /bin/bash
|
||||||
sudo: ["ALL=(ALL) NOPASSWD:ALL"]
|
sudo: ["ALL=(ALL) NOPASSWD:ALL"]
|
||||||
|
# write_files:
|
||||||
|
# - path: /home/testuser/.ssh/azure
|
||||||
|
# content: |
|
||||||
|
# ${azure-ssh-private-key}
|
||||||
|
# permissions: "0600"
|
||||||
|
# owner: testuser:testuser
|
||||||
|
# defer: true
|
||||||
|
|
||||||
write_files:
|
# - path: /home/testuser/.ssh/config
|
||||||
- path: /home/testuser/.ssh/azure
|
# content: |
|
||||||
content: |
|
# Host azurevm
|
||||||
${azure-ssh-private-key}
|
# HostName ${azure-vm-ip}
|
||||||
permissions: "0600"
|
# User testuser
|
||||||
owner: testuser:testuser
|
# IdentityFile ~/.ssh/azure
|
||||||
defer: true
|
# StrictHostKeyChecking no
|
||||||
|
# UserKnownHostsFile=/dev/null
|
||||||
- path: /home/testuser/.ssh/config
|
# permissions: "0600"
|
||||||
content: |
|
# owner: testuser:testuser
|
||||||
Host azurevm
|
# defer: true
|
||||||
HostName ${azure-vm-ip}
|
|
||||||
User testuser
|
|
||||||
IdentityFile ~/.ssh/azure
|
|
||||||
StrictHostKeyChecking no
|
|
||||||
UserKnownHostsFile=/dev/null
|
|
||||||
permissions: "0600"
|
|
||||||
owner: testuser:testuser
|
|
||||||
defer: true
|
|
||||||
|
Reference in New Issue
Block a user