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

99 lines
2.9 KiB
YAML

---
- name: Create the export directory trees
block:
- name: Create the directory of the NFS exports
ansible.builtin.file:
dest: '{{ item.path }}'
state: directory
owner: root
group: root
mode: 0755
loop: '{{ nfs_server_ganesha_exports }}'
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: '{{ nfs_server_ganesha_el_pkgs }}'
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"
tags: ['san', 'nfs', 'storage', 'ganesha', 'ganesha_pkg']
- name: Repositories and packages on Ubuntu/Debian
block:
- name: Install the nfs ganesha packages on deb systems
apt:
pkg: '{{ nfs_server_ganesha_deb_pkgs }}'
state: present
cache_valid_time: 1800
- name: Ensure that the kernel NFS server package is not installed
apt:
pkg: nfs-kernel-server
state: absent
when: ansible_distribution_file_variety == "Debian"
tags: ['san', 'nfs', 'storage', 'ganesha', 'ganesha_pkg']
- 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: '{{ nfs_ganesha_conf_files }}'
register: ganesha_conf_files
- name: Install the ganesha export files
template:
src: ganesha-export.conf.j2
dest: '/etc/ganesha/{{ item.name }}.conf'
owner: root
group: root
mode: 0644
loop: '{{ nfs_server_ganesha_exports }}'
register: ganesha_conf_files
- name: Ensure that the Kernel NFS service is stopped on EL
service:
name: nfs-server
state: stopped
enabled: false
when: ansible_distribution_file_variety == "RedHat"
- 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']