ceph-ansible/roles/ceph-rbd-mirror/tasks/main.yml

52 lines
1.8 KiB
YAML
Raw Normal View History

---
- name: non-containerized related tasks
when:
- not containerized_deployment | bool
- ceph_rbd_mirror_remote_user is defined
block:
- name: install dependencies
package:
name: rbd-mirror
state: present
register: result
until: result is succeeded
tags: package-install
- name: ensure systemd service override directory exists
file:
state: directory
path: "/etc/systemd/system/ceph-rbd-mirror@.service.d/"
when:
- ceph_rbd_mirror_systemd_overrides is defined
- ansible_facts['service_mgr'] == 'systemd'
- name: add ceph-rbd-mirror systemd service overrides
config_template:
src: "ceph-rbd-mirror.service.d-overrides.j2"
dest: "/etc/systemd/system/ceph-rbd-mirror@.service.d/ceph-rbd-mirror-systemd-overrides.conf"
config_overrides: "{{ ceph_rbd_mirror_systemd_overrides | default({}) }}"
config_type: "ini"
when:
- ceph_rbd_mirror_systemd_overrides is defined
- ansible_facts['service_mgr'] == 'systemd'
- name: enable ceph-rbd-mirror.target
systemd:
name: "ceph-rbd-mirror.target"
state: started
enabled: yes
masked: no
changed_when: false
- name: set_fact ceph_cmd
set_fact:
rbd_cmd: "{{ container_binary + ' run --rm --net=host -v /etc/ceph:/etc/ceph:z -v /var/lib/ceph:/var/lib/ceph:z -v /var/run/ceph:/var/run/ceph:z --entrypoint=rbd ' + ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else 'rbd' }}"
- name: include start_container_rbd_mirror.yml
include_tasks: start_container_rbd_mirror.yml
when:
- containerized_deployment | bool
- ceph_rbd_mirror_remote_user is defined
- name: include configure_mirroring.yml
include_tasks: configure_mirroring.yml