aboutsummaryrefslogtreecommitdiffstats
path: root/roles/nfsd/tasks/main.yml
diff options
context:
space:
mode:
Diffstat (limited to 'roles/nfsd/tasks/main.yml')
-rw-r--r--roles/nfsd/tasks/main.yml35
1 files changed, 35 insertions, 0 deletions
diff --git a/roles/nfsd/tasks/main.yml b/roles/nfsd/tasks/main.yml
new file mode 100644
index 0000000..7be5f2a
--- /dev/null
+++ b/roles/nfsd/tasks/main.yml
@@ -0,0 +1,35 @@
+- name: create nfsd data directory
+ file:
+ path: "{{ nfsd_data_dir }}"
+ owner: 0
+ group: 0
+ mode: 0700
+ state: directory
+
+- name: create hosts directories
+ file:
+ path: "{{ nfsd_data_dir }}/{{ item }}"
+ owner: 0
+ group: 0
+ mode: 0777
+ state: directory
+ loop: "{{ nfsd_shared_dirs }}"
+
+- name: generate nfsd configuration
+ template:
+ src: exports.j2
+ dest: /etc/exports
+ owner: root
+ mode: 0640
+ register: result
+
+- name: enable and start nfsd service
+ service: &nfsd_service
+ name: nfsd
+ state: "{{ 'restarted' if result.changed else 'started' }}"
+ enabled: true
+
+- name: enable and restart mountd
+ service:
+ <<: *nfsd_service
+ name: mountd
remember that computers suck.