From e28bb50a9ebf1ae20f5e9e6ba49ab73c8d718af5 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Thu, 14 Aug 2025 10:08:54 +0200 Subject: [PATCH 1/3] debian: improve proxmox detection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Assume non-proxmox debians don’t have /etc/pve so we don’t have to depend on NetBox data. --- roles/debian/tasks/main.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/roles/debian/tasks/main.yml b/roles/debian/tasks/main.yml index 70f3e7d..81e3749 100644 --- a/roles/debian/tasks/main.yml +++ b/roles/debian/tasks/main.yml @@ -1,3 +1,11 @@ +- block: + - name: Determine if this is a Proxmox host + stat: + path: /etc/pve + register: stat_pve + - set_fact: + is_proxmox: "{{ stat_pve.stat.exists and stat_pve.stat.isdir }}" + - name: Configure MOTD template: dest: /etc/motd @@ -77,7 +85,7 @@ - name: Set up firewall include_tasks: firewall.yml - when: is_virtual or cluster_type != 'proxmox' # proxmox has its own firewall configuration + when: not is_proxmox # proxmox has its own firewall configuration - name: Install automatic upgrade package package: From 04c5be85c5ebb32d37205a72f7c1354f1cd7dc19 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Thu, 14 Aug 2025 14:21:15 +0200 Subject: [PATCH 2/3] =?UTF-8?q?debian:=20don=E2=80=99t=20update=20package?= =?UTF-8?q?=20cache=20for=20base=20packages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The repositories might not yet be set up correctly at this point. --- roles/debian/tasks/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/roles/debian/tasks/main.yml b/roles/debian/tasks/main.yml index 81e3749..a24382b 100644 --- a/roles/debian/tasks/main.yml +++ b/roles/debian/tasks/main.yml @@ -41,7 +41,6 @@ - rsync - vim - tmux - update_cache: yes # we don’t want to template this file because it gets overwritten by proxmox # so just try removing anything that messes with our definitions in interfaces.d From 9afaf49651174b4203c2d641dc368dceb7583ad9 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Thu, 14 Aug 2025 14:37:36 +0200 Subject: [PATCH 3/3] debian: fix interface file templating Make it work for base Debian and Proxmox installs. --- roles/debian/tasks/main.yml | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/roles/debian/tasks/main.yml b/roles/debian/tasks/main.yml index a24382b..11d7942 100644 --- a/roles/debian/tasks/main.yml +++ b/roles/debian/tasks/main.yml @@ -42,19 +42,22 @@ - vim - tmux -# we don’t want to template this file because it gets overwritten by proxmox -# so just try removing anything that messes with our definitions in interfaces.d +# for base Debian the main interfaces file is just an include - name: Remove interface definitions added by installer - lineinfile: - path: /etc/network/interfaces - regexp: '^iface [^ ]* inet' - state: absent + when: not is_proxmox + copy: + dest: /etc/network/interfaces + content: 'source /etc/network/interfaces.d/*' notify: reload interfaces +# for Proxmox the main interfaces file will define bridges +# here we just remove the vmbr0 definition created by installer to preserve idempotency - name: Include interfaces.d definitions + when: is_proxmox lineinfile: path: /etc/network/interfaces - line: 'source /etc/network/interfaces.d/*' + regexp: '^(auto vmbr0|iface vmbr0|\t)' # our definitions start with four spaces instead of tab + state: absent notify: reload interfaces - name: Set up interfaces @@ -121,5 +124,3 @@ name: sshd@mgmt enabled: yes notify: reboot - - - meta: flush_handlers