infra: Create a backup of ceph.conf when taking over existing cluster

Signed-off-by: David Galloway <dgallowa@redhat.com>
pull/1613/head
David Galloway 2017-06-20 13:49:31 -04:00
parent 40ed2d7be6
commit 127b5ad9b4
1 changed files with 11 additions and 1 deletions

View File

@ -28,7 +28,7 @@
- name: get the name of the existing ceph cluster - name: get the name of the existing ceph cluster
shell: | shell: |
basename $(grep -R fsid /etc/ceph/ | egrep -o '^[^.]*') basename $(grep --exclude '*.bak' -R fsid /etc/ceph/ | egrep -o '^[^.]*')
changed_when: false changed_when: false
register: cluster_name register: cluster_name
@ -37,6 +37,16 @@
path: "/etc/ceph/{{ cluster_name.stdout }}.conf" path: "/etc/ceph/{{ cluster_name.stdout }}.conf"
register: ceph_conf_stat 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 - name: generate ceph configuration file
action: config_template action: config_template
args: args: