2021-02-16 16:10:13 +01:00
|
|
|
---
|
|
|
|
- name: Install and configure autofs on Ubuntu/Debian
|
|
|
|
block:
|
|
|
|
- name: Install the autofs packages on Ubuntu/Debian
|
|
|
|
apt: pkg={{ autofs_packages_deb }} state=present cache_valid_time=1800
|
|
|
|
|
|
|
|
when: ansible_distribution_file_variety == "Debian"
|
|
|
|
tags: [ 'nfs', 'autofs' ]
|
|
|
|
|
|
|
|
- name: Install and configure autofs on EL
|
|
|
|
block:
|
2021-06-23 15:40:25 +02:00
|
|
|
- name: Install the autofs packages on EL
|
2021-02-16 16:10:13 +01:00
|
|
|
yum: pkg={{ autofs_packages_el }} state=present
|
|
|
|
|
|
|
|
when: ansible_distribution_file_variety == "RedHat"
|
|
|
|
tags: [ 'nfs', 'autofs' ]
|
|
|
|
|
|
|
|
- name: Configure autofs and its maps
|
|
|
|
block:
|
|
|
|
- name: Create the mount points
|
2021-02-16 16:50:52 +01:00
|
|
|
file: dest={{ item.mountpoint_prefix }} state=directory owner=root group=root mode=0755
|
2021-02-16 16:10:13 +01:00
|
|
|
with_items: '{{ autofs_maps }}'
|
|
|
|
|
2021-07-01 17:14:16 +02:00
|
|
|
- name: setup idmap.conf
|
|
|
|
ini_file:
|
|
|
|
path: /etc/idmapd.conf
|
|
|
|
section: '{{ item.section }}'
|
|
|
|
option: '{{ item.option }}'
|
|
|
|
value: '{{ item.value }}'
|
|
|
|
state: '{{ item.state }}'
|
|
|
|
owner: 'root'
|
|
|
|
group: 'root'
|
|
|
|
mode: '0644'
|
|
|
|
create: no
|
|
|
|
loop: '{{ idmap_conf_options }}'
|
|
|
|
|
2021-06-23 15:40:25 +02:00
|
|
|
- name: setup autofs.conf
|
|
|
|
ini_file:
|
|
|
|
path: /etc/autofs.conf
|
|
|
|
section: '{{ item.section }}'
|
|
|
|
option: '{{ item.option }}'
|
|
|
|
value: '{{ item.value }}'
|
|
|
|
state: '{{ item.state }}'
|
2021-06-23 16:02:41 +02:00
|
|
|
owner: 'root'
|
|
|
|
group: 'root'
|
|
|
|
mode: '0644'
|
2021-06-23 15:40:25 +02:00
|
|
|
create: no
|
|
|
|
loop: '{{ autofs_conf_options }}'
|
|
|
|
|
2021-02-16 16:10:13 +01:00
|
|
|
- name: Install the autofs master configuration
|
|
|
|
template: src=auto.master.j2 dest=/etc/auto.master owner=root group=root mode=0644
|
|
|
|
register: reg_autofs_master_conf
|
|
|
|
|
|
|
|
- name: Install the autofs map files
|
|
|
|
template: src=auto.data.j2 dest=/etc/auto.{{ item.map_name }} owner=root group=root mode=0644
|
|
|
|
with_items: '{{ autofs_maps }}'
|
|
|
|
register: autofs_conf
|
|
|
|
|
|
|
|
- name: Ensure that autofs is enabled and running
|
|
|
|
service: name=autofs state=started enabled=yes
|
|
|
|
|
|
|
|
- name: Restart autofs if the configuration changed
|
|
|
|
service: name=autofs state=restarted
|
|
|
|
when: reg_autofs_master_conf is changed
|
|
|
|
|
2021-02-16 16:23:23 +01:00
|
|
|
tags: [ 'nfs', 'autofs', 'autofs_conf' ]
|