Ansible_workstation/tasks/home_autofs.yml

44 lines
976 B
YAML
Raw Normal View History

---
- name: Install autofs
pacman:
name: autofs
state: present
2020-01-02 18:13:11 +00:00
#- name: install nfs
# apt:
# pkg: nfs-kernel-server
# state: present
# when: ansible_distribution == 'Debian'
# notify: restart nfs-server
2020-01-02 06:59:40 +00:00
- name: install nfs
pacman:
pkg: nfs-utils
state: present
when: ansible_distribution != 'Debian'
2020-01-02 18:13:11 +00:00
notify: restart nfs-client
2020-01-02 06:59:40 +00:00
- name: Create NAS share directory
file:
2019-05-12 04:47:12 +00:00
path: "/media/{{ item.host }}"
state: directory
2019-05-12 04:47:12 +00:00
with_items: "{{ autofs }}"
- name: Activate NAS shares for autofs
lineinfile:
path: /etc/autofs/auto.master
2019-05-12 04:47:12 +00:00
line: "/media/{{ item.host }} /etc/autofs/auto.{{ item.host }} --timeout=60 --browse"
with_items: "{{ autofs }}"
- name: NAS autofs config file
template:
2019-05-12 04:47:12 +00:00
src: "files/autofs.{{ item.host }}"
dest: "/etc/autofs/auto.{{ item.host }}"
with_items: "{{ autofs }}"
- name: Enable autofs daemon
2018-10-18 17:42:05 +00:00
service:
name: autofs
2018-10-18 17:42:05 +00:00
state: started
enabled: yes