Files
homelab/ansible/playbooks/populate_cloud_init.yml
2025-09-26 11:55:32 -05:00

32 lines
1.0 KiB
YAML

---
- name: Create VM ID from IP address for Proxmox hosts
hosts: all
gather_facts: false
tasks:
- name: Modify Proxmox Ubuntu VM
delegate_to: "localhost"
when: platform is defined and platform == "proxmox"
block:
- name: Update cloud-init file
community.proxmox.proxmox_kvm:
api_user: "{{ proxmox_user }}"
api_password: "{{ proxmox_password }}"
api_host: "{{ proxmox_host }}"
node: "{{ proxmox_clone_node }}"
vmid: "{{ vm_id }}"
ipconfig:
ipconfig0: "ip=dhcp"
update: true
# - name: Add VM to HA group
# community.proxmox.proxmox_cluster_ha_resources:
# api_user: "{{ proxmox_user }}"
# api_password: "{{ proxmox_password }}"
# api_host: "{{ proxmox_host }}"
# name: vm:"{{ vm_id }}"
# state: "present"
# group: "{{ ha_group }}"
# max_relocate: 2
# max_restart: 2