diff options
Diffstat (limited to 'deployment/noheat/cluster-rke/ansible/roles/setup_nfs')
3 files changed, 56 insertions, 0 deletions
diff --git a/deployment/noheat/cluster-rke/ansible/roles/setup_nfs/defaults/main.yml b/deployment/noheat/cluster-rke/ansible/roles/setup_nfs/defaults/main.yml new file mode 100644 index 000000000..da66bfb38 --- /dev/null +++ b/deployment/noheat/cluster-rke/ansible/roles/setup_nfs/defaults/main.yml @@ -0,0 +1,2 @@ +--- +nfs_mountpoint: "/dockerdata-nfs" diff --git a/deployment/noheat/cluster-rke/ansible/roles/setup_nfs/tasks/main.yml b/deployment/noheat/cluster-rke/ansible/roles/setup_nfs/tasks/main.yml new file mode 100644 index 000000000..398b56317 --- /dev/null +++ b/deployment/noheat/cluster-rke/ansible/roles/setup_nfs/tasks/main.yml @@ -0,0 +1,53 @@ +- name: Install NFS common + apt: + name: nfs-common + state: present + when: nfs_role is defined + +- name: Install NFS server + apt: + name: nfs-kernel-server + state: present + when: nfs_role is defined and nfs_role == "server" + +- name: Remove leftovers + file: + path: "{{ nfs_mountpoint }}" + state: absent + when: nfs_role is defined + +- name: Create dockerdata directory + file: + path: "{{ nfs_mountpoint }}" + state: directory + mode: '0777' + owner: nobody + group: nogroup + when: nfs_role is defined + +- name: Configure NFS server + template: + src: "exports.j2" + dest: "/etc/exports" + owner: root + group: root + mode: '0644' + when: nfs_role is defined and nfs_role == "server" + +- name: Restart NFS server + service: + name: nfs-kernel-server + state: restarted + enabled: yes + when: nfs_role is defined and nfs_role == "server" + +- name: Configure NFS clients + mount: + path: "{{ nfs_mountpoint }}" + src: "{{ hostvars[groups['nfs'][0]]['ansible_default_ipv4']['address'] }}:{{ nfs_mountpoint }}" + fstype: nfs + opts: auto,nofail,noatime,nolock,intr,tcp,actimeo=1800 + dump: 0 + passno: 0 + state: mounted + when: nfs_role is defined and nfs_role == "client" diff --git a/deployment/noheat/cluster-rke/ansible/roles/setup_nfs/templates/exports.j2 b/deployment/noheat/cluster-rke/ansible/roles/setup_nfs/templates/exports.j2 new file mode 100644 index 000000000..edadcb9bd --- /dev/null +++ b/deployment/noheat/cluster-rke/ansible/roles/setup_nfs/templates/exports.j2 @@ -0,0 +1 @@ +{{ nfs_mountpoint }} {% for host in (groups['control'] | union(groups['workers'])) %} {{ hostvars[host]['ansible_default_ipv4']['address'] }}{% endfor %}(rw,sync,no_root_squash,no_subtree_check) |