vn-ansible/roles/config-autofs-homes/tasks/main.yaml

70 lines
2.2 KiB
YAML

---
- name: "[CONFIG AUTOFS HOMES] Comprobando si es necesario configurar AUTOFS HOMES"
meta: end_host
when: autofs-homes_enabled is not defined or not autofs-homes_enabled
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# install packages nfs-common , autofs , libnfs-utils , autofs-ldap
- name: install packages for autofs
apt:
name: "{{ item }}"
state: present
with_items:
- nfs-common
- autofs
- libnfs-utils
- autofs-ldap
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# create directory /mnt/homes for mount
- name: create directory /mnt/homes
ansible.builtin.file:
path: "{{ path_mnt_homes }}"
state: directory
mode: '0755'
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# add line to /etc/nsswitch.conf
- name: add line to file /etc/nsswitch.conf
lineinfile:
path: "{{ path_nsswitch }}"
line: "automount: files"
notify: restart nslcd
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# add files configured to autofs
# paso 1
- name: add file homes.autofs configured to autofs
copy:
src: homes.autofs
dest: "{{ path_home_autofs }}"
owner: root
group: root
mode: '0644'
# paso 2
- name: add file /etc/auto.homes configured to the systemd
copy:
src: auto.homes
dest: "{{ path_auto_homes }}"
owner: root
group: root
mode: '0644'
notify: restart autofs
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# enabled autofs
- name: service should start on boot
service:
name: "{{ autofs_daemon }}"
enabled: yes
# enabled nslcd
- name: service should start on boot
service:
name: "{{ nslcd_daemon }}"
enabled: yes
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++