ansible_cache/home_linux/install_nfs_client.yml
2024-12-27 12:47:45 +00:00

43 lines
908 B
YAML
Executable File

---
- name: Setup access to NFS
hosts:
- zero
- docker
roles:
- common
become: yes
gather_facts: no
vars_prompt:
name: nfs_server
prompt: 'IP of NFS server: '
private: false
tasks:
- name: Install nfs-common
ansible.builtin.apt:
package:
- nfs-common
state: present
- name: Create directory for mount
ansible.builtin.file:
path: /mnt/seagate
state: directory
mode: '0777'
owner: root
group: root
- name: Add NFS server to fstab
ansible.builtin.lineinfile:
path: /etc/fstab
line: "{{ nfs_server }}:/mnt/seagate /mnt/seagate nfs rw 0 0"
register: result
- name: Reboot host to apply changes
ansible.builtin.reboot:
msg: "Reboot initiated by Ansible"
test_command: uptime
when: result is changed