From d8ec78a841006a4224c701824d8c5c9a57f33678 Mon Sep 17 00:00:00 2001 From: Marco Date: Sun, 31 Oct 2021 15:14:53 +0100 Subject: [PATCH] add docker mountpoint on extra subvolume note: right now the subvol needs to be created prior running this playbook --- group_vars/silverblue.yml | 13 ++++++++-- host_vars/chapek9.yml | 2 ++ host_vars/ice9.yml | 2 ++ host_vars/vinci.yml | 2 ++ roles/etc/tasks/fstab.yml | 50 ++++++++++++++++++++++++++------------- silverblue.yml | 2 +- 6 files changed, 52 insertions(+), 19 deletions(-) diff --git a/group_vars/silverblue.yml b/group_vars/silverblue.yml index 32a8984..0195fb8 100644 --- a/group_vars/silverblue.yml +++ b/group_vars/silverblue.yml @@ -199,7 +199,7 @@ rpm_ostree_layered_packages: compsize: state: absent docker-compose: - state: absent + state: present fd-find: state: absent git: @@ -217,7 +217,7 @@ rpm_ostree_layered_packages: microdnf: state: present moby-engine: - state: absent + state: present mosh: state: absent ncdu: @@ -273,12 +273,21 @@ etc_fstab_entries: opts: noatime,subvol=root,compress=zstd:1,x-systemd.device-timeout=0 passno: 0 dump: 0 + state: present home: path: /home fstype: btrfs opts: subvol=home,compress=zstd:1,x-systemd.device-timeout=0 passno: 0 dump: 0 + state: present + docker: + path: /var/lib/docker + fstype: btrfs + opts: subvol=docker,compress=zstd:1,x-systemd.device-timeout=0 + passno: 0 + dump: 0 + state: mounted users: flexo: diff --git a/host_vars/chapek9.yml b/host_vars/chapek9.yml index 51f12ec..cdf278b 100644 --- a/host_vars/chapek9.yml +++ b/host_vars/chapek9.yml @@ -6,6 +6,8 @@ etc_fstab_entries_overwrite: src: UUID=254d6a53-398a-4a53-93d1-c45e61263791 home: src: UUID=254d6a53-398a-4a53-93d1-c45e61263791 + docker: + src: UUID=254d6a53-398a-4a53-93d1-c45e61263791 rpm_ostree_kargs_overwrite: 'i915.enable_psr=0': diff --git a/host_vars/ice9.yml b/host_vars/ice9.yml index 84136d0..9b064fe 100644 --- a/host_vars/ice9.yml +++ b/host_vars/ice9.yml @@ -6,6 +6,8 @@ etc_fstab_entries_overwrite: src: UUID=aa63fb86-3fc9-42d1-82ca-7d47d0238765 home: src: UUID=aa63fb86-3fc9-42d1-82ca-7d47d0238765 + docker: + src: UUID=aa63fb86-3fc9-42d1-82ca-7d47d0238765 flatpak_flatpaks_overwrite: com.github.Bleuzen.FFaudioConverter: diff --git a/host_vars/vinci.yml b/host_vars/vinci.yml index d836a7c..984867f 100644 --- a/host_vars/vinci.yml +++ b/host_vars/vinci.yml @@ -6,6 +6,8 @@ etc_fstab_entries_overwrite: src: UUID=f1b9b845-5f3c-4912-b729-b6e8605f0def home: src: UUID=f1b9b845-5f3c-4912-b729-b6e8605f0def + docker: + src: UUID=f1b9b845-5f3c-4912-b729-b6e8605f0def flatpak_flatpaks_overwrite: org.gnome.Firmware: diff --git a/roles/etc/tasks/fstab.yml b/roles/etc/tasks/fstab.yml index 276767c..a687ca9 100644 --- a/roles/etc/tasks/fstab.yml +++ b/roles/etc/tasks/fstab.yml @@ -1,18 +1,36 @@ --- -- name: Merge fstab entries - set_fact: - etc_fstab_entries: '{{ etc_fstab_entries | combine(etc_fstab_entries_overwrite, recursive=True) }}' - when: - - etc_fstab_entries_overwrite | default() - - name: Configure fstab - ansible.posix.mount: - src: "{{ item.value.src }}" - path: "{{ item.value.path }}" - fstype: "{{ item.value.fstype }}" - opts: "{{ item.value.opts }}" - passno: "{{ item.value.passno }}" - dump: "{{ item.value.dump }}" - state: present - become: yes - loop: "{{ lookup('dict', etc_fstab_entries, wantlist=True) }}" + block: + - name: Merge variables + set_fact: + etc_fstab_entries: '{{ etc_fstab_entries | combine(etc_fstab_entries_overwrite, recursive=True) }}' + when: + - etc_fstab_entries_overwrite | default() + + #- name: Mount btrfs root + # ansible.posix.mount: + # src: "'/dev/mapper/luks-' + {{ etc_fstab_btrfs_root }}" + # path: "/mnt" + # become: yes + + #- name: Create subvolume + # #ansible.builtin.command: + # ansible.builtin.debug: + # #cmd: "btrfs subvolume create {{ item }}" + # msg: "{{ item }}" + # become: yes + # loop: "{{ lookup('dict', etc_fstab_entries, wantlist=True) }}" + # when: + # "item.value.path != '/' and item.value.path != '/home'" + + - name: Write fstab entries + ansible.posix.mount: + src: "{{ item.value.src }}" + path: "{{ item.value.path }}" + fstype: "{{ item.value.fstype }}" + opts: "{{ item.value.opts }}" + passno: "{{ item.value.passno }}" + dump: "{{ item.value.dump }}" + state: "{{ item.value.state }}" + become: yes + loop: "{{ lookup('dict', etc_fstab_entries, wantlist=True) }}" diff --git a/silverblue.yml b/silverblue.yml index 2da98c4..2393cc0 100644 --- a/silverblue.yml +++ b/silverblue.yml @@ -5,5 +5,5 @@ connection: "local" roles: - flatpak - - rpm-ostree - etc + - rpm-ostree