From 40ed2d7be613caa66faa5ab2ff33a0859e088428 Mon Sep 17 00:00:00 2001 From: David Galloway Date: Tue, 20 Jun 2017 12:34:46 -0400 Subject: [PATCH 1/2] infra: Fix ceph.conf creation when taking over existing cluster Fixes bug introduced in https://github.com/ceph/ceph-ansible/pull/1330 The "stat ceph.conf" task was basically using the stat module on a string instead of the ceph.conf filename. This caused the "generate ceph configuration file" task to fail. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1463382 Signed-off-by: David Galloway --- infrastructure-playbooks/take-over-existing-cluster.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/infrastructure-playbooks/take-over-existing-cluster.yml b/infrastructure-playbooks/take-over-existing-cluster.yml index 1e3df7697..1443b9182 100644 --- a/infrastructure-playbooks/take-over-existing-cluster.yml +++ b/infrastructure-playbooks/take-over-existing-cluster.yml @@ -30,18 +30,18 @@ shell: | basename $(grep -R fsid /etc/ceph/ | egrep -o '^[^.]*') changed_when: false - register: ceph_conf + register: cluster_name - - name: stat ceph.conf + - name: "stat {{ cluster_name.stdout }}.conf" stat: - path: "{{ ceph_conf.stdout }}" + path: "/etc/ceph/{{ cluster_name.stdout }}.conf" register: ceph_conf_stat - name: generate ceph configuration file action: config_template args: src: "roles/ceph-common/templates/ceph.conf.j2" - dest: "{{ ceph_conf.stdout }}" + dest: "/etc/ceph/{{ cluster_name.stdout }}.conf" owner: "{{ ceph_conf_stat.stat.pw_name }}" group: "{{ ceph_conf_stat.stat.gr_name }}" mode: "{{ ceph_conf_stat.stat.mode }}" From 127b5ad9b48356e973281eec618fdd7e813f0bc1 Mon Sep 17 00:00:00 2001 From: David Galloway Date: Tue, 20 Jun 2017 13:49:31 -0400 Subject: [PATCH 2/2] infra: Create a backup of ceph.conf when taking over existing cluster Signed-off-by: David Galloway --- .../take-over-existing-cluster.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/infrastructure-playbooks/take-over-existing-cluster.yml b/infrastructure-playbooks/take-over-existing-cluster.yml index 1443b9182..fe4f3a36f 100644 --- a/infrastructure-playbooks/take-over-existing-cluster.yml +++ b/infrastructure-playbooks/take-over-existing-cluster.yml @@ -28,7 +28,7 @@ - name: get the name of the existing ceph cluster shell: | - basename $(grep -R fsid /etc/ceph/ | egrep -o '^[^.]*') + basename $(grep --exclude '*.bak' -R fsid /etc/ceph/ | egrep -o '^[^.]*') changed_when: false register: cluster_name @@ -37,6 +37,16 @@ path: "/etc/ceph/{{ cluster_name.stdout }}.conf" register: ceph_conf_stat + # Creates a backup of original ceph conf file in 'cluster_name-YYYYMMDDTHHMMSS.conf.bak' format + - name: "make a backup of original {{ cluster_name.stdout }}.conf" + copy: + src: "/etc/ceph/{{ cluster_name.stdout }}.conf" + dest: "/etc/ceph/{{ cluster_name.stdout }}-{{ ansible_date_time.iso8601_basic_short }}.conf.bak" + remote_src: true + owner: "{{ ceph_conf_stat.stat.pw_name }}" + group: "{{ ceph_conf_stat.stat.gr_name }}" + mode: "{{ ceph_conf_stat.stat.mode }}" + - name: generate ceph configuration file action: config_template args: