infra: fix take-over-existing-cluster.yml playbook

The ansible inventory could have more than just ceph-ansible hosts, so
we shouldnt use "hosts: all", also only grab one file when getting
the ceph cluster name instead of failing when there is more than one
file in /etc/ceph. Also fix location of the ceph.conf template
pull/2142/head
Caleb Boylan 2017-11-03 09:54:54 -07:00
parent 76d9c8e556
commit 41d10a2f64
1 changed files with 16 additions and 3 deletions

View File

@ -16,20 +16,33 @@
vars_files:
- roles/ceph-defaults/defaults/main.yml
- group_vars/all.yml
- "host_vars/{{ ansible_hostname }}.yml"
roles:
- ceph-defaults
- ceph-fetch-keys
- hosts: all
- hosts:
- mons
- agents
- osds
- mdss
- rgws
- nfss
- restapis
- rbdmirrors
- clients
- mgrs
- iscsi-gw
become: true
tasks:
- include_vars: roles/ceph-defaults/defaults/main.yml
- include_vars: group_vars/all.yml
- include_vars: "host_vars/{{ ansible_hostname }}.yml"
- name: get the name of the existing ceph cluster
shell: |
basename $(grep --exclude '*.bak' -R fsid /etc/ceph/ | egrep -o '^[^.]*')
basename $(grep --exclude '*.bak' -R fsid /etc/ceph/ | egrep -o '^[^.]*' | head -n 1)
changed_when: false
register: cluster_name
@ -51,7 +64,7 @@
- name: generate ceph configuration file
action: config_template
args:
src: "roles/ceph-common/templates/ceph.conf.j2"
src: "roles/ceph-config/templates/ceph.conf.j2"
dest: "/etc/ceph/{{ cluster_name.stdout }}.conf"
owner: "{{ ceph_conf_stat.stat.pw_name }}"
group: "{{ ceph_conf_stat.stat.gr_name }}"