Commit c2a3424b authored by Thomas Schneider's avatar Thomas Schneider

Use autofs iff it is configured for a host, else fstab

parent 6cbf8c79
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
- name: restart autofs - name: restart autofs
service: name=autofs state=restarted service: name=autofs state=restarted
when: automount
- name: restart nfs-client - name: restart nfs-client
service: name=nfs-client.target state=restarted service: name=nfs-client.target state=restarted
......
...@@ -91,14 +91,17 @@ ...@@ -91,14 +91,17 @@
- nfs-client - nfs-client
- service - service
- name: ensure there is a base directory for automount - name: Configure automount
when: automount
block:
- name: ensure there is a base directory for automount
file: state=directory path=/net owner=root group=root mode=0755 file: state=directory path=/net owner=root group=root mode=0755
notify: notify:
- restart autofs - restart autofs
tags: tags:
- nfs-client - nfs-client
- name: ensure automounter is configured - name: ensure automounter is configured
copy: src=auto.master dest=/etc/auto.master owner=root group=root mode=0644 copy: src=auto.master dest=/etc/auto.master owner=root group=root mode=0644
notify: notify:
- restart autofs - restart autofs
...@@ -106,7 +109,7 @@ ...@@ -106,7 +109,7 @@
- nfs-client - nfs-client
- config - config
- name: ensure mounts from central storage are available - name: ensure mounts from central storage are available
template: src=auto.nfs.j2 dest=/etc/auto.nfs owner=root group=root mode=0644 template: src=auto.nfs.j2 dest=/etc/auto.nfs owner=root group=root mode=0644
notify: notify:
- restart autofs - restart autofs
...@@ -114,18 +117,49 @@ ...@@ -114,18 +117,49 @@
- nfs-client - nfs-client
- config - config
- name: ensure automounter is enabled - name: ensure automounter is enabled
service: name=autofs state=running enabled=yes service: name=autofs state=running enabled=yes
tags: tags:
- nfs-client - nfs-client
- service - service
- name: ensure linking of netdirs - name: ensure linking of netdirs
file: src="/net/{{ item.netdir }}" dest="/{{ item.dest }}" state=link force=yes file: src="/net/{{ item.netdir }}" dest="/{{ item.dest }}" state=link force=yes
with_items: "{{ nfs_shares }}" with_items: "{{ nfs_shares }}"
tags: tags:
- nfs-client - nfs-client
- name: Configure fstab nfs mounts
when: not automount
block:
- name: Disable automounter
service:
name: autofs
state: stopped
enabled: no
tags:
- nfs-client
- service
- name: Ensure mountpoints are directories
file:
path: "/{{item.dest}}"
state: directory
with_items: "{{nfs_shares}}"
tags:
- nfs-client
- name: Create fstab entries
mount:
fstype: "nfs"
src: "{{item.src}}"
path: "/{{item.dest}}"
opts: "{{item.options}}"
state: mounted
with_items: "{{nfs_shares}}"
tags:
- nfs-client
- name: configure default umask and other user related stuff - name: configure default umask and other user related stuff
copy: src=login.defs dest=/etc/login.defs owner=root group=root mode=0644 copy: src=login.defs dest=/etc/login.defs owner=root group=root mode=0644
tags: tags:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment