2016-05-06 02:20:03 +08:00
|
|
|
|
---
|
2016-07-21 21:17:19 +08:00
|
|
|
|
- name: create rgw nfs user
|
2017-08-22 22:57:12 +08:00
|
|
|
|
command: radosgw-admin --cluster {{ cluster }} user create --uid={{ ceph_nfs_rgw_user }} --display-name="RGW NFS User"
|
2016-07-21 21:17:19 +08:00
|
|
|
|
register: rgwuser
|
2017-08-21 20:38:21 +08:00
|
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
2016-08-18 20:24:48 +08:00
|
|
|
|
when: nfs_obj_gw
|
2016-07-21 21:17:19 +08:00
|
|
|
|
|
|
|
|
|
- name: set access key
|
|
|
|
|
set_fact:
|
|
|
|
|
ceph_nfs_rgw_access_key: "{{ (rgwuser.stdout | from_json)['keys'][0]['access_key'] }}"
|
2017-08-21 20:38:21 +08:00
|
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
|
when:
|
|
|
|
|
- nfs_obj_gw
|
|
|
|
|
- ceph_nfs_rgw_access_key is not defined
|
2016-07-21 21:17:19 +08:00
|
|
|
|
|
|
|
|
|
- name: set secret key
|
|
|
|
|
set_fact:
|
|
|
|
|
ceph_nfs_rgw_secret_key: "{{(rgwuser.stdout | from_json)['keys'][0]['secret_key']}}"
|
2017-08-21 20:38:21 +08:00
|
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
|
when:
|
|
|
|
|
- nfs_obj_gw
|
|
|
|
|
- ceph_nfs_rgw_secret_key is not defined
|
|
|
|
|
|
|
|
|
|
- name: create nfs gateway directories
|
|
|
|
|
file:
|
|
|
|
|
path: "{{ item }}"
|
|
|
|
|
state: directory
|
|
|
|
|
owner: "ceph"
|
|
|
|
|
group: "ceph"
|
|
|
|
|
mode: "0755"
|
|
|
|
|
with_items:
|
|
|
|
|
- /var/lib/nfs/ganesha
|
|
|
|
|
- /var/run/ganesha
|
2016-07-21 21:17:19 +08:00
|
|
|
|
|
|
|
|
|
- name: generate ganesha configuration file
|
|
|
|
|
action: config_template
|
|
|
|
|
args:
|
2017-08-24 22:19:39 +08:00
|
|
|
|
src: "{{ lookup('env', 'ANSIBLE_ROLES_PATH') | default (playbook_dir + '/roles', true) }}/ceph-common/templates/ganesha.conf.j2"
|
2016-07-21 21:17:19 +08:00
|
|
|
|
dest: /etc/ganesha/ganesha.conf
|
|
|
|
|
owner: "root"
|
|
|
|
|
group: "root"
|
|
|
|
|
mode: "0644"
|
|
|
|
|
config_type: ini
|
|
|
|
|
|
|
|
|
|
- name: start nfs gateway service
|
2016-05-06 02:20:03 +08:00
|
|
|
|
service:
|
|
|
|
|
name: nfs-ganesha
|
|
|
|
|
state: started
|
|
|
|
|
enabled: yes
|