2016-05-06 02:20:03 +08:00
|
|
|
|
---
|
2017-09-11 11:34:36 +08:00
|
|
|
|
- name: create rados gateway directories
|
|
|
|
|
file:
|
|
|
|
|
path: "{{ item }}"
|
|
|
|
|
state: directory
|
|
|
|
|
owner: "ceph"
|
|
|
|
|
group: "ceph"
|
|
|
|
|
mode: "0755"
|
|
|
|
|
with_items:
|
|
|
|
|
- /var/lib/ceph/bootstrap-rgw
|
|
|
|
|
- /var/lib/ceph/radosgw
|
|
|
|
|
- /var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ ansible_hostname }}
|
|
|
|
|
- "{{ rbd_client_admin_socket_path }}"
|
|
|
|
|
when:
|
|
|
|
|
- nfs_obj_gw
|
|
|
|
|
|
|
|
|
|
- name: copy rados gateway bootstrap key
|
|
|
|
|
copy:
|
|
|
|
|
src: "{{ fetch_directory }}/{{ fsid }}{{ item.name }}"
|
|
|
|
|
dest: "{{ item.name }}"
|
|
|
|
|
owner: "ceph"
|
|
|
|
|
group: "ceph"
|
|
|
|
|
mode: "0600"
|
|
|
|
|
with_items:
|
|
|
|
|
- { name: "/var/lib/ceph/bootstrap-rgw/{{ cluster }}.keyring", copy_key: true }
|
|
|
|
|
- { name: "/etc/ceph/{{ cluster }}.client.admin.keyring", copy_key: "{{ copy_admin_key }}" }
|
|
|
|
|
when:
|
|
|
|
|
- nfs_obj_gw
|
|
|
|
|
- cephx
|
|
|
|
|
- item.copy_key|bool
|
|
|
|
|
|
|
|
|
|
- name: create rados gateway keyring
|
|
|
|
|
command: ceph --cluster {{ cluster }} --name client.bootstrap-rgw --keyring /var/lib/ceph/bootstrap-rgw/{{ cluster }}.keyring auth get-or-create client.rgw.{{ ansible_hostname }} osd 'allow rwx' mon 'allow rw' -o /var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ ansible_hostname }}/keyring
|
|
|
|
|
args:
|
|
|
|
|
creates: /var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ ansible_hostname }}/keyring
|
|
|
|
|
changed_when: false
|
|
|
|
|
when:
|
|
|
|
|
- nfs_obj_gw
|
|
|
|
|
- cephx
|
|
|
|
|
|
|
|
|
|
- name: set rados gateway key permissions
|
|
|
|
|
file:
|
|
|
|
|
path: /var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ ansible_hostname }}/keyring
|
|
|
|
|
owner: "ceph"
|
|
|
|
|
group: "ceph"
|
|
|
|
|
mode: "0600"
|
2017-09-15 06:48:53 +08:00
|
|
|
|
when:
|
|
|
|
|
- cephx
|
2017-09-11 11:34:36 +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] }}"
|
2017-09-15 06:48:53 +08:00
|
|
|
|
when:
|
|
|
|
|
- nfs_obj_gw
|
2016-07-21 21:17:19 +08:00
|
|
|
|
|
2017-09-15 06:48:53 +08:00
|
|
|
|
- name: set_fact ceph_nfs_rgw_access_key
|
2016-07-21 21:17:19 +08:00
|
|
|
|
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
|
|
|
|
|
2017-09-15 06:48:53 +08:00
|
|
|
|
- name: set_fact ceph_nfs_rgw_secret_key
|
2016-07-21 21:17:19 +08:00
|
|
|
|
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-09-03 23:32:44 +08:00
|
|
|
|
src: "{{ lookup('env', 'ANSIBLE_ROLES_PATH') | default (playbook_dir + '/roles', true) }}/ceph-nfs/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
|
2017-09-03 23:32:44 +08:00
|
|
|
|
notify:
|
|
|
|
|
- restart ceph nfss
|
|
|
|
|
|
2016-07-21 21:17:19 +08:00
|
|
|
|
- name: start nfs gateway service
|
2016-05-06 02:20:03 +08:00
|
|
|
|
service:
|
|
|
|
|
name: nfs-ganesha
|
|
|
|
|
state: started
|
|
|
|
|
enabled: yes
|
2017-09-19 17:59:54 +08:00
|
|
|
|
when: ceph_nfs_enable_service
|