77 lines
3.1 KiB
YAML
77 lines
3.1 KiB
YAML
---
|
|
# Copyright 2021 Red Hat, Inc.
|
|
# All Rights Reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
- name: Deploy the RBD Mirror daemon
|
|
block:
|
|
# Using two tasks with a boolean due to the ansible bug: https://github.com/ansible/ansible/issues/68364
|
|
- name: Collect the host and build the resulting host list
|
|
set_fact:
|
|
_hosts: "{{ _hosts|default([]) + [ hostvars[item].canonical_hostname ] }}"
|
|
with_items: "{{ groups['ceph_rbdmirror'] }}"
|
|
when: tripleo_cephadm_fqdn | bool
|
|
|
|
- name: Collect the host and build the resulting host list
|
|
set_fact:
|
|
_hosts: "{{ _hosts|default([]) + [ hostvars[item].inventory_hostname ] }}"
|
|
with_items: "{{ groups['ceph_rbdmirror'] }}"
|
|
when: not tripleo_cephadm_fqdn | bool
|
|
|
|
- name: Create the RBD Mirror Daemon spec definition
|
|
become: true
|
|
ceph_mkspec:
|
|
service_type: rbd-mirror
|
|
apply: true
|
|
hosts: "{{ _hosts | unique }}"
|
|
render_path: "{{ tripleo_cephadm_spec_home }}"
|
|
networks: "{{ radosgw_address_block }}"
|
|
register: spc
|
|
environment:
|
|
CEPH_CONTAINER_IMAGE: "{{ tripleo_cephadm_container_ns + '/' + tripleo_cephadm_container_image + ':' + tripleo_cephadm_container_tag }}"
|
|
CEPH_CONTAINER_BINARY: "{{ tripleo_cephadm_container_cli }}"
|
|
CEPH_FSID: "{{ tripleo_cephadm_fsid }}"
|
|
when:
|
|
- tripleo_enabled_services | intersect(['ceph_rbdmirror'])
|
|
|
|
- name: Configure RBD mirror
|
|
when: tripleo_cephadm_rbd_mirror_pool | default('') | length > 0
|
|
block:
|
|
- name: Get ceph_cli
|
|
include_tasks: ceph_cli.yaml
|
|
vars:
|
|
ceph_command: rbd
|
|
|
|
- name: enable mirroring on the pool
|
|
command: "{{ tripleo_cephadm_ceph_cli }} --cluster {{ tripleo_cephadm_cluster }} mirror pool enable {{ tripleo_cephadm_rbd_mirror_pool }} pool"
|
|
register: result
|
|
changed_when: false
|
|
retries: 90
|
|
delay: 1
|
|
until: result is succeeded
|
|
|
|
- name: list mirroring peer
|
|
command: "{{ tripleo_cephadm_ceph_cli }} --cluster {{ tripleo_cephadm_cluster }} mirror pool info {{ tripleo_cephadm_rbd_mirror_pool }}"
|
|
changed_when: false
|
|
register: mirror_peer
|
|
|
|
- name: add a mirroring peer
|
|
command: "{{ tripleo_cephadm_ceph_cli }} --cluster {{ tripleo_cephadm_cluster }} mirror pool peer add \
|
|
{{ tripleo_cephadm_rbd_mirror_pool }} {{ tripleo_cephadm_rbd_mirror_remote_user }}_{{ tripleo_cephadm_rbd_mirror_remote_cluster }}"
|
|
changed_when: false
|
|
when:
|
|
- tripleo_cephadm_rbd_mirror_remote_user | length > 0
|
|
- tripleo_cephadm_rbd_mirror_remote_cluster | length > 0
|
|
- tripleo_cephadm_rbd_mirror_remote_user not in mirror_peer.stdout
|