2018-03-23 11:24:56 +08:00
|
|
|
---
|
2019-09-23 19:30:05 +08:00
|
|
|
- name: get keys from monitors
|
2020-10-24 03:19:53 +08:00
|
|
|
ceph_key:
|
|
|
|
name: client.admin
|
|
|
|
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: _admin_key
|
2019-09-23 19:30:05 +08:00
|
|
|
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
|
2020-10-24 03:19:53 +08:00
|
|
|
- copy_admin_key | bool
|
2019-09-23 19:30:05 +08:00
|
|
|
|
|
|
|
- name: copy ceph key(s) if needed
|
2018-03-23 11:24:56 +08:00
|
|
|
copy:
|
2020-10-24 03:19:53 +08:00
|
|
|
dest: "/etc/ceph/{{ cluster }}.client.admin.keyring"
|
|
|
|
content: "{{ _admin_key.stdout + '\n' }}"
|
2020-09-26 00:15:02 +08:00
|
|
|
owner: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}"
|
|
|
|
group: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}"
|
2018-06-25 21:12:56 +08:00
|
|
|
mode: "{{ ceph_keyring_permissions }}"
|
2019-09-23 19:30:05 +08:00
|
|
|
when:
|
|
|
|
- cephx | bool
|
2020-10-24 03:19:53 +08:00
|
|
|
- copy_admin_key | bool
|
2018-03-23 11:24:56 +08:00
|
|
|
|
2020-01-08 04:01:48 +08:00
|
|
|
- name: add mgr ip address to trusted list with dashboard - ipv4
|
2019-10-22 03:45:19 +08:00
|
|
|
set_fact:
|
|
|
|
trusted_ip_list: '{{ trusted_ip_list }},{{ hostvars[item]["ansible_all_ipv4_addresses"] | ips_in_ranges(public_network.split(",")) | first }}'
|
|
|
|
with_items: '{{ groups[mgr_group_name] | default(groups[mon_group_name]) }}'
|
2020-01-08 04:01:48 +08:00
|
|
|
when:
|
|
|
|
- dashboard_enabled | bool
|
|
|
|
- ip_version == 'ipv4'
|
|
|
|
|
|
|
|
- name: add mgr ip address to trusted list with dashboard - ipv6
|
|
|
|
set_fact:
|
2020-01-14 23:07:56 +08:00
|
|
|
trusted_ip_list: '{{ trusted_ip_list }},{{ hostvars[item]["ansible_all_ipv6_addresses"] | ips_in_ranges(public_network.split(",")) | last }}'
|
2020-01-08 04:01:48 +08:00
|
|
|
with_items: '{{ groups[mgr_group_name] | default(groups[mon_group_name]) }}'
|
|
|
|
when:
|
|
|
|
- dashboard_enabled | bool
|
|
|
|
- ip_version == 'ipv6'
|
2019-10-22 03:45:19 +08:00
|
|
|
|
2018-03-23 11:24:56 +08:00
|
|
|
- name: deploy gateway settings, used by the ceph_iscsi_config modules
|
2019-07-09 02:36:07 +08:00
|
|
|
config_template:
|
2018-03-23 11:24:56 +08:00
|
|
|
src: "{{ role_path }}/templates/iscsi-gateway.cfg.j2"
|
|
|
|
dest: /etc/ceph/iscsi-gateway.cfg
|
2019-07-09 02:36:07 +08:00
|
|
|
config_type: ini
|
|
|
|
config_overrides: '{{ iscsi_conf_overrides }}'
|
2020-10-21 20:26:57 +08:00
|
|
|
mode: "0600"
|
2019-10-10 04:50:09 +08:00
|
|
|
notify: restart ceph rbd-target-api-gw
|
2018-03-23 11:24:56 +08:00
|
|
|
|
2019-05-14 20:51:32 +08:00
|
|
|
- name: set_fact container_exec_cmd
|
2018-03-23 11:24:56 +08:00
|
|
|
set_fact:
|
2019-05-14 20:51:32 +08:00
|
|
|
container_exec_cmd: "{{ container_binary }} exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }}"
|
2018-03-23 11:24:56 +08:00
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
2019-05-22 16:02:42 +08:00
|
|
|
when: containerized_deployment | bool
|
2018-03-23 11:24:56 +08:00
|
|
|
|
2020-04-29 00:08:59 +08:00
|
|
|
- name: create iscsi pool
|
|
|
|
ceph_pool:
|
|
|
|
name: "{{ iscsi_pool_name }}"
|
|
|
|
cluster: "{{ cluster }}"
|
2020-09-29 05:27:47 +08:00
|
|
|
size: "{{ iscsi_pool_size | default(omit) }}"
|
2020-04-29 00:08:59 +08:00
|
|
|
application: "rbd"
|
2020-09-26 08:58:30 +08:00
|
|
|
run_once: true
|
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
2020-04-29 00:08:59 +08:00
|
|
|
environment:
|
2020-09-26 00:15:02 +08:00
|
|
|
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
|
2020-04-29 00:08:59 +08:00
|
|
|
CEPH_CONTAINER_BINARY: "{{ container_binary }}"
|