From 4a7e18ef039629287c0adc396c7d9d59bdb23dd1 Mon Sep 17 00:00:00 2001 From: Bertrand Benjamin Date: Sun, 12 May 2019 06:47:12 +0200 Subject: [PATCH] Feat(autofs): itemize it --- files/autofs.songe | 3 --- tasks/home_autofs.yml | 11 +++++++---- vars/Choux.yml | 3 +++ vars/Combava.yml | 2 ++ 4 files changed, 12 insertions(+), 7 deletions(-) delete mode 100644 files/autofs.songe diff --git a/files/autofs.songe b/files/autofs.songe deleted file mode 100644 index 543d786..0000000 --- a/files/autofs.songe +++ /dev/null @@ -1,3 +0,0 @@ -{% for share in nas_nfs %} -{{ share.name }} {{ share.options }} {{ nas_name }}:{{ share.src }} -{% endfor %} diff --git a/tasks/home_autofs.yml b/tasks/home_autofs.yml index 51dc9d8..a789aac 100644 --- a/tasks/home_autofs.yml +++ b/tasks/home_autofs.yml @@ -6,18 +6,21 @@ - name: Create NAS share directory file: - path: /media/Raisin + path: "/media/{{ item.host }}" state: directory + with_items: "{{ autofs }}" - name: Activate NAS shares for autofs lineinfile: path: /etc/autofs/auto.master - line: '/media/raisin /etc/autofs/auto.raisin --timeout=60 --browse' + line: "/media/{{ item.host }} /etc/autofs/auto.{{ item.host }} --timeout=60 --browse" + with_items: "{{ autofs }}" - name: NAS autofs config file template: - src: files/autofs.raisin - dest: /etc/autofs/auto.raisin + src: "files/autofs.{{ item.host }}" + dest: "/etc/autofs/auto.{{ item.host }}" + with_items: "{{ autofs }}" - name: Enable autofs daemon service: diff --git a/vars/Choux.yml b/vars/Choux.yml index f61db1b..81e9cc5 100644 --- a/vars/Choux.yml +++ b/vars/Choux.yml @@ -14,5 +14,8 @@ access_mounts: [] nfs_shares: - { src: '/media/documents', name: '/export/documents', options: 'rw,no_subtree_check,nohide' } +autofs: + - { host: raisin } + music_dir: /media/documents/musique/ diff --git a/vars/Combava.yml b/vars/Combava.yml index e56262f..d1b47c0 100644 --- a/vars/Combava.yml +++ b/vars/Combava.yml @@ -3,3 +3,5 @@ prompt: fish deploy_public_key: id_ed25519_home.pub +autofs: + - { host: raisin }