aboutsummaryrefslogtreecommitdiffstats
path: root/roles/nfsclient/tasks
diff options
context:
space:
mode:
authorRomain Gonçalves <me@rgoncalves.se>2021-07-29 17:00:20 +0200
committerRomain Gonçalves <me@rgoncalves.se>2021-07-29 17:00:20 +0200
commitb232b894c3cbe087c8d504e91637dcf62199eed1 (patch)
treeea72a7d1a7f63c6425ee46785e1cec924351b2c3 /roles/nfsclient/tasks
parent22126073344e60c405d086df37b64da0c6d3c086 (diff)
downloadinfrastructure-b232b894c3cbe087c8d504e91637dcf62199eed1.tar.gz
Bump to third revision of homelab
Diffstat (limited to 'roles/nfsclient/tasks')
-rw-r--r--roles/nfsclient/tasks/main.yml50
1 files changed, 10 insertions, 40 deletions
diff --git a/roles/nfsclient/tasks/main.yml b/roles/nfsclient/tasks/main.yml
index 879ed9e..79caf84 100644
--- a/roles/nfsclient/tasks/main.yml
+++ b/roles/nfsclient/tasks/main.yml
@@ -4,19 +4,9 @@
---
-- name: fallback to default nfs server
+- name: translate server string to server dict
set_fact:
- nfsclient_server: "{{ global.nfs_server }}"
- when: nfsclient_server is not defined
-
-- name: fallback default nfs server directory
- set_fact:
- nfsclient_server_dir: "{{ global.nfs_server_dir }}"
- when: nfsclient_server_dir is not defined
-
-- name: translate server string to server dict if not
- set_fact:
- nfsclient_server: "{{ hostvars[nfsclient_server] }}"
+ nfsclient_server_: "{{ hostvars[nfsclient_server] }}"
- name: include distribution specific prerequisites
include_tasks: "_{{ ansible_distribution | lower }}.yml"
@@ -29,9 +19,9 @@
group: "0"
mode: "755"
state: directory
- delegate_to: "{{ nfsclient_server.ansible_host }}"
+ delegate_to: "{{ nfsclient_server_.ansible_host }}"
-- name: ensure directory exists on local machine
+- name: ensure directory exists on client
file:
path: "{{ nfsclient_dir }}"
owner: "0"
@@ -43,45 +33,25 @@
- result.failed
- '"Errno 17" not in result.msg'
-- name: ensure tmp directory exists for testing nfsd
- file:
- path: "{{ nfsclient_test_dir }}"
- owner: "0"
- group: "0"
- mode: "0700"
- state: directory
-
-- name: test nfs setup
- shell: mount -t nfs "{{ nfsclient_server.ip.out }}:{{ nfsclient_server_dir }}" /tmp/nfsd-test
-
- name: cleanup fstab with previous nfs setup
lineinfile:
path: /etc/fstab
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: /etc/fstab
- line: "{{ nfsclient_server.ip.out }}:{{ nfsclient_server_dir }} {{ nfsclient_dir }} nfs rw,nodev,nosuid 0 0"
+ line: "{{ nfsclient_server_.ip.out }}:{{ nfsclient_server_dir }} {{ nfsclient_dir }} nfs rw,nodev,nosuid 0 0"
- name: reload fstab
- shell: |
- umount -af -t nfs
- mount -a
+ shell: mount -a
ignore_errors: true
-- name: remove nfs test directory
- file:
- path: "{{ nfsclient_test_dir }}"
- state: absent
-
-- name: register mounted volumes
- shell: df -P | grep nfs
- register: out
+- name: reload facts
+ setup:
- name: display mounted volumes
debug:
- msg: |
- {{ out.stdout_lines }}
- {{ out.stderr_lines }}
+ var: ansible_mounts
remember that computers suck.