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

70 lines
2.2 KiB
YAML
Raw Normal View History

2023-11-06 15:53:45 +00:00
---
2024-02-15 16:42:58 +00:00
- name: "[CONFIG AUTOFS HOMES] Comprobando si es necesario configurar AUTOFS HOMES"
meta: end_host
2024-02-15 17:50:53 +00:00
when: autofs_homes_enabled is not defined or not autofs_homes_enabled
2024-02-15 16:42:58 +00:00
2023-11-06 15:53:45 +00:00
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# 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
2024-02-12 16:35:15 +00:00
# enabled nslcd
- name: service should start on boot
service:
name: "{{ nslcd_daemon }}"
enabled: yes
2023-11-06 15:53:45 +00:00
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++