Feat(autofs): itemize it

This commit is contained in:
Bertrand Benjamin 2019-05-12 06:47:12 +02:00
parent 19ac121700
commit 4a7e18ef03
4 changed files with 12 additions and 7 deletions

View File

@ -1,3 +0,0 @@
{% for share in nas_nfs %}
{{ share.name }} {{ share.options }} {{ nas_name }}:{{ share.src }}
{% endfor %}

View File

@ -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:

View File

@ -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/

View File

@ -3,3 +3,5 @@ prompt: fish
deploy_public_key: id_ed25519_home.pub
autofs:
- { host: raisin }