From 261023f9c3c93d9a1c207dfdce841ff5490504d3 Mon Sep 17 00:00:00 2001 From: Michal Zegan Date: Wed, 19 Dec 2018 11:47:30 +0100 Subject: Add ansible nfs role This commit adds role for creating /dockerdata-nfs and exporting i over nfs for later use during onap deployment. Change-Id: I0ea8e858d581534b983eaab6e1ee570068fc623c Issue-ID: OOM-1551 Signed-off-by: Michal Zegan --- ansible/roles/nfs/tasks/main.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 ansible/roles/nfs/tasks/main.yml (limited to 'ansible/roles/nfs/tasks/main.yml') 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" -- cgit 1.2.3-korg