2015-01-21 01:43:47 +08:00
|
|
|
---
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Create rados gateway directories
|
|
|
|
ansible.builtin.file:
|
2024-05-08 02:41:53 +08:00
|
|
|
path: "/var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ rgw_zone }}.{{ ansible_facts['hostname'] }}.{{ item.instance_name }}"
|
2022-09-19 22:10:39 +08:00
|
|
|
state: directory
|
|
|
|
owner: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}"
|
|
|
|
group: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}"
|
|
|
|
mode: "{{ ceph_directories_mode }}"
|
|
|
|
delegate_to: "{{ groups.get(mon_group_name, [])[0] }}"
|
|
|
|
loop: "{{ rgw_instances }}"
|
|
|
|
when: groups.get(mon_group_name, []) | length > 0
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Create rgw keyrings
|
2020-09-23 23:47:20 +08:00
|
|
|
ceph_key:
|
2024-05-08 02:41:53 +08:00
|
|
|
name: "client.rgw.{{ rgw_zone }}.{{ ansible_facts['hostname'] }}.{{ item.instance_name }}"
|
2020-09-23 23:47:20 +08:00
|
|
|
cluster: "{{ cluster }}"
|
|
|
|
user: "client.bootstrap-rgw"
|
|
|
|
user_key: /var/lib/ceph/bootstrap-rgw/{{ cluster }}.keyring
|
2024-05-08 02:41:53 +08:00
|
|
|
dest: "/var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ rgw_zone }}.{{ ansible_facts['hostname'] }}.{{ item.instance_name }}/keyring"
|
2020-09-23 23:47:20 +08:00
|
|
|
caps:
|
|
|
|
osd: 'allow rwx'
|
|
|
|
mon: 'allow rw'
|
2022-09-19 22:10:39 +08:00
|
|
|
import_key: "{{ True if groups.get(mon_group_name, []) | length > 0 else False }}"
|
|
|
|
owner: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}"
|
|
|
|
group: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}"
|
2017-01-20 17:14:35 +08:00
|
|
|
mode: "0600"
|
2021-08-09 20:57:33 +08:00
|
|
|
no_log: "{{ no_log_on_ceph_key_tasks }}"
|
2024-02-14 18:14:02 +08:00
|
|
|
delegate_to: "{{ groups[mon_group_name][0] if groups.get(mon_group_name, []) | length > 0 else 'localhost' }}"
|
2020-09-23 23:47:20 +08:00
|
|
|
environment:
|
|
|
|
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else None }}"
|
|
|
|
CEPH_CONTAINER_BINARY: "{{ container_binary }}"
|
2018-11-09 08:56:57 +08:00
|
|
|
with_items: "{{ rgw_instances }}"
|
2022-09-19 22:10:39 +08:00
|
|
|
when: cephx | bool
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Get keys from monitors
|
2022-09-19 22:10:39 +08:00
|
|
|
ceph_key:
|
2024-05-08 02:41:53 +08:00
|
|
|
name: "client.rgw.{{ rgw_zone }}.{{ ansible_facts['hostname'] }}.{{ item.instance_name }}"
|
2022-09-19 22:10:39 +08:00
|
|
|
cluster: "{{ cluster }}"
|
|
|
|
output_format: plain
|
|
|
|
state: info
|
|
|
|
environment:
|
|
|
|
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
|
|
|
|
CEPH_CONTAINER_BINARY: "{{ container_binary }}"
|
|
|
|
register: _rgw_keys
|
|
|
|
loop: "{{ rgw_instances }}"
|
|
|
|
delegate_to: "{{ groups.get(mon_group_name)[0] }}"
|
|
|
|
when:
|
|
|
|
- cephx | bool
|
|
|
|
- groups.get(mon_group_name, []) | length > 0
|
|
|
|
no_log: "{{ no_log_on_ceph_key_tasks }}"
|
|
|
|
|
2024-02-14 18:14:02 +08:00
|
|
|
- name: Copy ceph key(s) if needed
|
|
|
|
ansible.builtin.copy:
|
2024-05-08 02:41:53 +08:00
|
|
|
dest: "/var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ rgw_zone }}.{{ ansible_facts['hostname'] }}.{{ item.item.instance_name }}/keyring"
|
2022-09-19 22:10:39 +08:00
|
|
|
content: "{{ item.stdout + '\n' }}"
|
|
|
|
owner: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}"
|
|
|
|
group: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}"
|
|
|
|
mode: "{{ ceph_keyring_permissions }}"
|
|
|
|
with_items: "{{ _rgw_keys.results }}"
|
|
|
|
when:
|
|
|
|
- cephx | bool
|
|
|
|
- item is not skipped
|
|
|
|
- groups.get(mon_group_name, []) | length > 0
|
|
|
|
no_log: "{{ no_log_on_ceph_key_tasks }}"
|