Hi, I want to deploy from a Proxmox Host a VM that is convertet to a template to clone other VMs out of these. the Templating role works fine but if i clone the template with ansible, starting the VM and want to sign in the preset login combi don´t work, but if i click on the "Regenerate Image" Button manually in gui and than start the VM the right login combi is used. Is there something I have to add to my ansible role to regenerate the image or is there a preset to do in some config file in proxmox?
This is the template generator:
and here are the clone role:
This is the template generator:
YAML:
---
- name: download cloud image
get_url:
url: https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img
dest: /home/user/focal-server-cloudimg-amd64.img
- name: Create empty VM using Cloud-Init
community.general.proxmox_kvm:
node: pve
api_user: root@pam
api_password: "{{ lookup('keepass', 'pveroot', 'password') }}"
api_host: pve
name: testvm-template
scsihw: virtio-scsi-pci
scsi:
scsi0: 'local-lvm:1,format=raw'
ide:
ide2: 'local:cloudinit,format=qcow2'
bootdisk: scsi0
ciuser: user
cipassword: hallowelt
net:
net0: 'virtio,bridge=vmbr0'
ipconfig:
ipconfig0: 'ip=192.168.56.230/24'
proxmox_default_behavior: compatibility
- name: import init disk
ansible.builtin.command:
cmd: "qm importdisk 100 /home/user/focal-server-cloudimg-amd64.img local-lvm"
creates: "/dev/mapper/pve-vm--100--disk--1"
- name: attache base image disk
ansible.builtin.lineinfile:
path: /etc/pve/local/qemu-server/100.conf
regexp: '^scsi0:.*'
line: 'scsi0: local-lvm:vm-100-disk-1'
- name: make vm to template
community.general.proxmox_kvm:
node: pve
api_user: root@pam
api_password: "{{ lookup('keepass', 'pveroot', 'password') }}"
api_host: pve
vmid: 100
name: testvm-template
scsihw: virtio-scsi-pci
ide:
ide2: 'local:cloudinit,format=qcow2'
bootdisk: scsi0
ciuser: user
cipassword: hallowelt
proxmox_default_behavior: compatibility
template: yes
update: yes
and here are the clone role:
YAML:
---
- name: Clone VM
community.general.proxmox_kvm:
api_user: root@pam
api_password: "{{ lookup('keepass', 'pveroot', 'password') }}"
api_host: pve
clone: testvm-template
name: testvm-clone2
node: pve
storage: local-lvm
format: raw
timeout: 500
net:
net0: "virtio,bridge=vmbr0"
ipconfig:
ipconfig0: "ip=192.168.56.201/24"
ciuser: user
cipassword: hallowelt