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_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")
|
||||
vars = {
|
||||
skylab-ssh-public-key = trimspace(var.skylab_ssh_public_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-ssh-private-key = indent(6, trimspace(var.azure_ssh_private_key))
|
||||
# azure-vm-ip = azurerm_linux_virtual_machine.week-6.public_ip_address
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,109 +40,109 @@ resource "esxi_guest" "week-6" {
|
||||
|
||||
# Azure
|
||||
|
||||
resource "azurerm_virtual_network" "week-6" {
|
||||
name = "${var.prefix}-network"
|
||||
address_space = ["10.0.0.0/16"]
|
||||
location = var.azure_location
|
||||
resource_group_name = var.azure_resourcegroup
|
||||
}
|
||||
# resource "azurerm_virtual_network" "week-6" {
|
||||
# name = "${var.prefix}-network"
|
||||
# address_space = ["10.0.0.0/16"]
|
||||
# location = var.azure_location
|
||||
# resource_group_name = var.azure_resourcegroup
|
||||
# }
|
||||
|
||||
resource "azurerm_subnet" "week-6" {
|
||||
name = "internal"
|
||||
resource_group_name = var.azure_resourcegroup
|
||||
virtual_network_name = azurerm_virtual_network.week-6.name
|
||||
address_prefixes = ["10.0.2.0/24"]
|
||||
}
|
||||
# resource "azurerm_subnet" "week-6" {
|
||||
# name = "internal"
|
||||
# resource_group_name = var.azure_resourcegroup
|
||||
# virtual_network_name = azurerm_virtual_network.week-6.name
|
||||
# address_prefixes = ["10.0.2.0/24"]
|
||||
# }
|
||||
|
||||
resource "azurerm_public_ip" "week-6" {
|
||||
name = "${var.prefix}-pip"
|
||||
resource_group_name = var.azure_resourcegroup
|
||||
location = var.azure_location
|
||||
allocation_method = "Static"
|
||||
}
|
||||
# resource "azurerm_public_ip" "week-6" {
|
||||
# name = "${var.prefix}-pip"
|
||||
# resource_group_name = var.azure_resourcegroup
|
||||
# location = var.azure_location
|
||||
# allocation_method = "Static"
|
||||
# }
|
||||
|
||||
resource "azurerm_network_interface" "week-6" {
|
||||
name = "${var.prefix}-nic"
|
||||
location = var.azure_location
|
||||
resource_group_name = var.azure_resourcegroup
|
||||
# resource "azurerm_network_interface" "week-6" {
|
||||
# name = "${var.prefix}-nic"
|
||||
# location = var.azure_location
|
||||
# resource_group_name = var.azure_resourcegroup
|
||||
|
||||
ip_configuration {
|
||||
name = "internal"
|
||||
subnet_id = azurerm_subnet.week-6.id
|
||||
private_ip_address_allocation = "Dynamic"
|
||||
public_ip_address_id = azurerm_public_ip.week-6.id
|
||||
}
|
||||
}
|
||||
# ip_configuration {
|
||||
# name = "internal"
|
||||
# subnet_id = azurerm_subnet.week-6.id
|
||||
# private_ip_address_allocation = "Dynamic"
|
||||
# public_ip_address_id = azurerm_public_ip.week-6.id
|
||||
# }
|
||||
# }
|
||||
|
||||
resource "azurerm_network_security_group" "week-6" {
|
||||
name = "${var.prefix}-nsg"
|
||||
location = var.azure_location
|
||||
resource_group_name = var.azure_resourcegroup
|
||||
security_rule {
|
||||
access = "Allow"
|
||||
direction = "Inbound"
|
||||
name = "tls"
|
||||
priority = 100
|
||||
protocol = "Tcp"
|
||||
source_port_range = "*"
|
||||
source_address_prefix = "*"
|
||||
destination_port_range = "22"
|
||||
destination_address_prefix = azurerm_network_interface.week-6.private_ip_address
|
||||
}
|
||||
}
|
||||
# resource "azurerm_network_security_group" "week-6" {
|
||||
# name = "${var.prefix}-nsg"
|
||||
# location = var.azure_location
|
||||
# resource_group_name = var.azure_resourcegroup
|
||||
# security_rule {
|
||||
# access = "Allow"
|
||||
# direction = "Inbound"
|
||||
# name = "tls"
|
||||
# priority = 100
|
||||
# protocol = "Tcp"
|
||||
# source_port_range = "*"
|
||||
# source_address_prefix = "*"
|
||||
# destination_port_range = "22"
|
||||
# destination_address_prefix = azurerm_network_interface.week-6.private_ip_address
|
||||
# }
|
||||
# }
|
||||
|
||||
resource "azurerm_network_interface_security_group_association" "week-6" {
|
||||
network_interface_id = azurerm_network_interface.week-6.id
|
||||
network_security_group_id = azurerm_network_security_group.week-6.id
|
||||
}
|
||||
# resource "azurerm_network_interface_security_group_association" "week-6" {
|
||||
# network_interface_id = azurerm_network_interface.week-6.id
|
||||
# network_security_group_id = azurerm_network_security_group.week-6.id
|
||||
# }
|
||||
|
||||
# Render userdata template with skylab SSH key
|
||||
data "template_file" "azure_cloudinit" {
|
||||
template = file("${path.module}/cloudinit-azure.yaml")
|
||||
vars = {
|
||||
hostname = var.prefix
|
||||
azure_ssh_public_key = trimspace(var.azure_ssh_public_key)
|
||||
}
|
||||
}
|
||||
# # Render userdata template with skylab SSH key
|
||||
# data "template_file" "azure_cloudinit" {
|
||||
# template = file("${path.module}/cloudinit-azure.yaml")
|
||||
# vars = {
|
||||
# hostname = var.prefix
|
||||
# azure_ssh_public_key = trimspace(var.azure_ssh_public_key)
|
||||
# }
|
||||
# }
|
||||
|
||||
resource "azurerm_linux_virtual_machine" "week-6" {
|
||||
name = var.prefix
|
||||
location = var.azure_location
|
||||
resource_group_name = var.azure_resourcegroup
|
||||
network_interface_ids = [
|
||||
azurerm_network_interface.week-6.id,
|
||||
]
|
||||
size = "Standard_B2ats_v2"
|
||||
# resource "azurerm_linux_virtual_machine" "week-6" {
|
||||
# name = var.prefix
|
||||
# location = var.azure_location
|
||||
# resource_group_name = var.azure_resourcegroup
|
||||
# network_interface_ids = [
|
||||
# azurerm_network_interface.week-6.id,
|
||||
# ]
|
||||
# size = "Standard_B2ats_v2"
|
||||
|
||||
admin_username = "adminuser"
|
||||
admin_ssh_key {
|
||||
username = "adminuser"
|
||||
public_key = trimspace(var.azure_ssh_public_key)
|
||||
}
|
||||
# admin_username = "adminuser"
|
||||
# admin_ssh_key {
|
||||
# username = "adminuser"
|
||||
# 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 {
|
||||
caching = "ReadWrite"
|
||||
storage_account_type = "Standard_LRS"
|
||||
}
|
||||
# os_disk {
|
||||
# caching = "ReadWrite"
|
||||
# storage_account_type = "Standard_LRS"
|
||||
# }
|
||||
|
||||
source_image_reference {
|
||||
publisher = "Canonical"
|
||||
offer = "ubuntu-24_04-lts"
|
||||
sku = "server"
|
||||
version = "latest"
|
||||
}
|
||||
}
|
||||
# source_image_reference {
|
||||
# publisher = "Canonical"
|
||||
# offer = "ubuntu-24_04-lts"
|
||||
# sku = "server"
|
||||
# version = "latest"
|
||||
# }
|
||||
# }
|
||||
|
||||
locals {
|
||||
inventory = templatefile("${path.module}/ansible-inventory.tmpl", {
|
||||
esxi_name = esxi_guest.week-6.guest_name
|
||||
esxi_ip = esxi_guest.week-6.ip_address
|
||||
esxi_private_key_file = "~/.ssh/skylab"
|
||||
azure_name = azurerm_linux_virtual_machine.week-6.name
|
||||
azure_ip = azurerm_linux_virtual_machine.week-6.public_ip_address
|
||||
azure_private_key_file = "~/.ssh/azure"
|
||||
esxi_name = esxi_guest.week-6.guest_name
|
||||
esxi_ip = esxi_guest.week-6.ip_address
|
||||
esxi_private_key_file = "~/.ssh/skylab"
|
||||
# azure_name = azurerm_linux_virtual_machine.week-6.name
|
||||
# azure_ip = azurerm_linux_virtual_machine.week-6.public_ip_address
|
||||
# azure_private_key_file = "~/.ssh/azure"
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -5,23 +5,22 @@ users:
|
||||
- ${skylab-ssh-public-key}
|
||||
shell: /bin/bash
|
||||
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/azure
|
||||
content: |
|
||||
${azure-ssh-private-key}
|
||||
permissions: "0600"
|
||||
owner: testuser:testuser
|
||||
defer: true
|
||||
|
||||
- path: /home/testuser/.ssh/config
|
||||
content: |
|
||||
Host azurevm
|
||||
HostName ${azure-vm-ip}
|
||||
User testuser
|
||||
IdentityFile ~/.ssh/azure
|
||||
StrictHostKeyChecking no
|
||||
UserKnownHostsFile=/dev/null
|
||||
permissions: "0600"
|
||||
owner: testuser:testuser
|
||||
defer: true
|
||||
# - path: /home/testuser/.ssh/config
|
||||
# content: |
|
||||
# Host azurevm
|
||||
# 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