From bf1e99b197bb50c4b007e324ed4dff1244c822a2 Mon Sep 17 00:00:00 2001 From: Marty Oehme <marty.oehme@gmail.com> Date: Fri, 21 Feb 2025 11:41:14 +0100 Subject: [PATCH] Create rootfs for mounted void guest --- play.yaml | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/play.yaml b/play.yaml index 6753357..0bf00b3 100644 --- a/play.yaml +++ b/play.yaml @@ -1,21 +1,38 @@ --- -- name: Example task - hosts: host - tasks: - - name: Display facts - debug: - msg: "Facts collected: {{ ansible_facts }}" - +# # The subvol collection seems to be misbehaving? +# # https://github.com/ansible-collections/community.general/issues/7098 +# # (and btrfs_subvol module working) # - name: Create void btrfs subvol # hosts: host # vars: -# - btrfs_target: 441a90a5-3da2-46ce-9e32-987569b746c9 +# btrfs_target: 441a90a5-3da2-46ce-9e32-987569b746c9 +# mount_dir: /mnt/void +# become: true # tasks: # - name: Create @voidroot subvool under root # community.general.btrfs_subvolume: -# name: /@voidroot -# filesystem_uuid: {{ btrfs_target }} +# state: present +# name: "/@" +# filesystem_uuid: "{{ btrfs_target }}" + + +- name: Create voidlinux guest + hosts: host + become: true + vars: + mount_dir: /mnt/void + tarball_url: "https://repo-default.voidlinux.org/live/current/void-x86_64-ROOTFS-20250202.tar.xz" + tasks: + - name: Unpack rootfs + ansible.builtin.unarchive: + remote_src: yes # we already downloaded it to the 'remote' system + src: "{{ tarball_url }}" + dest: "{{ mount_dir }}" + # ONLY run if this file does not exist (could use any rootfs file to check) + creates: "{{ mount_dir }}/etc/os-release" + + # Get python onto void - otherwise we can not interact through ansible - name: Bootstrap void python hosts: guest