2022-11-04 20:58:37 +01:00
|
|
|
---
|
|
|
|
# Include variables and define needed variables.
|
|
|
|
- name: Include OS-specific variables.
|
|
|
|
include_vars: "{{ ansible_os_family }}.yml"
|
|
|
|
|
|
|
|
- name: Include overrides specific to Fedora.
|
|
|
|
include_vars: Fedora.yml
|
|
|
|
when:
|
|
|
|
- ansible_os_family == 'RedHat'
|
|
|
|
- ansible_distribution == "Fedora"
|
|
|
|
|
|
|
|
# Setup/install tasks.
|
|
|
|
- include_tasks: setup-RedHat.yml
|
|
|
|
when: ansible_os_family == 'RedHat'
|
|
|
|
|
|
|
|
- include_tasks: setup-Debian.yml
|
|
|
|
when: ansible_os_family == 'Debian'
|
|
|
|
|
|
|
|
- name: Ensure directories to export exist
|
|
|
|
file: # noqa 208
|
|
|
|
path: "{{ item.strip().split()[0] }}"
|
|
|
|
state: directory
|
|
|
|
with_items: "{{ nfs_exports }}"
|
|
|
|
|
|
|
|
- name: Copy exports file.
|
|
|
|
template:
|
|
|
|
src: exports.j2
|
|
|
|
dest: /etc/exports
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
|
|
|
notify: reload nfs
|
|
|
|
|
2022-11-24 18:07:04 +01:00
|
|
|
- name: set port
|
|
|
|
# https://serverfault.com/questions/377170/which-ports-do-i-need-to-open-in-the-firewall-to-use-nfs
|
|
|
|
ansible.builtin.lineinfile:
|
|
|
|
path: /etc/default/nfs-kernel-server
|
|
|
|
regexp: 'RPCMOUNTDOPTS=--manage-gids'
|
|
|
|
line: RPCMOUNTDOPTS="--port {{ nfs_port }}"
|
|
|
|
notify: reload nfs
|
|
|
|
|
2022-11-04 20:58:37 +01:00
|
|
|
- name: Ensure nfs is running.
|
|
|
|
service: "name={{ nfs_server_daemon }} state=started enabled=yes"
|
|
|
|
when: nfs_exports|length
|