blob: aca1771f66d79df7f154998f050f5cbfb7ae4036 [file] [log] [blame]
Michal Zegan261023f2018-12-19 11:47:30 +01001---
2- name: Create nfs directory
3 file:
4 path: "{{ nfs_mount_path }}"
5 state: directory
6 mode: 0777
7
Milan Verespej09b5d952019-02-13 12:53:51 +01008- name: Install nfs packages
9 package:
10 name: "{{ item }}"
11 state: present
12 with_items: "{{ nfs_packages[ansible_os_family] }}"
13
Michal Zegan261023f2018-12-19 11:47:30 +010014- name: Setup nfs server
15 block:
16 - name: Start services
17 systemd:
18 name: "{{ item }}"
19 state: started
20 with_items: "{{ nfs_services[ansible_os_family] }}"
21
22 - name: Add hosts to exports
23 template:
24 src: exports.j2
25 dest: /etc/exports
26
27 - name: Export nfs
28 command: exportfs -ar
29 when:
30 - "'nfs-server' in group_names"
31
32- name: Mount dockerdata-nfs
33 mount:
34 path: "{{ nfs_mount_path }}"
35 src: "{{ hostvars[groups['nfs-server'].0].ansible_host }}:{{ nfs_mount_path }}"
36 fstype: nfs
37 state: mounted
38 when:
39 - "'nfs-server' not in group_names"