From 50d0b3b87e085e9d8dadeda24885e8a3ed286d84 Mon Sep 17 00:00:00 2001 From: "Antoine R. Dumont (@ardumont)" <antoine.romain.dumont@gmail.com> Date: Thu, 1 Aug 2019 10:21:43 +0200 Subject: [PATCH] staging: Install storage0 vm This provisions the storage node and for the first time, will trigger a puppet run. This puppet run will install the storage's role including. Its network paquets coming through the gateway to access everything. Related T1785 Depends on D1796 Related D1762 --- proxmox/terraform/staging.tf | 56 ++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/proxmox/terraform/staging.tf b/proxmox/terraform/staging.tf index ec101ad..a1085db 100644 --- a/proxmox/terraform/staging.tf +++ b/proxmox/terraform/staging.tf @@ -112,3 +112,59 @@ resource "proxmox_vm_qemu" "gateway" { ] } } + +resource "proxmox_vm_qemu" "storage" { + name = "storage0" + desc = "swh storage node" + # hypervisor onto which make the vm + target_node = "orsay" + # See init-template.md to see the template vm bootstrap + clone = "template-debian-9" + # linux kernel 2.6 + qemu_os = "l26" + # generic setup + sockets = 1 + cores = 2 + memory = 8192 + # boot machine when hypervirsor starts + onboot = true + #### cloud-init setup + # to actually set some information per os_type (values: ubuntu, centos, + # cloud-init). Keep this as cloud-init + os_type = "cloud-init" + # ciuser - User name to change ssh keys and password for instead of the + # image’s configured default user. + ciuser = "${var.user_admin}" + # searchdomain - Sets DNS search domains for a container. + searchdomain = "${var.domain}" + # nameserver - Sets DNS server IP address for a container. + nameserver = "${var.dns}" + # sshkeys - public ssh keys, one per line + sshkeys = "${var.ssh_key_data}" + # ipconfig0 - [gw =] [,ip=<IPv4Format/CIDR>] + ipconfig0 = "ip=192.168.128.2/24,gw=${var.gateway_ip}" + ssh_user = "${var.user_admin}" + disk { + id = 0 + type = "virtio" + storage = "orsay-ssd-2018" + storage_type = "ssd" + size = "32G" + } + network { + id = 0 + model = "virtio" + bridge = "vmbr0" + macaddr = "CA:73:7F:ED:F9:01" + } + + # Delegate to puppet at the end of the provisioning the software setup + provisioner "remote-exec" { + inline = [ + "sed -i 's/127.0.1.1/192.168.128.2/g' /etc/hosts", + "puppet agent --server ${var.puppet_master} --environment=${var.puppet_environment} --waitforcert 60 --test || echo 'Node provisionned!'", + ] + } + # forced to specify as there is no way to introspect the gateway's ip + depends_on = ["proxmox_vm_qemu.gateway"] +} -- GitLab