autofs/tasks/main.yml

31 lines
1.0 KiB
YAML
Raw Normal View History

2019-01-12 18:12:55 +00:00
#
# tasks for mounts
# systemd uses - for dir separator, so dirs with dashes need escaped according to systemd-escape rules
#
- name: SYSTEMD MOUNT | Install needed packages
package:
name: "{{ item }}"
state: installed
with_items: "{{ systemd_mount_packages }}"
- name: SYSTEMD MOUNT | Setup systemd Service for mountpoints
template:
src: systemd.mount.j2
dest: "/etc/systemd/system/{{ item.value.mount[1:] | replace('-', '\\x2d') | replace('/', '-') }}.mount"
with_dict: "{{ systemd_mounts }}"
notify:
- Reload systemd
- Enable systemd mount
when: item.key in systemd_mounts_enabled
- name: SYSTEMD MOUNT | Setup systemd Service for automount
template:
src: systemd.automount.j2
dest: "/etc/systemd/system/{{ item.value.mount[1:] | replace('-', '\\x2d') | replace('/', '-') }}.automount"
with_dict: "{{ systemd_mounts }}"
notify:
- Reload systemd
- Enable systemd automount
when: item.value.automount is defined and item.value.automount == true and item.key in systemd_mounts_enabled