diff options
author | Romain Gonçalves <me@rgoncalves.se> | 2021-12-11 11:55:55 +0000 |
---|---|---|
committer | Romain Gonçalves <me@rgoncalves.se> | 2021-12-11 11:55:55 +0000 |
commit | 13ef8e5744442b6a6d61a96888f87a1c96c44ba6 (patch) | |
tree | 02d217738020807cbb79bd9cf6b382d8e0f1348d /roles/nfsclient/tasks/main.yml | |
parent | 4c65e7d4cbc3e0bfee426c05e88690ea2a486673 (diff) | |
download | rules-13ef8e5744442b6a6d61a96888f87a1c96c44ba6.tar.gz |
roles: Add nfsclient
Diffstat (limited to 'roles/nfsclient/tasks/main.yml')
-rw-r--r-- | roles/nfsclient/tasks/main.yml | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/roles/nfsclient/tasks/main.yml b/roles/nfsclient/tasks/main.yml new file mode 100644 index 0000000..7799a60 --- /dev/null +++ b/roles/nfsclient/tasks/main.yml @@ -0,0 +1,32 @@ +- name: translate server string to server dict + set_fact: + nfsclient_server_ip: "{{ hostvars[nfsclient_server].__ip.external }}" + when: not nfsclient_server_ip + +- name: include distribution specific prerequisites + include_tasks: "os_{{ ansible_distribution | lower }}.yml" + ignore_errors: true + +- name: create directory on client + file: + path: "{{ nfsclient_dir }}" + owner: 0 + group: 0 + mode: 0755 + state: directory + +- name: cleanup fstab with previous nfs setup + lineinfile: + path: "{{ nfsclient_fstab_path }}" + regexp: ^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:/.* {{ nfsclient_dir }} nfs + state: absent + register: result + +- name: complete fstab with nfs + lineinfile: + path: "{{ nfsclient_fstab_path }}" + line: "{{ nfsclient_server_ip }}:{{ nfsclient_server_dir }}/{{ inventory_hostname }} {{ nfsclient_dir }} nfs rw,nodev,nosuid 0 0" + +- name: reload fstab + shell: mount -a + ignore_errors: true |