ansible-role-basic-system-s.../tasks/ganesha-nfs.yml

74 lines
2.4 KiB
YAML

---
- name: Create the export directory trees
block:
- name: Create the directory of the nextcloud NFS export
ansible.builtin.file:
dest: '{{ san_nextcloud_data_directory_for_export }}'
state: directory
owner: root
group: root
mode: 0755
tags: [ 'san', 'nfs', 'storage', 'ganesha', 'ganesha_export' ]
- name: Repositories and packages on EL
block:
- name: Install storage SIG repositories
ansible.builtin.yum:
name: '{{ nfs_server_ganesha_el_repos }}'
state: present
- name: Install the SAN NFS packages
ansible.builtin.yum:
name: '{{ san_nfs_packages }}'
state: present
- name: Install the files needed to produce a SELinux policy for ganesha
ansible.builtin.copy:
src: '{{ item }}'
dest: '/usr/local/lib/{{ item }}'
owner: root
group: root
mode: 0600
loop:
- ganesha_selinux.pp
- ganesha_selinux.te
register: ganesha_selinux_policy
- name: Generate the SELinux policy module
ansible.builtin.shell: semodule -i /usr/local/lib/ganesha_selinux.pp && touch /usr/local/lib/.ganesha_selinux
when: ganesha_selinux_policy is changed
when: ansible_distribution_file_variety == "RedHat"
- name: Repositories and packages on Ubuntu/Debian
block:
- name: Install the nfs ganesha packages on deb systems
ansible.builtin.apt:
pkg: '{{ nfs_server_ganesha_deb_pkgs }}'
state: present
cache_valid_time: 1800
when: ansible_distribution_file_variety == "Debian"
- name: Install and configure ganesha exports using the VFS backend
block:
- name: Install the ganesha configuration files
template: src={{ item }}.j2 dest=/etc/ganesha/{{ item }} owner=root group=root mode=0644
loop: '{{ san_ganesha_conf_files }}'
register: ganesha_conf_files
- name: Install the ganesha export files
template: src={{ item }}.j2 dest=/etc/ganesha/{{ item }} owner=root group=root mode=0644
loop: '{{ san_ganesha_export_files }}'
register: ganesha_conf_files
- name: Ensure that ganesha is started and enabled
service: name=nfs-ganesha state=started enabled=yes
- name: Reload ganesha after a reconfiguration
service: name=nfs-ganesha state=reloaded
when: ganesha_conf_files is changed
tags: [ 'san', 'nfs', 'storage', 'ganesha', 'ganesha_conf' ]