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

99 lines
2.9 KiB
YAML
Raw Normal View History

2022-03-21 14:28:24 +01:00
---
- name: Create the export directory trees
block:
2022-06-01 12:41:12 +02:00
- name: Create the directory of the NFS exports
2022-03-21 14:28:24 +01:00
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
2022-05-22 16:56:09 +02:00
tags: ['san', 'nfs', 'storage', 'ganesha', 'ganesha_export']
2022-03-21 14:28:24 +01:00
- 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"
2022-05-22 16:56:09 +02:00
tags: ['san', 'nfs', 'storage', 'ganesha', 'ganesha_pkg']
2022-03-21 14:28:24 +01:00
- name: Repositories and packages on Ubuntu/Debian
block:
2022-05-22 16:56:09 +02:00
- 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
2022-03-21 14:28:24 +01:00
when: ansible_distribution_file_variety == "Debian"
2022-05-22 16:56:09 +02:00
tags: ['san', 'nfs', 'storage', 'ganesha', 'ganesha_pkg']
2022-03-21 14:28:24 +01:00
2022-05-22 16:56:09 +02:00
- name: Install and configure ganesha exports using the VFS backend
2022-03-21 14:28:24 +01:00
block:
- name: Install the ganesha configuration files
2022-05-22 16:56:09 +02:00
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
2022-05-22 16:56:09 +02:00
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
2022-05-22 16:56:09 +02:00
- 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"
2022-03-21 14:28:24 +01:00
- 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
2022-05-22 16:56:09 +02:00
tags: ['san', 'nfs', 'storage', 'ganesha', 'ganesha_conf']