blob: e7580b661000ae6e2a5ccbb4f2282678c29be9c2 [file] [log] [blame]
---
- name: Create nfs directory
file:
path: "{{ nfs_mount_path }}"
state: directory
mode: 0777
- name: Install nfs packages
package:
name: "{{ item }}"
state: present
loop: "{{ nfs_packages[ansible_os_family] }}"
- name: Setup nfs server
block:
- name: Start services
systemd:
name: "{{ item }}"
state: started
enabled: true
loop: "{{ nfs_services[ansible_os_family] }}"
- name: Add hosts to exports
template:
src: exports.j2
dest: /etc/exports
notify:
- reload nfs
when:
- "'nfs-server' in group_names"
- name: Force notified handlers to run at this point
meta: flush_handlers
- name: Mount dockerdata-nfs
mount:
path: "{{ nfs_mount_path }}"
src: "{{ hostvars[groups['nfs-server'].0].ansible_host | default(hostvars[groups['nfs-server'].0].inventory_hostname) }}:{{ nfs_mount_path }}"
fstype: nfs
state: mounted
when:
- "'nfs-server' not in group_names"