feat: update ansible proxmox template
Some checks failed
Deploy / Prepare Build (push) Failing after 3m2s

This commit is contained in:
2024-10-26 22:29:42 +10:00
parent 97b9c796e7
commit e2ee82b1c0
6 changed files with 198 additions and 179 deletions

View File

@ -3,6 +3,12 @@
become: yes
tasks:
- name: Write notify script
ansible.builtin.template:
src: scripts/notify.sh.j2
dest: /tmp/notify.sh
- name: Delete existing template
community.general.proxmox_kvm:
api_host: "{{ api_host }}"
@ -33,10 +39,12 @@
- name: Install Tools to cloud-init image
ansible.builtin.shell: |
virt-copy-in -a {{ image.dest }} /tmp/notify.sh /usr/local/bin
virt-customize -a {{ image.dest }} --run-command 'chmod +x /usr/local/bin/notify.sh'
virt-customize -a {{ image.dest }} --run-command 'sed -i "s|primary.*|primary: http://mirror.amaze.com.au/debian|g" /etc/cloud/cloud.cfg'
virt-customize -a {{ image.dest }} --run-command 'apt update'
virt-customize -a {{ image.dest }} --install qemu-guest-agent
virt-customize -a {{ image.dest }} --install vim
virt-customize -a {{ image.dest }} --install git
- name: Create new VM template from cloud-init image
community.general.proxmox_kvm:
api_host: "{{ api_host }}"
@ -57,9 +65,6 @@
ostype: "l26"
vga: std
scsihw: 'virtio-scsi-single'
#scsi:
#scsi0: "{{ storage_target }}:0,iothread=1,discard=on,import-from={{ image.dest }},format=raw"
#scsi0: "{{ storage_target }}:0,import-from=/tmp/debian-12-generic-amd64.qcow2,format=raw"
net:
net0: 'virtio,bridge=vmbr0,firewall=1,tag=10'
ipconfig:
@ -67,11 +72,7 @@
template: true
timeout: 600
vmid: 10000
# - name: Pause for 5 seconds while template imported
# ansible.builtin.pause:
# seconds: 10
- name: Import HDD to Template
command:
cmd: "qm set 10000 --scsi0 {{ storage_target }}:0,iothread=1,discard=on,import-from=/tmp/debian-12-generic-amd64.qcow2,format=raw"