From 4bd12d50018da018c1ab2612c0846e8cfb82b3c5 Mon Sep 17 00:00:00 2001 From: Bertrand Benjamin Date: Mon, 10 Jan 2022 05:26:00 +0100 Subject: [PATCH] Feat: move autofs to workstation --- roles/workstation/defaults/main.yml | 27 ++++++++++++------- roles/workstation/files/autofs.nas | 2 ++ .../workstation/molecule/default/converge.yml | 10 +++++++ roles/workstation/tasks/home_mounts.yml | 18 +++++++++++++ 4 files changed, 47 insertions(+), 10 deletions(-) create mode 100644 roles/workstation/files/autofs.nas create mode 100644 roles/workstation/tasks/home_mounts.yml diff --git a/roles/workstation/defaults/main.yml b/roles/workstation/defaults/main.yml index b1f1064..fb7d5e9 100644 --- a/roles/workstation/defaults/main.yml +++ b/roles/workstation/defaults/main.yml @@ -1,5 +1,5 @@ --- -# defaults file for workstation +# defaults packages for workstation pacman_utils: - nfs-utils - samba @@ -31,6 +31,7 @@ pacman_office: - firefox - firefox-i18n-fr - chromium + - qutebrowser - inkscape - pstoedit # Enable latex in inkscape - thunderbird @@ -53,6 +54,7 @@ pacman_work: - gnuplot - auto-multiple-choice - xournalpp + - obs-studio pacman_media: - vlc @@ -94,13 +96,13 @@ pacman_programming: pacman_pkgs: - "{{ pacman_utils }}" - # - "{{ pacman_cli }}" - # - "{{ pacman_terms }}" - # - "{{ pacman_office }}" - # - "{{ pacman_media }}" - # - "{{ pacman_work }}" - # - "{{ pacman_3Dprint }}" - # - "{{ pacman_fonts }}" + - "{{ pacman_cli }}" + - "{{ pacman_terms }}" + - "{{ pacman_office }}" + - "{{ pacman_media }}" + - "{{ pacman_work }}" + - "{{ pacman_3Dprint }}" + - "{{ pacman_fonts }}" aur_utils: - autofs @@ -120,5 +122,10 @@ aur_work: aur_pkgs: - "{{ aur_utils }}" - # - "{{ aur_fonts }}" - # - "{{ aur_work }}" + - "{{ aur_fonts }}" + - "{{ aur_work }}" + +# Autofs +autofs: + host: nas + diff --git a/roles/workstation/files/autofs.nas b/roles/workstation/files/autofs.nas new file mode 100644 index 0000000..ecee41e --- /dev/null +++ b/roles/workstation/files/autofs.nas @@ -0,0 +1,2 @@ +Nas_commun -rw,soft,intr,rsize=8192,wsize=8192 nas:/mnt/DocNas/Commun +Nas_perso -rw,soft,intr,rsize=8192,wsize=8192 nas:/mnt/DocNas/Benjamin diff --git a/roles/workstation/molecule/default/converge.yml b/roles/workstation/molecule/default/converge.yml index 03dfbef..5762728 100644 --- a/roles/workstation/molecule/default/converge.yml +++ b/roles/workstation/molecule/default/converge.yml @@ -1,6 +1,16 @@ --- - name: Converge hosts: all + vars: + pacman_pkgs: + - "{{ pacman_utils }}" + aur_pkgs: + - "{{ aur_utils }}" + pre_tasks: + - name: Install pkgs + community.general.pacman: + update_cache: true + become: true tasks: - name: "Include workstation" include_role: diff --git a/roles/workstation/tasks/home_mounts.yml b/roles/workstation/tasks/home_mounts.yml new file mode 100644 index 0000000..eae6f6d --- /dev/null +++ b/roles/workstation/tasks/home_mounts.yml @@ -0,0 +1,18 @@ +--- +- name: Create NAS share directory + file: + path: "/media/{{ item.host }}" + state: directory + with_items: "{{ autofs }}" + +- name: Activate NAS shares for autofs + lineinfile: + path: /etc/autofs/auto.master + line: "/media/{{ item.host }} /etc/autofs/auto.{{ item.host }} --timeout=60 --browse" + with_items: "{{ autofs }}" + +- name: NAS autofs config file + template: + src: "files/autofs.{{ item.host }}" + dest: "/etc/autofs/auto.{{ item.host }}" + with_items: "{{ autofs }}"