2016-05-01 22:46:28 +08:00
---
# NOTE (leseb):
2016-05-16 11:51:12 +08:00
# The playbook aims to takeover a cluster that was not configured with
# ceph-ansible.
2016-05-01 22:46:28 +08:00
#
2016-05-16 11:51:12 +08:00
# The procedure is as follows:
2016-05-01 22:46:28 +08:00
#
# 1. Install Ansible and add your monitors and osds hosts in it. For more detailed information you can read the [Ceph Ansible Wiki](https://github.com/ceph/ceph-ansible/wiki)
# 2. Set `generate_fsid: false` in `group_vars`
2016-07-18 23:06:20 +08:00
# 3. Get your current cluster fsid with `ceph fsid` and set `fsid` accordingly in `group_vars`
2016-05-01 22:46:28 +08:00
# 4. Run the playbook called: `take-over-existing-cluster.yml` like this `ansible-playbook take-over-existing-cluster.yml`.
# 5. Eventually run Ceph Ansible to validate everything by doing: `ansible-playbook site.yml`.
2016-07-18 23:06:20 +08:00
- hosts : mons
become : True
vars_files :
- roles/ceph-common/defaults/main.yml
2016-11-23 18:14:32 +08:00
- group_vars/all.yml
2016-07-18 23:06:20 +08:00
roles :
- ceph-fetch-keys
2016-05-01 22:46:28 +08:00
- hosts : all
become : true
tasks :
- include_vars : roles/ceph-common/defaults/main.yml
2016-11-23 18:14:32 +08:00
- include_vars : group_vars/all.yml
2016-05-01 22:46:28 +08:00
- name : get the name of the existing ceph cluster
2016-12-06 22:02:49 +08:00
shell : |
2017-02-24 04:39:55 +08:00
basename $(grep -R fsid /etc/ceph/ | egrep -o '^[^.]*')
2016-05-01 22:46:28 +08:00
changed_when : false
register : ceph_conf
- name : stat ceph.conf
stat :
path : "{{ ceph_conf.stdout }}"
register : ceph_conf_stat
- name : generate ceph configuration file
action : config_template
args :
src : "roles/ceph-common/templates/ceph.conf.j2"
2016-07-15 11:55:34 +08:00
dest : "{{ ceph_conf.stdout }}"
2016-05-01 22:46:28 +08:00
owner : "{{ ceph_conf_stat.stat.pw_name }}"
group : "{{ ceph_conf_stat.stat.gr_name }}"
mode : "{{ ceph_conf_stat.stat.mode }}"
config_overrides : "{{ ceph_conf_overrides }}"
config_type : ini