]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
Add support for RGW 243/head
authorSébastien Han <sebastien.han@enovance.com>
Wed, 1 Apr 2015 12:48:19 +0000 (14:48 +0200)
committerSébastien Han <sebastien.han@enovance.com>
Wed, 8 Apr 2015 14:19:28 +0000 (16:19 +0200)
Signed-off-by: Sébastien Han <sebastien.han@enovance.com>
cluster-os-migration.yml

index 278c0aa406ef7fbf17f840c560bf03cef6ff285e..f96f9ce75ed6a5f16409c5decc48afd7274f74f4 100644 (file)
       delegate_to: "{{ item }}"
       with_items: groups.mons[0]
       when: migration_completed.stat.exists == False
+
+- hosts: rgws
+  serial: 1
+  sudo: True
+
+  vars:
+    backup_dir: /tmp/
+
+  tasks:
+    - name: Check if the node has be migrated already
+      stat: >
+        path=/var/lib/ceph/radosgw/migration_completed
+      register: migration_completed
+      ignore_errors: True
+
+    - name: Check for failed run
+      stat: >
+        path=/var/lib/ceph/{{ ansible_hostname }}.tar
+      register: rgw_archive_leftover
+
+    - fail: msg="Looks like an archive is already there, please remove it!"
+      when: migration_completed.stat.exists == False and rgw_archive_leftover.stat.exists == True
+
+   - name: Archive rados gateway configs
+      shell: >
+        tar -cpvzf - --one-file-system . /etc/ceph/* /etc/apache2/* | cat > {{ ansible_hostname }}.tar
+        chdir=/var/lib/ceph/
+        creates={{ ansible_hostname }}.tar
+      when: migration_completed.stat.exists == False
+
+    - name: Create backup directory
+      file: >
+        path={{ backup_dir }}/rgws-backups
+        state=directory
+        owner=root
+        group=root
+        mode=0644
+      delegate_to: "{{ item }}"
+      with_items: groups.backup[0]
+      when: migration_completed.stat.exists == False
+
+    - name: Scp RGWs dirs and configs
+      fetch: >
+        src=/var/lib/ceph/{{ ansible_hostname }}.tar
+        dest={{ backup_dir }}/rgws-backups/
+        flat=yes
+      when: migration_completed.stat.exists == False
+
+    - name: Gracefully stop the rados gateway and apache
+      service: >
+        name={{ item }}
+        state=stopped
+      with_items:
+        - apache2
+        - radosgw
+      when: migration_completed.stat.exists == False
+
+    - name: Wait for radosgw to be down
+      local_action: >
+        wait_for
+        host={{ ansible_ssh_host | default(inventory_hostname) }}
+        path=/tmp/radosgw.sock
+        state=absent
+        timeout=30
+      when: migration_completed.stat.exists == False
+
+    - name: Reboot the server
+      command: reboot
+      when: migration_completed.stat.exists == False
+
+    - name: Wait for the server to come up
+      local_action: >
+        wait_for
+        port=22
+        delay=10
+        timeout=3600
+      when: migration_completed.stat.exists == False
+
+    - name: Wait a bit to be sure that the server is ready for scp
+      pause: seconds=20
+      when: migration_completed.stat.exists == False
+
+    # NOTE (leseb): 'creates' was added in Ansible 1.6
+    - name: Copy and unarchive the OSD configs
+      unarchive: >
+        src={{ backup_dir }}/rgws-backups/{{ ansible_hostname }}.tar
+        dest=/var/lib/ceph/
+        copy=yes
+        mode=0600
+        creates=etc/ceph/ceph.conf
+      when: migration_completed.stat.exists == False
+
+    - name: Copy keys and configs
+      shell: {{ item }} chdir=/var/lib/ceph/
+      with_items:
+        - cp etc/ceph/* /etc/ceph/
+        - cp -r etc/apache2/* /etc/httpd/
+      when: migration_completed.stat.exists == False
+
+    - name: Start rados gateway and httpd
+      service: >
+        name={{ item }}
+        state=started
+      with_items:
+        - httpd
+        - radosgw
+      when: migration_completed.stat.exists == False
+
+    - name: Wait for radosgw to be up again
+      local_action: >
+        wait_for
+        host={{ ansible_ssh_host | default(inventory_hostname) }}
+        path=/tmp/radosgw.sock
+        state=present
+        timeout=30
+      when: migration_completed.stat.exists == False
+
+    - name: Done moving to the next rados gateway
+      file: >
+        path=/var/lib/ceph/radosgw/migration_completed
+        state=touch
+        owner=root
+        group=root
+        mode=0600
+      when: migration_completed.stat.exists == False