ceph-ansible/roles/ceph-nfs/tasks/main.yml

81 lines
2.9 KiB
YAML

---
# global/common requirement
- name: stop nfs server service
systemd:
name: "{{ 'nfs-server' if ansible_facts['os_family'] == 'RedHat' else 'nfsserver' if ansible_facts['os_family'] == 'Suse' else 'nfs-kernel-server' if ansible_facts['os_family'] == 'Debian' }}"
state: stopped
enabled: no
failed_when: false
- name: include pre_requisite_non_container.yml
include_tasks: pre_requisite_non_container.yml
when: not containerized_deployment | bool
- name: include pre_requisite_container.yml
include_tasks: pre_requisite_container.yml
when: containerized_deployment | bool
- name: include create_rgw_nfs_user.yml
import_tasks: create_rgw_nfs_user.yml
when: groups.get(mon_group_name, []) | length > 0
- name: install nfs-ganesha-selinux on RHEL 8
package:
name: nfs-ganesha-selinux
state: present
register: result
until: result is succeeded
when:
- not containerized_deployment | bool
- inventory_hostname in groups.get(nfs_group_name, [])
- ansible_facts['os_family'] == 'RedHat'
- ansible_facts['distribution_major_version'] == '8'
# NOTE (leseb): workaround for issues with ganesha and librgw
- name: add ganesha_t to permissive domain
selinux_permissive:
name: ganesha_t
permissive: true
failed_when: false
when:
- not containerized_deployment | bool
- ansible_facts['os_family'] == 'RedHat'
- ansible_facts['selinux']['status'] == 'enabled'
- name: nfs with external ceph cluster task related
when:
- groups.get(mon_group_name, []) | length == 0
- ceph_nfs_ceph_user is defined
block:
- name: create keyring directory
file:
path: "/var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ item }}"
state: directory
owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}"
group: "{{ ceph_uid if containerized_deployment else 'ceph' }}"
mode: "0755"
with_items:
- "{{ ceph_nfs_ceph_user }}"
- "{{ ansible_facts['hostname'] }}"
- name: set_fact rgw_client_name
set_fact:
rgw_client_name: "client.rgw.{{ ceph_nfs_ceph_user }}"
- name: get client cephx keys
copy:
dest: "{{ item.1 }}"
content: "{{ item.0.content | b64decode }}"
mode: "{{ item.0.item.get('mode', '0600') }}"
owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}"
group: "{{ ceph_uid if containerized_deployment else 'ceph' }}"
with_nested:
- "{{ hostvars[groups['_filtered_clients'][0]]['slurp_client_keys']['results'] | default([]) }}"
- ['/var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ ceph_nfs_ceph_user }}/keyring', "/var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ ansible_facts['hostname'] }}/keyring"]
when:
- not item.0.get('skipped', False)
- item.0.item.name == 'client.' + ceph_nfs_ceph_user or item.0.item.name == rgw_client_name
- name: include start_nfs.yml
import_tasks: start_nfs.yml