Support the kernel NFS server.
This commit is contained in:
parent
cb09e576ad
commit
f1aeab4396
|
@ -43,9 +43,30 @@ autofs_packages_el:
|
||||||
autofs_maps: []
|
autofs_maps: []
|
||||||
# - { map_name: 'data', mountpoint_prefix: '/', path: 'data', nfs_server: 'nfs.example.com', remote_export: '/export', is_home: False }
|
# - { map_name: 'data', mountpoint_prefix: '/', path: 'data', nfs_server: 'nfs.example.com', remote_export: '/export', is_home: False }
|
||||||
|
|
||||||
nfs_server_enabled: False
|
nfs_server_enabled: false
|
||||||
nfs_server_ganesha_enabled: '{{ nfs_server_enabled }}'
|
nfs_server_ganesha_enabled: '{{ nfs_server_enabled }}'
|
||||||
|
|
||||||
|
nfs_server_kernel_el_pkgs:
|
||||||
|
- nfs-utils
|
||||||
|
- nfs4-acl-tools
|
||||||
|
|
||||||
|
nfs_server_kernel_deb_pkgs:
|
||||||
|
- nfs-kernel-server
|
||||||
|
- nfs4-acl-tools
|
||||||
|
- nfstrace
|
||||||
|
- nfswatch
|
||||||
|
|
||||||
|
nfs_server_exports: []
|
||||||
|
# name, id, path, options, clients
|
||||||
|
# (*) indicate an optional parameter
|
||||||
|
# - name: export_filename
|
||||||
|
# id: 1
|
||||||
|
# path: /export
|
||||||
|
# options: 'rw,sync,fsid=1,root_squash,no_wdelay'
|
||||||
|
# clients:
|
||||||
|
# - host1
|
||||||
|
# - hostN
|
||||||
|
|
||||||
nfs_ganesha_conf_files:
|
nfs_ganesha_conf_files:
|
||||||
- ganesha.conf
|
- ganesha.conf
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
mode: 0755
|
mode: 0755
|
||||||
loop: '{{ nfs_server_ganesha_exports }}'
|
loop: '{{ nfs_server_ganesha_exports }}'
|
||||||
|
|
||||||
tags: [ 'san', 'nfs', 'storage', 'ganesha', 'ganesha_export' ]
|
tags: ['san', 'nfs', 'storage', 'ganesha', 'ganesha_export']
|
||||||
|
|
||||||
- name: Repositories and packages on EL
|
- name: Repositories and packages on EL
|
||||||
block:
|
block:
|
||||||
|
@ -41,21 +41,28 @@
|
||||||
when: ganesha_selinux_policy is changed
|
when: ganesha_selinux_policy is changed
|
||||||
|
|
||||||
when: ansible_distribution_file_variety == "RedHat"
|
when: ansible_distribution_file_variety == "RedHat"
|
||||||
|
tags: ['san', 'nfs', 'storage', 'ganesha', 'ganesha_pkg']
|
||||||
|
|
||||||
- name: Repositories and packages on Ubuntu/Debian
|
- name: Repositories and packages on Ubuntu/Debian
|
||||||
block:
|
block:
|
||||||
- name: Install the nfs ganesha packages on deb systems
|
- name: Install the nfs ganesha packages on deb systems
|
||||||
ansible.builtin.apt:
|
apt:
|
||||||
pkg: '{{ nfs_server_ganesha_deb_pkgs }}'
|
pkg: '{{ nfs_server_ganesha_deb_pkgs }}'
|
||||||
state: present
|
state: present
|
||||||
cache_valid_time: 1800
|
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"
|
when: ansible_distribution_file_variety == "Debian"
|
||||||
|
tags: ['san', 'nfs', 'storage', 'ganesha', 'ganesha_pkg']
|
||||||
|
|
||||||
- name: Install and configure ganesha exports using the VFS backend
|
- name: Install and configure ganesha exports using the VFS backend
|
||||||
block:
|
block:
|
||||||
- name: Install the ganesha configuration files
|
- name: Install the ganesha configuration files
|
||||||
ansible.builtin.template:
|
template:
|
||||||
src: '{{ item }}.j2'
|
src: '{{ item }}.j2'
|
||||||
dest: '/etc/ganesha/{{ item }}'
|
dest: '/etc/ganesha/{{ item }}'
|
||||||
owner: root
|
owner: root
|
||||||
|
@ -65,7 +72,7 @@
|
||||||
register: ganesha_conf_files
|
register: ganesha_conf_files
|
||||||
|
|
||||||
- name: Install the ganesha export files
|
- name: Install the ganesha export files
|
||||||
ansible.builtin.template:
|
template:
|
||||||
src: ganesha-export.conf.j2
|
src: ganesha-export.conf.j2
|
||||||
dest: '/etc/ganesha/{{ item.name }}.conf'
|
dest: '/etc/ganesha/{{ item.name }}.conf'
|
||||||
owner: root
|
owner: root
|
||||||
|
@ -74,6 +81,13 @@
|
||||||
loop: '{{ nfs_server_ganesha_exports }}'
|
loop: '{{ nfs_server_ganesha_exports }}'
|
||||||
register: ganesha_conf_files
|
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
|
- name: Ensure that ganesha is started and enabled
|
||||||
service: name=nfs-ganesha state=started enabled=yes
|
service: name=nfs-ganesha state=started enabled=yes
|
||||||
|
|
||||||
|
@ -81,4 +95,4 @@
|
||||||
service: name=nfs-ganesha state=reloaded
|
service: name=nfs-ganesha state=reloaded
|
||||||
when: ganesha_conf_files is changed
|
when: ganesha_conf_files is changed
|
||||||
|
|
||||||
tags: [ 'san', 'nfs', 'storage', 'ganesha', 'ganesha_conf' ]
|
tags: ['san', 'nfs', 'storage', 'ganesha', 'ganesha_conf']
|
||||||
|
|
|
@ -11,3 +11,7 @@
|
||||||
- import_tasks: trusted_ca.yml
|
- import_tasks: trusted_ca.yml
|
||||||
- ansible.builtin.import_tasks: ganesha-nfs.yml
|
- ansible.builtin.import_tasks: ganesha-nfs.yml
|
||||||
when: nfs_server_ganesha_enabled
|
when: nfs_server_ganesha_enabled
|
||||||
|
- import_tasks: nfs-kernel-server.yml
|
||||||
|
when:
|
||||||
|
- nfs_server_enanbled
|
||||||
|
- not nfs_server_ganesha_enabled
|
||||||
|
|
|
@ -0,0 +1,75 @@
|
||||||
|
---
|
||||||
|
- name: Create the export directory trees
|
||||||
|
block:
|
||||||
|
- name: Create the directory of the nextcloud NFS export
|
||||||
|
ansible.builtin.file:
|
||||||
|
dest: '{{ item.path }}'
|
||||||
|
state: directory
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0755
|
||||||
|
loop: '{{ nfs_server_exports }}'
|
||||||
|
|
||||||
|
tags: ['san', 'nfs', 'storage', 'kernel_nfs']
|
||||||
|
|
||||||
|
- name: Repositories and packages on EL
|
||||||
|
block:
|
||||||
|
- name: Install the NFS packages on EL
|
||||||
|
yum:
|
||||||
|
name: '{{ nfs_server_kernel_el_pkgs }}'
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Ensure that the Ganesha NFS server is not installed
|
||||||
|
yum:
|
||||||
|
name: nfs-ganesha
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
when: ansible_distribution_file_variety == "RedHat"
|
||||||
|
tags: ['san', 'nfs', 'storage', 'kernel_nfs']
|
||||||
|
|
||||||
|
- name: Repositories and packages on Ubuntu/Debian
|
||||||
|
block:
|
||||||
|
- name: Install the nfs packages on deb systems
|
||||||
|
apt:
|
||||||
|
pkg: '{{ nfs_server_kernel_deb_pkgs }}'
|
||||||
|
state: present
|
||||||
|
cache_valid_time: 1800
|
||||||
|
|
||||||
|
- name: Ensure that the ganesha server package is not installed
|
||||||
|
apt:
|
||||||
|
pkg: nfs-ganesha
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
when: ansible_distribution_file_variety == "Debian"
|
||||||
|
tags: ['san', 'nfs', 'storage', 'kernel_nfs']
|
||||||
|
|
||||||
|
- name: Manage the NFS exports
|
||||||
|
block:
|
||||||
|
- name: Install the NFS export file
|
||||||
|
template:
|
||||||
|
src: 'kernel-nfs-exports.j2'
|
||||||
|
dest: '/etc/exports'
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0644
|
||||||
|
register: update_exportfs
|
||||||
|
|
||||||
|
- name: Ensure that the Kernel NFS service is started and enabled on EL
|
||||||
|
service:
|
||||||
|
name: nfs-server
|
||||||
|
state: started
|
||||||
|
enabled: true
|
||||||
|
when: ansible_distribution_file_variety == "RedHat"
|
||||||
|
|
||||||
|
- name: Ensure that the Kernel NFS service is started and enabled on deb systems
|
||||||
|
service:
|
||||||
|
name: nfs-kernel-server
|
||||||
|
state: started
|
||||||
|
enabled: true
|
||||||
|
when: ansible_distribution_file_variety == "Debian"
|
||||||
|
|
||||||
|
- name: Refresh the exports
|
||||||
|
shell: exportfs -a
|
||||||
|
when: update_exportfs is changed
|
||||||
|
|
||||||
|
tags: ['san', 'nfs', 'storage', 'kernel_nfs', 'kernel_nfs_conf']
|
|
@ -0,0 +1 @@
|
||||||
|
{{ item.path }} {% for c in item.clients %}{{ c }}({{ item.options }}) {% endfor %}
|
Loading…
Reference in New Issue