infra: introduce terraform/opentofu for proxmox management
- move ansible project within infra - introduce terraform/opentofu for proxmox VM management
This commit is contained in:
		
							
								
								
									
										11
									
								
								infra/ansible/inventory/group_vars/all.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								infra/ansible/inventory/group_vars/all.yaml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,11 @@ | ||||
| # Proxmox access related variables | ||||
| proxmox_api_url: "192.168.1.121" | ||||
|  | ||||
| # Cloud-init image related variables | ||||
| image_url: "https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img" | ||||
| image_dest: "/tmp/cloud-image.img" | ||||
| image_format: "qcow2" | ||||
| storage_name: "local" | ||||
|  | ||||
| # ansible venv | ||||
| ansible_venv: "/home/taqi/.venv/ansible/bin/python" | ||||
							
								
								
									
										22
									
								
								infra/ansible/inventory/group_vars/vms.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								infra/ansible/inventory/group_vars/vms.yaml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,22 @@ | ||||
| apt_packages: | ||||
|   - curl | ||||
|   - vim | ||||
|   - htop | ||||
|  | ||||
| # Kubernetes k0sctl configuration vars | ||||
| master1_ip: "192.168.1.151" | ||||
| master1_hostname: "vm6" | ||||
| master2_ip: "192.168.1.161" | ||||
| master2_hostname: "vm8" | ||||
| worker1_ip: "192.168.1.152" | ||||
| worker1_hostname: "vm7" | ||||
| worker2_ip: "192.168.1.162" | ||||
| worker2_hostname: "vm9" | ||||
|  | ||||
| pod_CIDR: "10.244.0.0/16" | ||||
| service_CIDR: "10.96.0.0/12" | ||||
| metallb_ip_range: "192.168.1.201-192.168.1.220" | ||||
|  | ||||
| k0s_version: "v1.33.2+k0s.0" | ||||
| metallb_version: "0.15.2" | ||||
| traefik_version: "36.2.0" | ||||
							
								
								
									
										29
									
								
								infra/ansible/inventory/host_vars/proxmox1.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								infra/ansible/inventory/host_vars/proxmox1.yaml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,29 @@ | ||||
| # VM related variables | ||||
| vm_list: | ||||
|   - id: 106 | ||||
|     name: "vm6" | ||||
|     memory: 4096 | ||||
|     cores: 2 | ||||
|     disk_size: 30G | ||||
|     ip: "192.168.1.151/24" | ||||
|     gateway: "192.168.1.1" | ||||
|     nameserver1: "192.168.1.145" | ||||
|     nameserver2: "1.1.1.1" | ||||
|   - id: 107 | ||||
|     name: "vm7" | ||||
|     memory: 4096 | ||||
|     cores: 2 | ||||
|     disk_size: 30G | ||||
|     ip: "192.168.1.152/24" | ||||
|     gateway: "192.168.1.1" | ||||
|     nameserver1: "192.168.1.145" | ||||
|     nameserver2: "1.1.1.1" | ||||
|  | ||||
| # cloud-init variables | ||||
| node: "homeserver1" | ||||
| net0: "virtio,bridge=vmbr0" | ||||
| # disk_name: "local:1000/vm-1000-disk-0.raw,discard=on" | ||||
| disk_path: "/var/lib/vz/images/1000" | ||||
| ide2: "local:cloudinit,format=qcow2" | ||||
| boot_order: "order=scsi0" | ||||
| scsi_hw: "virtio-scsi-pci" | ||||
							
								
								
									
										29
									
								
								infra/ansible/inventory/host_vars/proxmox2.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								infra/ansible/inventory/host_vars/proxmox2.yaml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,29 @@ | ||||
| # VM related variables | ||||
| vm_list: | ||||
|   - id: 206 | ||||
|     name: "vm8" | ||||
|     memory: 4096 | ||||
|     cores: 2 | ||||
|     disk_size: 30G | ||||
|     ip: "192.168.1.161/24" | ||||
|     gateway: "192.168.1.1" | ||||
|     nameserver1: "192.168.1.145" | ||||
|     nameserver2: "1.1.1.1" | ||||
|   - id: 207 | ||||
|     name: "vm9" | ||||
|     memory: 4096 | ||||
|     cores: 2 | ||||
|     disk_size: 30G | ||||
|     ip: "192.168.1.162/24" | ||||
|     gateway: "192.168.1.1" | ||||
|     nameserver1: "192.168.1.145" | ||||
|     nameserver2: "1.1.1.1" | ||||
|  | ||||
| # cloud-init template variables | ||||
| node: "homeserver2" | ||||
| net0: "virtio,bridge=vmbr0" | ||||
| # disk_name: "local:2000/vm-2000-disk-0.raw,discard=on" | ||||
| disk_path: "/var/lib/vz/images/2000" | ||||
| ide2: "local:cloudinit,format=qcow2" | ||||
| boot_order: "order=scsi0" | ||||
| scsi_hw: "virtio-scsi-pci" | ||||
							
								
								
									
										51
									
								
								infra/ansible/inventory/hosts.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								infra/ansible/inventory/hosts.yaml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,51 @@ | ||||
| all: | ||||
|   children: | ||||
|     hypervisors: | ||||
|     vms: | ||||
|  | ||||
| hypervisors: | ||||
|   children: | ||||
|     server1: | ||||
|     server2: | ||||
|  | ||||
| server1: | ||||
|   hosts: | ||||
|     proxmox1: | ||||
|       ansible_host: 192.168.1.121 | ||||
|       ansible_user:  "{{ ansible_proxmox_user }}" | ||||
|       ansible_ssh_private_key_file: "{{ ansible_ssh_private_key_file }}" | ||||
|  | ||||
| server2: | ||||
|   hosts: | ||||
|     proxmox2: | ||||
|       ansible_host: 192.168.1.122 | ||||
|       ansible_user:  "{{ ansible_proxmox_user }}" | ||||
|       ansible_ssh_private_key_file: "{{ ansible_ssh_private_key_file }}" | ||||
|  | ||||
| vms: | ||||
|   children: | ||||
|     vm_group_1: | ||||
|     vm_group_2: | ||||
|  | ||||
| vm_group_1: | ||||
|   hosts: | ||||
|     vm6: | ||||
|       ansible_host: 192.168.1.151 | ||||
|       ansible_user: "{{ ansible_vm_user }}" | ||||
|       ansible_ssh_private_key_file: "{{ ansible_ssh_private_key_file }}" | ||||
|     vm7: | ||||
|       ansible_host: 192.168.1.152 | ||||
|       ansible_user: "{{ ansible_vm_user }}" | ||||
|       ansible_ssh_private_key_file: "{{ ansible_ssh_private_key_file }}" | ||||
|  | ||||
| vm_group_2: | ||||
|   hosts: | ||||
|     vm8: | ||||
|       ansible_host: 192.168.1.161 | ||||
|       ansible_user: "{{ ansible_vm_user }}" | ||||
|       ansible_ssh_private_key_file: "{{ ansible_ssh_private_key_file }}" | ||||
|     vm9: | ||||
|       ansible_host: 192.168.1.162 | ||||
|       ansible_user: "{{ ansible_vm_user }}" | ||||
|       ansible_ssh_private_key_file: "{{ ansible_ssh_private_key_file }}" | ||||
|  | ||||
		Reference in New Issue
	
	Block a user