diff --git a/maas/arif-home/00-machines.tf b/maas/arif-home/00-machines.tf new file mode 100644 index 0000000..3043a35 --- /dev/null +++ b/maas/arif-home/00-machines.tf @@ -0,0 +1,14 @@ +resource "maas_machine" "asrock_machines" { + + for_each = { + for index, asrock_machines in var.asrock_machines: + asrock_machines.host_name => asrock_machines + } + + power_parameters = {} + + power_type = each.value.power_type + pxe_mac_address = each.value.mac_addr + hostname = each.value.host_name + zone = each.value.host_name +} diff --git a/maas/arif-home/00-variables.tf b/maas/arif-home/00-variables.tf index 7e47cb4..ec9fb0c 100644 --- a/maas/arif-home/00-variables.tf +++ b/maas/arif-home/00-variables.tf @@ -13,3 +13,11 @@ variable "spaces" { })) })) } + +variable "asrock_machines" { + type = list(object({ + host_name = string + power_type = string + mac_addr = string + })) +} diff --git a/maas/arif-home/00-vlans.tf b/maas/arif-home/00-vlans.tf index 186a7f5..2cd91b3 100644 --- a/maas/arif-home/00-vlans.tf +++ b/maas/arif-home/00-vlans.tf @@ -51,6 +51,6 @@ resource "maas_subnet_ip_range" "dynamic_ip_ranges" { type = each.value.type start_ip = each.value.start_ip end_ip = each.value.end_ip - comment = each.value.comment + comment = each.value.comment == "Dynamic"?"":each.value.comment } diff --git a/maas/arif-home/terraform.tfvars b/maas/arif-home/terraform.tfvars index 21a9e80..9b89340 100644 --- a/maas/arif-home/terraform.tfvars +++ b/maas/arif-home/terraform.tfvars @@ -143,5 +143,36 @@ spaces = [ comment = "Servers" } ] + }, + { + space="add-new-test", + vid=306, + cidr="10.0.7.0/24", + mtu=1500, + managed=true, + ip_range = [] + } +] + +asrock_machines = [ + { + host_name = "asrock01" + power_type = "manual", + mac_addr = "a8:a1:59:44:70:ac" + }, + { + host_name = "asrock02" + power_type = "manual", + mac_addr = "a8:a1:59:44:76:79" + }, + { + host_name = "asrock03" + power_type = "manual", + mac_addr = "a8:a1:59:44:73:f0" + }, + { + host_name = "asrock04" + power_type = "manual", + mac_addr = "a8:a1:59:e4:92:b8" } ] diff --git a/maas/init.tf b/maas/init.tf index d0a1a67..1d18a6b 100644 --- a/maas/init.tf +++ b/maas/init.tf @@ -9,6 +9,6 @@ terraform { provider "maas" { api_version = "2.0" - api_key = "cP5gj8RyemEhBLvyKG:AmRXEzR8MPAbRPWGBH:7T9LPemF3gAPe3qwr47rXAkLWZysjeRB" + api_key = "yvjRUz4B4FJtpC99Dc:gBSmTpFttb7x2WDkBD:jdWhHVBBGGu5D2vVtzMK3ks9fNTk9YuJ" api_url = "http://10.0.1.253:5240/MAAS" } diff --git a/openstack/stsstack_init/01-default-networks.tf b/openstack/stsstack_init/01-default-networks.tf index 80c6b69..6d9c023 100644 --- a/openstack/stsstack_init/01-default-networks.tf +++ b/openstack/stsstack_init/01-default-networks.tf @@ -26,8 +26,8 @@ resource "openstack_networking_subnet_v2" "ext_net_subnet" { ] allocation_pool { - start = "192.168.1.42" - end = "192.168.1.79" + start = "192.168.1.40" + end = "192.168.1.69" } }