summaryrefslogtreecommitdiffstats
path: root/ansible/roles/nfs/tasks
diff options
context:
space:
mode:
authorMichal Ptacek <m.ptacek@partner.samsung.com>2018-12-19 11:32:51 +0000
committerGerrit Code Review <gerrit@onap.org>2018-12-19 11:32:51 +0000
commitd21977bd82508b90c8bfda24111ac4a693256e70 (patch)
tree0887654e1d8acc9078734229f3a311b9f4c0da1e /ansible/roles/nfs/tasks
parent7820ba65b8183c60582e5f302e3f559a1299b14d (diff)
parent261023f9c3c93d9a1c207dfdce841ff5490504d3 (diff)
Merge "Add ansible nfs role"
Diffstat (limited to 'ansible/roles/nfs/tasks')
-rw-r--r--ansible/roles/nfs/tasks/main.yml33
1 files changed, 33 insertions, 0 deletions
diff --git a/ansible/roles/nfs/tasks/main.yml b/ansible/roles/nfs/tasks/main.yml
new file mode 100644
index 00000000..32194d13
--- /dev/null
+++ b/ansible/roles/nfs/tasks/main.yml
@@ -0,0 +1,33 @@
+---
+- name: Create nfs directory
+ file:
+ path: "{{ nfs_mount_path }}"
+ state: directory
+ mode: 0777
+
+- name: Setup nfs server
+ block:
+ - name: Start services
+ systemd:
+ name: "{{ item }}"
+ state: started
+ with_items: "{{ nfs_services[ansible_os_family] }}"
+
+ - name: Add hosts to exports
+ template:
+ src: exports.j2
+ dest: /etc/exports
+
+ - name: Export nfs
+ command: exportfs -ar
+ when:
+ - "'nfs-server' in group_names"
+
+- name: Mount dockerdata-nfs
+ mount:
+ path: "{{ nfs_mount_path }}"
+ src: "{{ hostvars[groups['nfs-server'].0].ansible_host }}:{{ nfs_mount_path }}"
+ fstype: nfs
+ state: mounted
+ when:
+ - "'nfs-server' not in group_names"