]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
infra: Create a backup of ceph.conf when taking over existing cluster 1613/head
authorDavid Galloway <dgallowa@redhat.com>
Tue, 20 Jun 2017 17:49:31 +0000 (13:49 -0400)
committerDavid Galloway <dgallowa@redhat.com>
Wed, 21 Jun 2017 13:53:09 +0000 (09:53 -0400)
Signed-off-by: David Galloway <dgallowa@redhat.com>
infrastructure-playbooks/take-over-existing-cluster.yml

index 1443b91821d3829c6fdef377ef87faa8c77a930b..fe4f3a36f4978533b85640974ea235663d07fac0 100644 (file)
@@ -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
 
         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: