Ansible-Bootstrap/roles/virtualization/tasks/proxmox.yml

52 lines
1.5 KiB
YAML
Raw Normal View History

2024-07-11 22:20:45 +02:00
---
2024-03-19 23:02:50 +01:00
- name: Deploy VM on Proxmox
delegate_to: localhost
2024-07-11 22:20:45 +02:00
community.general.proxmox_kvm:
2024-03-19 23:02:50 +01:00
api_host: "{{ hypervisor_url }}"
api_user: "{{ hypervisor_username }}"
api_password: "{{ hypervisor_password }}"
ciuser: "{{ user_name }}"
cipassword: "{{ user_password }}"
ciupgrade: false
2024-10-30 00:29:46 +01:00
node: "{{ hypervisor_node }}"
vmid: "{{ vm_id }}"
name: "{{ hostname }}"
2024-07-11 22:20:45 +02:00
cpu: host
2024-10-30 00:29:46 +01:00
cores: "{{ vm_cpus }}"
memory: "{{ vm_memory }}"
balloon: "{{ vm_ballo | default(omit) }}"
2024-03-19 23:02:50 +01:00
numa_enabled: true
2024-07-11 22:20:45 +02:00
hotplug: network,disk
2024-03-19 23:02:50 +01:00
bios: ovmf
2024-07-11 22:20:45 +02:00
boot: ac
scsihw: virtio-scsi-single
2024-03-19 23:02:50 +01:00
scsi:
2024-10-30 00:29:46 +01:00
scsi0: "{{ hypervisor_storage }}:{{ vm_size }}"
2024-03-19 23:02:50 +01:00
efidisk0:
2024-07-11 22:20:45 +02:00
efitype: 4m
format: raw
2024-03-19 23:02:50 +01:00
pre_enrolled_keys: false
storage: "{{ hypervisor_storage }}"
ide:
ide0: "{{ boot_iso }},media=cdrom"
2024-10-30 00:29:46 +01:00
ide1: "{{ rhel_iso | default(omit) }},media=cdrom"
ide2: "{{ hypervisor_storage }}:cloudinit"
2024-03-19 23:02:50 +01:00
net:
2024-07-11 22:20:45 +02:00
net0: virtio,bridge={{ vm_nif }}{% if vlan_name is defined and vlan_name %},tag={{ vlan_name }}{% endif %}
2024-03-19 23:02:50 +01:00
ipconfig:
2024-07-11 22:20:45 +02:00
ipconfig0: ip={{ vm_ip }},gw={{ vm_gw }}
2024-03-19 23:02:50 +01:00
nameservers: "{{ vm_dns }}"
2024-10-30 00:29:46 +01:00
onboot: true
state: present
2024-03-19 23:02:50 +01:00
- name: Start VM on Proxmox
delegate_to: localhost
2024-07-11 22:20:45 +02:00
community.general.proxmox_kvm:
2024-03-19 23:02:50 +01:00
api_host: "{{ hypervisor_url }}"
api_user: "{{ hypervisor_username }}"
api_password: "{{ hypervisor_password }}"
node: "{{ hypervisor_node }}"
name: "{{ hostname }}"
vmid: "{{ vm_id }}"
2024-10-30 00:29:46 +01:00
state: started