#rgw_group_name: rgws
#mds_group_name: mdss
#restapi_group_name: restapis
+#rbdmirror_group_name: rbdmirrors
# If check_firewall is true, then ansible will try to determine if the
# Ceph ports are blocked by a firewall. If the machine running ansible
--- /dev/null
+---
+# Variables here are applicable to all host groups NOT roles
+
+# This sample file generated by generate_group_vars_sample.sh
+
+# Dummy variable to avoid error because ansible does not recognize the
+# file as a good configuration file when no variable in it.
+dummy:
+
+#########
+# SETUP #
+#########
+
+# NOTE (leseb): the rbd-mirror daemon needs a user to start
+# because it has to authenticate with the local cluster.
+# By default, using the admin user is fine, so you should not
+# need to change 'ceph_rbd_mirror_local_user' unless you have
+# a dedicated key available in /etc/ceph/.
+# Generally Ansible will use the admin key and put it
+# under /etc/ceph/. The same goes for 'ceph_rbd_mirror_remote_user'
+# there should not be any reason to change it.
+#ceph_rbd_mirror_local_user: admin
+#ceph_rbd_mirror_remote_user: admin
+
+# NOTE (leseb): the following variable needs the name of the remote cluster.
+# The name of this cluster must be different than your local cluster simply
+# because we need to have both keys and ceph.conf inside /etc/ceph.
+# Thus if cluster names are identical we can not have them under /etc/ceph
+#ceph_rbd_mirror_remote_cluster: ""
+
+#################
+# CONFIGURATION #
+#################
+
+#ceph_rbd_mirror_configure: false
+#ceph_rbd_mirror_pool: ""
+
mon_group_name: mons
rgw_group_name: rgws
mds_group_name: mdss
+ rbdmirror_group_name: rbdmirrors
# When set to true both groups of packages are purged.
# This can cause problem with qemu-kvm
systemd_unit_files.stdout != "0" and
rgw_group_name in group_names
+ - name: stop ceph rbd mirror with systemd
+ service:
+ name: ceph-rbd-mirror@admin.service
+ state: stopped
+ when:
+ ansible_os_family == 'RedHat' and
+ systemd_unit_files.stdout != "0" and
+ rbdmirror_group_name in group_names
+
# before infernalis
- name: stop ceph osds
command: service ceph stop osd
ansible_distribution == 'Ubuntu' and
rgw_group_name in group_names
+ - name: stop ceph rbd mirror on ubuntu
+ command: initctl stop ceph-rbd-mirorr cluster={{ cluster }} id=admin
+ failed_when: false
+ when:
+ ansible_distribution == 'Ubuntu' and
+ rbdmirror_group_name in group_names
+
- name: check for anything running ceph
shell: "ps awux | grep -v grep | grep -q -- ceph-"
register: check_for_running_ceph
rgw_group_name: rgws
mds_group_name: mdss
restapi_group_name: restapis
+rbdmirror_group_name: rbdmirrors
# If check_firewall is true, then ansible will try to determine if the
# Ceph ports are blocked by a firewall. If the machine running ansible
--- /dev/null
+# Ansible role: Ceph Storage Agent
+
+This role bootstraps the Ceph RBD mirror agent.
+
+# Requirements
+
+Nothing, it runs out of the box.
+
+# Role variables
+
+Have a look at: `defaults/main.yml`.
+
+## Mandatory variables
+
+None.
+
+# Dependencies
+
+The role `ceph.ceph-common` must be installed.
+
+# Example Playbook
+
+```
+- hosts: servers
+ remote_user: ubuntu
+ roles:
+ - { role: ceph.ceph-rbd-mirror }
+```
+
+# Contribution
+
+**THIS REPOSITORY DOES NOT ACCEPT PULL REQUESTS**
+**PULL REQUESTS MUST GO THROUGH [CEPH-ANSIBLE](https://github.com/ceph/ceph-ansible)**
+
+# License
+
+Apache
+
+# Author Information
+
+This role was created by S2bastien Han.
--- /dev/null
+---
+#########
+# SETUP #
+#########
+
+# NOTE (leseb): the rbd-mirror daemon needs a user to start
+# because it has to authenticate with the local cluster.
+# By default, using the admin user is fine, so you should not
+# need to change 'ceph_rbd_mirror_local_user' unless you have
+# a dedicated key available in /etc/ceph/.
+# Generally Ansible will use the admin key and put it
+# under /etc/ceph/. The same goes for 'ceph_rbd_mirror_remote_user'
+# there should not be any reason to change it.
+ceph_rbd_mirror_local_user: admin
+ceph_rbd_mirror_remote_user: admin
+
+# NOTE (leseb): the following variable needs the name of the remote cluster.
+# The name of this cluster must be different than your local cluster simply
+# because we need to have both keys and ceph.conf inside /etc/ceph.
+# Thus if cluster names are identical we can not have them under /etc/ceph
+ceph_rbd_mirror_remote_cluster: ""
+
+#################
+# CONFIGURATION #
+#################
+
+ceph_rbd_mirror_configure: false
+ceph_rbd_mirror_pool: ""
--- /dev/null
+---
+galaxy_info:
+ author: Sébastien Han
+ description: Installs Ceph Mirror Agent
+ license: Apache
+ min_ansible_version: 1.7
+ platforms:
+ - name: Ubuntu
+ versions:
+ - trusty
+ - name: EL
+ versions:
+ - 7
+ categories:
+ - system
+dependencies:
+ - { role: ceph.ceph-common }
--- /dev/null
+---
+- name: add a peer
+ shell: "rbd mirror pool peer add {{ ceph_rbd_mirror_pool }} {{ ceph_rbd_mirror_remote_user }}@{{ ceph_rbd_mirror_remote_cluster }}"
--- /dev/null
+---
+- include: pre_requisite.yml
+- include: start_rbd_mirror.yml
+- include: configure_mirroring.yml
+ when: ceph_rbd_mirror_configure
--- /dev/null
+---
+- name: install dependencies
+ apt:
+ pkg: rbd-mirror
+ state: present
+ when: ansible_os_family == 'Debian'
+ tags:
+ - package-install
+
+- name: install dependencies
+ # XXX Determine what RH repository this will belong to so that it can be
+ # properly checked and errored if the repository is not enabled.
+ yum:
+ name: rbd-mirror
+ state: present
+ when: ansible_os_family == 'RedHat'
+ tags:
+ - package-install
+
+- name: copy ceph admin key
+ copy:
+ src: "{{ fetch_directory }}/{{ fsid }}/etc/ceph/{{ cluster }}.client.admin.keyring"
+ dest: "/etc/ceph/{{ cluster }}.client.admin.keyring"
+ owner: "{{ key_owner }}"
+ group: "{{ key_group }}"
+ mode: "{{ key_mode }}"
+ when:
+ cephx
--- /dev/null
+---
+- name: start and add that the rbd mirror service to the init sequence (ubuntu)
+ command: initctl emit ceph-rbd-mirror cluster={{ cluster }} id={{ ansible_hostname }}
+ changed_when: false
+ failed_when: false
+ when: ansible_distribution == "Ubuntu"
+
+# NOTE (leseb): somehow the service ansible module is messing things up
+# as a safety measure we run the raw command
+- name: start and add that the rbd mirror service to the init sequence
+ command: service ceph start ceph-rbd-mirror
+ changed_when: false
+ when:
+ ansible_distribution != "Ubuntu" and
+ not is_ceph_infernalis
+
+- name: enable systemd unit file for the rbd mirror service (for or after infernalis)
+ file:
+ src: /usr/lib/systemd/system/ceph-rbd-mirror@.service
+ dest: "/etc/systemd/system/multi-user.target.wants/ceph-rbd-mirror@{{ ceph_rbd_mirror_local_user }}.service"
+ state: link
+ changed_when: false
+ failed_when: false
+ when:
+ ansible_distribution != "Ubuntu" and
+ is_ceph_infernalis
+
+- name: start and add that the rbd mirror service to the init sequence (for or after infernalis)
+ service:
+ name: "ceph-rbd-mirror@{{ ceph_rbd_mirror_local_user }}"
+ state: started
+ enabled: yes
+ changed_when: false
+ when:
+ ansible_distribution != "Ubuntu" and
+ is_ceph_infernalis
become: True
roles:
- ceph-restapi
+
+- hosts: rbdmirrors
+ become: True
+ roles:
+ - ceph-rbd-mirror
---
- hosts: localhost
- sudo: true
+ become: true
roles:
- ceph.ceph-common
- ceph-mon
- ceph-osd
- ceph-mds
- ceph-rgw
+ - ceph-fetch-keys
+ - ceph-agent
+ - ceph-common-coreos
+ - ceph-rbd-mirror