2017-09-19 22:19:14 +08:00
|
|
|
---
|
2019-05-20 21:58:10 +08:00
|
|
|
- block:
|
2021-04-09 16:01:13 +08:00
|
|
|
- name: set_fact exec_cmd_nfs - external
|
2019-05-20 21:58:10 +08:00
|
|
|
set_fact:
|
2020-05-06 21:31:34 +08:00
|
|
|
exec_cmd_nfs: "{{ container_binary + ' run --rm --net=host -v /etc/ceph:/etc/ceph:z -v /var/lib/ceph/:/var/lib/ceph/:z -v /var/log/ceph/:/var/log/ceph/:z --entrypoint=rados ' + ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else 'rados' }} -n client.{{ ceph_nfs_ceph_user }} -k /var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ ceph_nfs_ceph_user }}/keyring"
|
|
|
|
delegate_node: "{{ inventory_hostname }}"
|
|
|
|
when: groups.get(mon_group_name, []) | length == 0
|
|
|
|
|
2021-04-09 16:01:13 +08:00
|
|
|
- name: set_fact exec_cmd_nfs - internal
|
2020-05-06 21:31:34 +08:00
|
|
|
set_fact:
|
2021-03-03 22:43:50 +08:00
|
|
|
exec_cmd_nfs: "{{ container_binary + ' exec ceph-mon-' + hostvars[groups[mon_group_name][0]]['ansible_facts']['hostname'] if containerized_deployment | bool else '' }} rados"
|
2020-05-06 21:31:34 +08:00
|
|
|
delegate_node: "{{ groups[mon_group_name][0] }}"
|
|
|
|
when: groups.get(mon_group_name, []) | length > 0
|
2018-09-01 22:32:51 +08:00
|
|
|
|
2019-05-20 21:58:10 +08:00
|
|
|
- name: check if rados index object exists
|
2020-04-10 17:05:25 +08:00
|
|
|
shell: "{{ exec_cmd_nfs | default('') }} -p {{ cephfs_data_pool.name }} --cluster {{ cluster }} ls|grep {{ ceph_nfs_rados_export_index }}"
|
2019-05-20 21:58:10 +08:00
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
|
|
|
register: rados_index_exists
|
|
|
|
check_mode: no
|
2019-05-22 16:02:42 +08:00
|
|
|
when: ceph_nfs_rados_backend | bool
|
2020-05-06 21:31:34 +08:00
|
|
|
delegate_to: "{{ delegate_node }}"
|
2019-05-20 21:58:10 +08:00
|
|
|
run_once: true
|
2017-11-15 19:59:36 +08:00
|
|
|
|
2019-05-20 21:58:10 +08:00
|
|
|
- name: create an empty rados index object
|
2020-04-10 17:05:25 +08:00
|
|
|
command: "{{ exec_cmd_nfs | default('') }} -p {{ cephfs_data_pool.name }} --cluster {{ cluster }} put {{ ceph_nfs_rados_export_index }} /dev/null"
|
2019-05-20 21:58:10 +08:00
|
|
|
when:
|
2019-05-22 16:02:42 +08:00
|
|
|
- ceph_nfs_rados_backend | bool
|
2019-05-20 21:58:10 +08:00
|
|
|
- rados_index_exists.rc != 0
|
2020-05-06 21:31:34 +08:00
|
|
|
delegate_to: "{{ delegate_node }}"
|
2019-05-20 21:58:10 +08:00
|
|
|
run_once: true
|
2017-11-15 19:59:36 +08:00
|
|
|
|
2017-09-27 05:16:43 +08:00
|
|
|
- name: create /etc/ganesha
|
|
|
|
file:
|
|
|
|
path: /etc/ganesha
|
|
|
|
state: directory
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: "0755"
|
|
|
|
|
2017-09-19 22:19:14 +08:00
|
|
|
- name: generate ganesha configuration file
|
2019-06-04 03:28:39 +08:00
|
|
|
template:
|
2018-02-20 00:57:18 +08:00
|
|
|
src: "ganesha.conf.j2"
|
2017-09-19 22:19:14 +08:00
|
|
|
dest: /etc/ganesha/ganesha.conf
|
|
|
|
owner: "root"
|
|
|
|
group: "root"
|
|
|
|
mode: "0644"
|
2019-04-01 23:46:15 +08:00
|
|
|
notify: restart ceph nfss
|
2021-03-12 23:27:12 +08:00
|
|
|
|
|
|
|
- name: generate ganesha idmap.conf file
|
|
|
|
action: config_template
|
|
|
|
args:
|
|
|
|
src: "idmap.conf.j2"
|
|
|
|
dest: "{{ ceph_nfs_idmap_conf }}"
|
|
|
|
owner: "root"
|
|
|
|
group: "root"
|
|
|
|
mode: "0644"
|
|
|
|
config_overrides: "{{ idmap_conf_overrides }}"
|
|
|
|
config_type: ini
|
|
|
|
notify: restart ceph nfss
|
2017-09-19 22:19:14 +08:00
|
|
|
|
2017-10-04 19:25:53 +08:00
|
|
|
- name: create exports directory
|
|
|
|
file:
|
|
|
|
path: /etc/ganesha/export.d
|
|
|
|
state: directory
|
|
|
|
owner: "root"
|
|
|
|
group: "root"
|
|
|
|
mode: "0755"
|
2019-05-22 16:02:42 +08:00
|
|
|
when: ceph_nfs_dynamic_exports | bool
|
2017-10-04 19:25:53 +08:00
|
|
|
|
|
|
|
- name: create exports dir index file
|
|
|
|
copy:
|
|
|
|
content: ""
|
|
|
|
force: no
|
|
|
|
dest: /etc/ganesha/export.d/INDEX.conf
|
|
|
|
owner: "root"
|
|
|
|
group: "root"
|
|
|
|
mode: "0644"
|
2019-05-22 16:02:42 +08:00
|
|
|
when: ceph_nfs_dynamic_exports | bool
|
2017-10-04 19:25:53 +08:00
|
|
|
|
2019-07-24 16:10:18 +08:00
|
|
|
- name: include_tasks systemd.yml
|
|
|
|
include_tasks: systemd.yml
|
2019-05-22 16:02:42 +08:00
|
|
|
when: containerized_deployment | bool
|
2017-09-27 05:16:43 +08:00
|
|
|
|
|
|
|
- name: systemd start nfs container
|
|
|
|
systemd:
|
2021-03-03 22:43:50 +08:00
|
|
|
name: ceph-nfs@{{ ceph_nfs_service_suffix | default(ansible_facts['hostname']) }}
|
2017-09-27 05:16:43 +08:00
|
|
|
state: started
|
|
|
|
enabled: yes
|
2019-03-20 18:35:36 +08:00
|
|
|
masked: no
|
2017-09-27 05:16:43 +08:00
|
|
|
daemon_reload: yes
|
|
|
|
when:
|
2019-05-22 16:02:42 +08:00
|
|
|
- containerized_deployment | bool
|
|
|
|
- ceph_nfs_enable_service | bool
|
2017-09-27 05:16:43 +08:00
|
|
|
|
2017-09-19 22:19:14 +08:00
|
|
|
- name: start nfs gateway service
|
2017-10-16 20:15:43 +08:00
|
|
|
systemd:
|
2017-09-19 22:19:14 +08:00
|
|
|
name: nfs-ganesha
|
|
|
|
state: started
|
|
|
|
enabled: yes
|
2019-03-20 18:35:36 +08:00
|
|
|
masked: no
|
2017-09-19 22:19:14 +08:00
|
|
|
when:
|
2019-05-22 16:02:42 +08:00
|
|
|
- not containerized_deployment | bool
|
|
|
|
- ceph_nfs_enable_service | bool
|