diff --git a/infra/cloud/0000_proxmox_playbook.yaml b/infra/cloud/0000_proxmox_playbook.yaml index 2ed0f49..0222d9c 100644 --- a/infra/cloud/0000_proxmox_playbook.yaml +++ b/infra/cloud/0000_proxmox_playbook.yaml @@ -36,7 +36,7 @@ community.general.proxmox_kvm: clone: "{{ node }}-debian-12" storage: nvme - register: create + notify: Initial boot - name: Wait for status community.general.proxmox_kvm: state: current @@ -65,21 +65,8 @@ ipconfig0: ip=dhcp,ip6=auto ipconfig1: ip=dhcp - # Initial boot - # For some reason debian cloud images don't use - # cloud-init for networking on first boot (cloud-init files - # are regenerated AFTER networking starts). But we need the - # hostname to be registered with DHCP later on so ¯\_(ツ)_/¯ - - name: Initial boot - when: create.changed is true - block: - - name: Start - community.general.proxmox_kvm: - state: started - register: start - - name: Wait 1.5 min # Initial apt update, apt upgrade, cloud-init - ansible.builtin.wait_for: - timeout: 90 + - name: Force all notified handlers to run + ansible.builtin.meta: flush_handlers # VM Configuration - name: Resize root disk @@ -108,3 +95,18 @@ community.general.proxmox_kvm: state: restarted timeout: 60 + handlers: + # Initial boot + # For some reason debian cloud images don't use + # cloud-init for networking on first boot (cloud-init files + # are regenerated AFTER networking starts). But we need the + # hostname to be registered with DHCP later on so ¯\_(ツ)_/¯ + - name: Initial boot + block: + - name: Start + community.general.proxmox_kvm: + state: started + register: start + - name: Wait 1.5 min # Initial apt update, apt upgrade, cloud-init + ansible.builtin.wait_for: + timeout: 90 diff --git a/infra/music/0000_proxmox_playbook.yaml b/infra/music/0000_proxmox_playbook.yaml index 984db1a..9df8284 100644 --- a/infra/music/0000_proxmox_playbook.yaml +++ b/infra/music/0000_proxmox_playbook.yaml @@ -36,7 +36,7 @@ community.general.proxmox_kvm: clone: "{{ node }}-debian-12" storage: nvme - register: create + notify: Initial boot - name: Wait for status community.general.proxmox_kvm: state: current @@ -65,21 +65,8 @@ ipconfig0: ip=dhcp,ip6=auto ipconfig1: ip=dhcp - # Initial boot - # For some reason debian cloud images don't use - # cloud-init for networking on first boot (cloud-init files - # are regenerated AFTER networking starts). But we need the - # hostname to be registered with DHCP later on so ¯\_(ツ)_/¯ - - name: Initial boot - when: create.changed is true - block: - - name: Start - community.general.proxmox_kvm: - state: started - register: start - - name: Wait 1.5 min # Initial apt update, apt upgrade, cloud-init - ansible.builtin.wait_for: - timeout: 90 + - name: Force all notified handlers to run + ansible.builtin.meta: flush_handlers # VM Configuration - name: Resize root disk @@ -114,3 +101,18 @@ community.general.proxmox_kvm: state: restarted timeout: 60 + handlers: + # Initial boot + # For some reason debian cloud images don't use + # cloud-init for networking on first boot (cloud-init files + # are regenerated AFTER networking starts). But we need the + # hostname to be registered with DHCP later on so ¯\_(ツ)_/¯ + - name: Initial boot + block: + - name: Start + community.general.proxmox_kvm: + state: started + register: start + - name: Wait 1.5 min # Initial apt update, apt upgrade, cloud-init + ansible.builtin.wait_for: + timeout: 90 diff --git a/infra/photos/0000_proxmox_playbook.yaml b/infra/photos/0000_proxmox_playbook.yaml index 6804b05..0f75d10 100644 --- a/infra/photos/0000_proxmox_playbook.yaml +++ b/infra/photos/0000_proxmox_playbook.yaml @@ -36,7 +36,7 @@ community.general.proxmox_kvm: clone: "{{ node }}-debian-12" storage: nvme - register: create + notify: Initial boot - name: Wait for status community.general.proxmox_kvm: state: current @@ -65,21 +65,8 @@ ipconfig0: ip=dhcp,ip6=auto ipconfig1: ip=dhcp - # Initial boot - # For some reason debian cloud images don't use - # cloud-init for networking on first boot (cloud-init files - # are regenerated AFTER networking starts). But we need the - # hostname to be registered with DHCP later on so ¯\_(ツ)_/¯ - - name: Initial boot - when: create.changed is true - block: - - name: Start - community.general.proxmox_kvm: - state: started - register: start - - name: Wait 1.5 min # Initial apt update, apt upgrade, cloud-init - ansible.builtin.wait_for: - timeout: 90 + - name: Force all notified handlers to run + ansible.builtin.meta: flush_handlers # VM Configuration - name: Resize root disk @@ -114,3 +101,18 @@ community.general.proxmox_kvm: state: restarted timeout: 60 + handlers: + # Initial boot + # For some reason debian cloud images don't use + # cloud-init for networking on first boot (cloud-init files + # are regenerated AFTER networking starts). But we need the + # hostname to be registered with DHCP later on so ¯\_(ツ)_/¯ + - name: Initial boot + block: + - name: Start + community.general.proxmox_kvm: + state: started + register: start + - name: Wait 1.5 min # Initial apt update, apt upgrade, cloud-init + ansible.builtin.wait_for: + timeout: 90 diff --git a/infra/samba/0000_proxmox_playbook.yaml b/infra/samba/0000_proxmox_playbook.yaml index 3c75130..a8dc053 100644 --- a/infra/samba/0000_proxmox_playbook.yaml +++ b/infra/samba/0000_proxmox_playbook.yaml @@ -36,7 +36,7 @@ community.general.proxmox_kvm: clone: "{{ node }}-debian-12" storage: nvme - register: create + notify: Initial boot - name: Wait for status community.general.proxmox_kvm: state: current @@ -65,21 +65,8 @@ ipconfig0: ip=dhcp,ip6=auto ipconfig1: ip=dhcp - # Initial boot - # For some reason debian cloud images don't use - # cloud-init for networking on first boot (cloud-init files - # are regenerated AFTER networking starts). But we need the - # hostname to be registered with DHCP later on so ¯\_(ツ)_/¯ - - name: Initial boot - when: create.changed is true - block: - - name: Start - community.general.proxmox_kvm: - state: started - register: start - - name: Wait 1.5 min # Initial apt update, apt upgrade, cloud-init - ansible.builtin.wait_for: - timeout: 90 + - name: Force all notified handlers to run + ansible.builtin.meta: flush_handlers # VM Configuration - name: Resize root disk @@ -113,3 +100,18 @@ community.general.proxmox_kvm: state: restarted timeout: 60 + handlers: + # Initial boot + # For some reason debian cloud images don't use + # cloud-init for networking on first boot (cloud-init files + # are regenerated AFTER networking starts). But we need the + # hostname to be registered with DHCP later on so ¯\_(ツ)_/¯ + - name: Initial boot + block: + - name: Start + community.general.proxmox_kvm: + state: started + register: start + - name: Wait 1.5 min # Initial apt update, apt upgrade, cloud-init + ansible.builtin.wait_for: + timeout: 90 diff --git a/infra/secrets/0000_proxmox_playbook.yaml b/infra/secrets/0000_proxmox_playbook.yaml index 37d9b94..bc77e4d 100644 --- a/infra/secrets/0000_proxmox_playbook.yaml +++ b/infra/secrets/0000_proxmox_playbook.yaml @@ -36,7 +36,7 @@ community.general.proxmox_kvm: clone: "{{ node }}-debian-12" storage: nvme - register: create + notify: Initial boot - name: Wait for status community.general.proxmox_kvm: state: current @@ -65,21 +65,8 @@ ipconfig0: ip=dhcp,ip6=auto ipconfig1: ip=dhcp - # Initial boot - # For some reason debian cloud images don't use - # cloud-init for networking on first boot (cloud-init files - # are regenerated AFTER networking starts). But we need the - # hostname to be registered with DHCP later on so ¯\_(ツ)_/¯ - - name: Initial boot - when: create.changed is true - block: - - name: Start - community.general.proxmox_kvm: - state: started - register: start - - name: Wait 1.5 min # Initial apt update, apt upgrade, cloud-init - ansible.builtin.wait_for: - timeout: 90 + - name: Force all notified handlers to run + ansible.builtin.meta: flush_handlers # VM Configuration - name: Resize root disk @@ -109,3 +96,18 @@ community.general.proxmox_kvm: state: restarted timeout: 60 + handlers: + # Initial boot + # For some reason debian cloud images don't use + # cloud-init for networking on first boot (cloud-init files + # are regenerated AFTER networking starts). But we need the + # hostname to be registered with DHCP later on so ¯\_(ツ)_/¯ + - name: Initial boot + block: + - name: Start + community.general.proxmox_kvm: + state: started + register: start + - name: Wait 1.5 min # Initial apt update, apt upgrade, cloud-init + ansible.builtin.wait_for: + timeout: 90