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

85 lines
2.5 KiB
YAML
Raw Normal View History

2022-03-21 14:28:24 +01:00
---
- name: Create the export directory trees
block:
- name: Create the directory of the nextcloud NFS export
ansible.builtin.file:
2022-03-21 18:52:05 +01:00
dest: '{{ item.path }}'
2022-03-21 14:28:24 +01:00
state: directory
owner: root
group: root
mode: 0755
2022-03-21 18:52:05 +01:00
loop: '{{ nfs_server_ganesha_exports }}'
2022-03-21 14:28:24 +01:00
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:
2022-03-21 19:08:27 +01:00
name: '{{ nfs_server_ganesha_el_pkgs }}'
2022-03-21 14:28:24 +01:00
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
ansible.builtin.template:
src: '{{ item }}.j2'
dest: '/etc/ganesha/{{ item }}'
owner: root
group: root
mode: 0644
loop: '{{ nfs_ganesha_conf_files }}'
2022-03-21 14:28:24 +01:00
register: ganesha_conf_files
- name: Install the ganesha export files
ansible.builtin.template:
src: ganesha-export.conf.j2
2022-03-21 19:21:02 +01:00
dest: '/etc/ganesha/{{ item.name }}.conf'
owner: root
group: root
mode: 0644
loop: '{{ nfs_server_ganesha_exports }}'
2022-03-21 14:28:24 +01:00
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' ]