96 lines
2.3 KiB
YAML
96 lines
2.3 KiB
YAML
|
---
|
||
|
parameters:
|
||
|
target:
|
||
|
type: String
|
||
|
description: "Target host to create the VM on"
|
||
|
default: "roscoe"
|
||
|
iso_path:
|
||
|
type: String
|
||
|
description: "Path to the ISO file"
|
||
|
default: "/mnt/nfs/kvm-isos/iso-build/ubuntu-22.04-autoinstall.iso"
|
||
|
vm_name:
|
||
|
type: String
|
||
|
description: "Name of the VM"
|
||
|
default: "vm-template-staging"
|
||
|
ram:
|
||
|
type: Integer
|
||
|
description: "Amount of RAM in MB"
|
||
|
default: 2048
|
||
|
vcpus:
|
||
|
type: Integer
|
||
|
description: "Number of virtual CPUs"
|
||
|
default: 4
|
||
|
disk_size:
|
||
|
type: Integer
|
||
|
description: "Size of the disk in GB"
|
||
|
default: 100
|
||
|
disk_path:
|
||
|
type: String
|
||
|
description: "Base path for disk images"
|
||
|
default: "/mnt/nfs/kvm-images"
|
||
|
network:
|
||
|
type: String
|
||
|
description: "Network to connect the VM to"
|
||
|
default: "wan-verizon"
|
||
|
ip_with_cidr:
|
||
|
type: String
|
||
|
description: "Public IP of the VM"
|
||
|
default: "100.40.223.190/24"
|
||
|
hostname:
|
||
|
type: String
|
||
|
description: "Hostname of the VM"
|
||
|
default: "vm-template-staging"
|
||
|
dhcp:
|
||
|
type: Boolean
|
||
|
description: "Enable DHCP on the VM"
|
||
|
default: false
|
||
|
gateway:
|
||
|
type: String
|
||
|
description: "Gateway for the VM"
|
||
|
default: "100.40.223.1"
|
||
|
nameserver1:
|
||
|
type: String
|
||
|
description: "Primary nameserver for the VM"
|
||
|
default: "8.8.8.8"
|
||
|
nameserver2:
|
||
|
type: String
|
||
|
description: "Secondary nameserver for the VM"
|
||
|
default: "8.8.4.4"
|
||
|
nameserver3:
|
||
|
type: String
|
||
|
description: "Tertiary nameserver for the VM"
|
||
|
default: "1.1.1.1"
|
||
|
|
||
|
steps:
|
||
|
- name: create_vm
|
||
|
task: bolt_vm_automation::create_vm
|
||
|
targets: $target
|
||
|
parameters:
|
||
|
iso_path: $iso_path
|
||
|
vm_name: $vm_name
|
||
|
ram: $ram
|
||
|
vcpus: $vcpus
|
||
|
disk_size: $disk_size
|
||
|
disk_path: "${disk_path}/${vm_name}.qcow2"
|
||
|
network: $network
|
||
|
|
||
|
- name: install_docker
|
||
|
description: Install Docker on the VM
|
||
|
task: bolt_vm_automation::install_docker
|
||
|
targets: vm-template-staging
|
||
|
|
||
|
- name: system_setup
|
||
|
task: bolt_vm_automation::system_setup
|
||
|
targets: vm-template-staging
|
||
|
parameters:
|
||
|
ip_with_cidr: $ip_with_cidr
|
||
|
hostname: $hostname
|
||
|
dhcp: $dhcp
|
||
|
gateway: $gateway
|
||
|
nameserver1: $nameserver1
|
||
|
nameserver2: $nameserver2
|
||
|
nameserver3: $nameserver3
|
||
|
|
||
|
return:
|
||
|
message: "VM ${vm_name} created and updated successfully!"
|