From 996560410ebbecf18b6d43f6280d054f43fb586e Mon Sep 17 00:00:00 2001 From: Marty Oehme <marty.oehme@gmail.com> Date: Sun, 23 Feb 2025 10:18:22 +0100 Subject: [PATCH] ref(inventory): Make chroot target one child of target systems This should allow just having a general 'target' system for ansible which will take all the modifications - but not care whether we connect to it locally (i.e. running from void) or through chroot. We can set the connection method for the specific system(s) in whatever we group as part of the target group then. For local installation we simply add locally connected hosts and for chroot set up chrooted hosts. --- inventory.yaml | 12 +++++++++++- play.yaml | 2 +- void_base.yaml | 4 ++-- void_network.yaml | 2 +- void_packages.yaml | 2 +- void_user.yaml | 2 +- void_wayland.yaml | 2 +- 7 files changed, 18 insertions(+), 8 deletions(-) diff --git a/inventory.yaml b/inventory.yaml index 7b39905..e81a041 100644 --- a/inventory.yaml +++ b/inventory.yaml @@ -3,7 +3,7 @@ hostsystem: 127.0.0.1: ansible_connection: local -chroot: +chroot_target: hosts: void: ansible_host: /mnt/void @@ -11,6 +11,16 @@ chroot: ansible_chroot_exe: arch-chroot desired_package_state: latest +local_target: + hosts: + void: + ansible_host: 127.0.0.1 + desired_package_state: latest + +target_system: + children: + chroot_target: + interface: hosts: void: diff --git a/play.yaml b/play.yaml index 7882a14..f5f1e50 100644 --- a/play.yaml +++ b/play.yaml @@ -4,7 +4,7 @@ # Get python onto void - otherwise we can not interact through ansible - name: Bootstrap void python - hosts: chroot + hosts: target_system gather_facts: false tasks: - name: install python diff --git a/void_base.yaml b/void_base.yaml index cf42be7..7e1bc01 100644 --- a/void_base.yaml +++ b/void_base.yaml @@ -1,5 +1,5 @@ - name: Install void base system - hosts: chroot + hosts: target_system become: true tasks: # Prefer booster to dracut so make sure to never install it @@ -64,7 +64,7 @@ listen: installed-booster - name: Configure void base system - hosts: chroot + hosts: target_system become: true vars: host_name: voider diff --git a/void_network.yaml b/void_network.yaml index 384f7f6..a99e5ed 100644 --- a/void_network.yaml +++ b/void_network.yaml @@ -1,5 +1,5 @@ - name: Set up voidlinux networking - hosts: chroot + hosts: target_system become: true vars: nameserver1: 9.9.9.9 diff --git a/void_packages.yaml b/void_packages.yaml index 4a95958..7934f93 100644 --- a/void_packages.yaml +++ b/void_packages.yaml @@ -36,7 +36,7 @@ listen: installed-fonts - name: Install basic custom void packages - hosts: chroot + hosts: target_system become: true tags: - packages diff --git a/void_user.yaml b/void_user.yaml index f637724..b5c861c 100644 --- a/void_user.yaml +++ b/void_user.yaml @@ -1,5 +1,5 @@ - name: Set up primary user - hosts: chroot + hosts: target_system become: true vars: user_name: marty diff --git a/void_wayland.yaml b/void_wayland.yaml index 805fa81..54d1c8c 100644 --- a/void_wayland.yaml +++ b/void_wayland.yaml @@ -1,5 +1,5 @@ - name: Install void wayland environment - hosts: chroot + hosts: target_system become: true tasks: - name: Install intel wayland drivers