autofs/handlers/main.yml

40 lines
1.1 KiB
YAML

- name: Reload systemd
systemd:
daemon_reload: yes
become: yes
- name: Enable systemd mount
systemd:
name: "{{ item.value.mount[1:] | replace('-', '\\x2d') | replace('/', \"-\") }}.mount"
enabled: yes
with_dict: "{{ systemd_mounts }}"
when: item.value.automount == false and item.value.enabled==true
become: yes
- name: Enable systemd automount
systemd:
name: "{{ item.value.mount[1:] | replace('-', '\\x2d') | replace('/', \"-\") }}.automount"
enabled: yes
with_dict: "{{ systemd_mounts }}"
when: item.value.automount == true and item.value.enabled==true
become: yes
- name: Start systemd mount
systemd:
name: "{{ item.value.mount[1:] | replace('-', '\\x2d') | replace('/', \"-\") }}.mount"
state: started
with_dict: "{{ systemd_mounts }}"
when: item.value.automount == false and item.value.enabled==true
become: yes
- name: Start systemd automount
systemd:
name: "{{ item.value.mount[1:] | replace('-', '\\x2d') | replace('/', \"-\") }}.automount"
state: started
with_dict: "{{ systemd_mounts }}"
when: item.value.automount == true and item.value.enabled==true
become: yes