2016-05-06 02:20:03 +08:00
|
|
|
---
|
2018-09-07 20:45:43 +08:00
|
|
|
- name: include red hat based system related tasks
|
|
|
|
include_tasks: pre_requisite_non_container_red_hat.yml
|
2019-04-01 23:46:15 +08:00
|
|
|
when: ansible_os_family == 'RedHat'
|
2017-10-10 03:34:17 +08:00
|
|
|
|
2018-09-07 20:45:43 +08:00
|
|
|
- name: include debian based system related tasks
|
|
|
|
include_tasks: pre_requisite_non_container_debian.yml
|
2019-04-01 23:46:15 +08:00
|
|
|
when: ansible_os_family == 'Debian'
|
2017-10-09 23:10:39 +08:00
|
|
|
|
2018-03-22 20:19:22 +08:00
|
|
|
- name: install nfs rgw/cephfs gateway - suse
|
2017-12-19 18:17:04 +08:00
|
|
|
zypper:
|
2018-03-22 20:19:22 +08:00
|
|
|
name: "{{ item.name }}"
|
2017-12-19 18:17:04 +08:00
|
|
|
disable_gpg_check: yes
|
2017-10-09 23:10:39 +08:00
|
|
|
with_items:
|
2018-03-22 20:19:22 +08:00
|
|
|
- { name: 'nfs-ganesha-rgw', install: "{{ nfs_obj_gw }}" }
|
|
|
|
- { name: 'radosgw', install: "{{ nfs_obj_gw }}" }
|
|
|
|
- { name: 'nfs-ganesha-ceph', install: "{{ nfs_file_gw }}" }
|
2017-10-09 23:10:39 +08:00
|
|
|
when:
|
|
|
|
- (ceph_origin == 'repository' or ceph_origin == 'distro')
|
|
|
|
- ceph_repository != 'rhcs'
|
2017-12-19 18:17:04 +08:00
|
|
|
- ansible_os_family == 'Suse'
|
2018-03-22 20:19:22 +08:00
|
|
|
- item.install | bool
|
2018-12-20 17:00:26 +08:00
|
|
|
register: result
|
|
|
|
until: result is succeeded
|
2017-12-19 18:17:04 +08:00
|
|
|
|
2017-09-27 05:16:43 +08:00
|
|
|
# NOTE (leseb): we use root:ceph for permissions since ganesha
|
|
|
|
# does not have the right selinux context to read ceph directories.
|
2017-09-19 22:19:14 +08:00
|
|
|
- name: create rados gateway and ganesha directories
|
2017-09-11 11:34:36 +08:00
|
|
|
file:
|
2018-03-11 03:27:10 +08:00
|
|
|
path: "{{ item.name }}"
|
2017-09-11 11:34:36 +08:00
|
|
|
state: directory
|
|
|
|
owner: "ceph"
|
|
|
|
group: "ceph"
|
2018-08-01 20:37:40 +08:00
|
|
|
mode: "{{ ceph_directories_mode | default('0755') }}"
|
2017-09-11 11:34:36 +08:00
|
|
|
with_items:
|
2018-03-11 03:27:10 +08:00
|
|
|
- { name: "/var/lib/ceph/bootstrap-rgw", create: "{{ nfs_obj_gw }}" }
|
|
|
|
- { name: "/var/lib/ceph/radosgw", create: "{{ nfs_obj_gw }}" }
|
|
|
|
- { name: "/var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ ansible_hostname }}", create: "{{ nfs_obj_gw }}" }
|
|
|
|
- { name: "{{ rbd_client_admin_socket_path }}", create: "{{ nfs_obj_gw }}" }
|
|
|
|
- { name: "/var/log/ceph", create: true }
|
|
|
|
- { name: "/var/run/ceph", create: true }
|
2019-05-22 16:02:42 +08:00
|
|
|
when: item.create | bool
|
2017-09-11 11:34:36 +08:00
|
|
|
|
2018-09-07 20:45:43 +08:00
|
|
|
- name: cephx related tasks
|
2019-05-20 21:58:10 +08:00
|
|
|
when:
|
2019-05-22 16:02:42 +08:00
|
|
|
- cephx | bool
|
2019-05-20 21:58:10 +08:00
|
|
|
- groups.get(mon_group_name, []) | length > 0
|
2018-09-07 20:45:43 +08:00
|
|
|
block:
|
2019-09-23 19:30:05 +08:00
|
|
|
- name: get keys from monitors
|
|
|
|
command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} auth get {{ item.name }}"
|
|
|
|
register: _rgw_keys
|
2019-05-12 19:10:30 +08:00
|
|
|
with_items:
|
2019-09-23 19:30:05 +08:00
|
|
|
- { name: "client.bootstrap-rgw", path: "/var/lib/ceph/bootstrap-rgw/{{ cluster }}.keyring", copy_key: true }
|
|
|
|
- { name: "client.admin", path: "/etc/ceph/{{ cluster }}.client.admin.keyring", copy_key: "{{ copy_admin_key }}" }
|
|
|
|
delegate_to: "{{ groups.get(mon_group_name)[0] }}"
|
2019-10-02 15:57:50 +08:00
|
|
|
run_once: true
|
2019-09-23 19:30:05 +08:00
|
|
|
when:
|
|
|
|
- cephx | bool
|
|
|
|
- item.copy_key | bool
|
|
|
|
|
|
|
|
- name: copy ceph key(s) if needed
|
|
|
|
copy:
|
|
|
|
dest: "{{ item.item.path }}"
|
|
|
|
content: "{{ item.stdout + '\n' }}"
|
|
|
|
owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}"
|
|
|
|
group: "{{ ceph_uid if containerized_deployment else 'ceph' }}"
|
|
|
|
mode: "{{ ceph_keyring_permissions }}"
|
|
|
|
with_items: "{{ _rgw_keys.results }}"
|
|
|
|
when:
|
|
|
|
- cephx | bool
|
|
|
|
- item.item.copy_key | bool
|
2018-09-07 20:45:43 +08:00
|
|
|
|
|
|
|
- name: nfs object gateway related tasks
|
2019-05-22 16:02:42 +08:00
|
|
|
when: nfs_obj_gw | bool
|
2018-09-07 20:45:43 +08:00
|
|
|
block:
|
|
|
|
- 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
|
|
|
|
|
|
|
|
- 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-11 11:34:36 +08:00
|
|
|
|
2017-09-20 18:35:00 +08:00
|
|
|
- name: change ownership on /var/log/ganesha
|
|
|
|
file:
|
2017-09-27 05:16:43 +08:00
|
|
|
path: /var/log/ganesha
|
|
|
|
owner: "root"
|
|
|
|
group: "root"
|
|
|
|
mode: "0755"
|