add vm provisioning
This commit is contained in:
parent
537beb7f67
commit
b012b010d5
@ -10,7 +10,7 @@ My homelab infrastructure as code
|
|||||||
Media Server
|
Media Server
|
||||||
* Requirements
|
* Requirements
|
||||||
* 4 core
|
* 4 core
|
||||||
* 8GB RAM
|
* 4GB RAM
|
||||||
* NVIDIA GPU
|
* NVIDIA GPU
|
||||||
* network storage for media
|
* network storage for media
|
||||||
|
|
||||||
|
@ -50,13 +50,13 @@ resource "proxmox_vm_qemu" "media-server" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
resource "proxmox_vm_qemu" "media-manager" {
|
resource "proxmox_vm_qemu" "media-manager" {
|
||||||
count = 1
|
count = 1
|
||||||
name = "media-manager"
|
name = "media-manager"
|
||||||
vmid = "201"
|
vmid = "201"
|
||||||
target_node = "milkyway"
|
target_node = "milkyway"
|
||||||
clone = "ubuntu-2004-cloud"
|
clone = "ubuntu-2004-cloud"
|
||||||
agent = 1
|
agent = 1
|
||||||
os_type = "cloud-init"
|
os_type = "cloud-init"
|
||||||
cores = 4
|
cores = 4
|
||||||
sockets = 1
|
sockets = 1
|
||||||
cpu = "host"
|
cpu = "host"
|
||||||
@ -85,4 +85,33 @@ resource "proxmox_vm_qemu" "media-manager" {
|
|||||||
ipconfig0 = "ip=192.168.0.51/24,gw=192.168.0.1"
|
ipconfig0 = "ip=192.168.0.51/24,gw=192.168.0.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resource "local_file" "ansible_inventory" {
|
||||||
|
content = templatefile("../../templates/hosts.tmpl",
|
||||||
|
{
|
||||||
|
media_managers = [
|
||||||
|
for ip in proxmox_vm_qemu.media-manager.*.ifconfig0 :
|
||||||
|
regex("(\\b25[0-5]|\\b2[0-4][0-9]|\\b[01]?[0-9][0-9]?)(\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}",
|
||||||
|
ip
|
||||||
|
)
|
||||||
|
]
|
||||||
|
media_servers = [
|
||||||
|
for ip in proxmox_vm_qemu.media-server.*.ifconfig0 :
|
||||||
|
regex("(\\b25[0-5]|\\b2[0-4][0-9]|\\b[01]?[0-9][0-9]?)(\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}",
|
||||||
|
ip
|
||||||
|
)
|
||||||
|
]
|
||||||
|
home_apps = [
|
||||||
|
for ip in proxmox_vm_qemu.main-docker.*.ifconfig0 :
|
||||||
|
regex("(\\b25[0-5]|\\b2[0-4][0-9]|\\b[01]?[0-9][0-9]?)(\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}",
|
||||||
|
ip
|
||||||
|
)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
filename = "../../applications/hosts"
|
||||||
|
|
||||||
|
depends_on = [
|
||||||
|
proxmox_vm_qemu.media-manager,
|
||||||
|
proxmox_vm_qemu.media_servers
|
||||||
|
]
|
||||||
|
}
|
||||||
|
@ -1,18 +1,14 @@
|
|||||||
[media-managers]
|
[media-managers]
|
||||||
%{ for ip in media-managers }
|
%{ for ip in media_managers }
|
||||||
${ ip }
|
${ ip }
|
||||||
%{ end for }
|
%{ end for }
|
||||||
|
|
||||||
[media-servers]
|
[media-servers]
|
||||||
%{ for ip in media-servers }
|
%{ for ip in media_servers }
|
||||||
${ ip }
|
${ ip }
|
||||||
%{ end for }
|
%{ end for }
|
||||||
|
|
||||||
[docker-servers:children]
|
[home-servers]
|
||||||
main-docker
|
%{ for ip in home_apps }
|
||||||
media-managers
|
|
||||||
|
|
||||||
[main-docker]
|
|
||||||
%{ for ip in main-docker }
|
|
||||||
${ ip }
|
${ ip }
|
||||||
%{ end for }
|
%{ end for }
|
||||||
|
Loading…
Reference in New Issue
Block a user