finish autofs role

This commit is contained in:
vincent 2019-01-27 20:17:42 +01:00
parent c59df1fd13
commit 9950378ea9
3 changed files with 29 additions and 13 deletions

View File

@ -1,12 +1,6 @@
systemd_mounts: {}
systemd_mounts_enabled: []
systemd_mounts_manage_service: {}
systemd_mounts_allow_reload: {}
autofs_mounts_manage_service: {}
autofs_mounts_allow_reload: {}
systemd_mount_packages:
- cifs-utils

View File

@ -2,21 +2,21 @@
- name: Reload systemd
systemd:
daemon_reload: yes
when: systemd_mounts_manage_service
become: yes
- name: Start systemd mount
systemd:
name: "{{ item.value.mount[1:] | replace('-', '\\x2d') | replace('/', \"-\") }}.mount"
state: started
with_dict: "{{ systemd_mounts }}"
when: systemd_mounts_manage_service
become: yes
- name: Start systemd automount
systemd:
name: "{{ item.value.mount[1:] | replace('-', '\\x2d') | replace('/', \"-\") }}.automount"
state: started
with_dict: "{{ systemd_mounts }}"
when: systemd_mounts_manage_service
become: yes
- name: Enable systemd mount
systemd:
@ -26,12 +26,13 @@
notify:
- Start systemd mount
when: item.value.automount == false
become: yes
- name: Enable systemd automount
systemd:
name: "{{ item.value.mount[1:] | replace('-', '\\x2d') | replace('/', \"-\") }}.automount"
enabled: yes
with_dict: "{{ systemd_mounts }}"
notify:
- Start systemd automount
when: item.value.automount == true
become: yes

View File

@ -9,6 +9,21 @@
name: "{{ item }}"
state: installed
with_items: "{{ systemd_mount_packages }}"
become: yes
- name: stat mount directory
stat:
path: "{{item.value.mount}}"
with_dict: "{{ systemd_mounts }}"
register: test_folder
- name: create mount directory if doesn't exist
file:
path: "{{item.item}}"
state: directory
when: item.stat.exists == false
with_items: "{{test_folder.results}}"
become: yes
- name: SYSTEMD MOUNT | Setup systemd Service for mountpoints
template:
@ -18,6 +33,7 @@
notify:
- Reload systemd
- Enable systemd mount
become: yes
when: item.key in systemd_mounts_enabled
- name: SYSTEMD MOUNT | Setup systemd Service for automount
@ -28,4 +44,9 @@
notify:
- Reload systemd
- Enable systemd automount
- Start systemd automount
become: yes
when: item.value.automount is defined and item.value.automount == true and item.key in systemd_mounts_enabled
- name: execute handler
meta: flush_handlers