]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
infra: fix take-over-existing-cluster.yml playbook 2142/head
authorCaleb Boylan <caleb.boylan@ormuco.com>
Fri, 3 Nov 2017 16:54:54 +0000 (09:54 -0700)
committerCaleb Boylan <caleb.boylan@ormuco.com>
Mon, 6 Nov 2017 23:00:30 +0000 (15:00 -0800)
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

infrastructure-playbooks/take-over-existing-cluster.yml

index b4db027038619677790bda93996eac72f895b429..97a7cf884fa677ce3aa84182b858b9d05d71dac1 100644 (file)
   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 }}"