ansible/roles/nfs-client/tasks/main.yml

25 lines
677 B
YAML
Raw Normal View History

2021-01-17 12:31:30 +01:00
---
# Install NFS client, mount distant storage and add configuration to fstab to make it persistent
- name: Install NFS client
apt:
name:
2021-01-17 12:47:58 +01:00
- nfs-common # use this on any NFS machine, be either client or server
2021-01-17 12:31:30 +01:00
update_cache: true
2021-01-17 12:47:58 +01:00
- name: Create mountable dir
2021-01-17 12:31:30 +01:00
file:
path: "{{ nfs.mount_path }}"
2021-01-17 12:31:30 +01:00
state: directory
mode: 0755
owner: "{{ nfs.dir_owner }}"
group: "{{ nfs.dir_group }}"
2021-01-17 12:31:30 +01:00
- name: Mount and add to fstab
mount:
state: mounted # actively mounted and configured in fstab
2021-01-17 12:47:58 +01:00
src: "{{ nfs.src }}"
path: "{{ nfs.mount_path }}"
2021-01-17 12:31:30 +01:00
fstype: nfs
opts: defaults
# don't specify dump and fsck to keep the 0 (don't) variable