]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
purge: cosmetic cleanup
authorSébastien Han <seb@redhat.com>
Wed, 18 Jan 2017 09:53:21 +0000 (10:53 +0100)
committerSébastien Han <seb@redhat.com>
Wed, 18 Jan 2017 09:53:21 +0000 (10:53 +0100)
Just applying our writing syntax convention in the playbook.

Signed-off-by: Sébastien Han <seb@redhat.com>
infrastructure-playbooks/purge-cluster.yml

index 83fad3016aa325e89badcc70ae41e1c557a96ab1..69e9fbcc27dd7b789e2c0d68a025a7b45a8f7a08 100644 (file)
@@ -84,8 +84,8 @@
       state: stopped
       enabled: no
     when:
-      ansible_os_family == 'RedHat' and
-      systemd_unit_files.stdout != "0"
+      - ansible_os_family == 'RedHat'
+      systemd_unit_files.stdout != "0"
 
   - name: stop ceph mdss with systemd
     service:
       state: stopped
       enabled: no
     when:
-      ansible_os_family == 'RedHat' and
-      systemd_unit_files.stdout != "0"
+      - ansible_os_family == 'RedHat'
+      systemd_unit_files.stdout != "0"
 
   - name: stop ceph mdss
     shell: "service ceph status mds ; if [ $? == 0 ] ; then service ceph stop mds ; else echo ; fi"
-    when:
-      ansible_os_family == 'RedHat'
+    when: ansible_os_family == 'RedHat'
 
 # Ubuntu 14.04
   - name: stop ceph mdss on ubuntu
     command: initctl stop ceph-mds cluster={{ cluster }} id={{ ansible_hostname }}
     failed_when: false
-    when:
-      ansible_distribution == 'Ubuntu'
+    when: ansible_distribution == 'Ubuntu'
 
 
 - name: purge ceph rgw cluster
       state: stopped
       enabled: no
     when:
-      ansible_os_family == 'RedHat' and
-      systemd_unit_files.stdout != "0"
+      - ansible_os_family == 'RedHat'
+      systemd_unit_files.stdout != "0"
 
   - name: stop ceph rgws with systemd
     service:
       state: stopped
       enabled: no
     when:
-      ansible_os_family == 'RedHat' and
-      systemd_unit_files.stdout != "0"
+      - ansible_os_family == 'RedHat'
+      systemd_unit_files.stdout != "0"
 
   - name: stop ceph rgws
     shell: "service ceph-radosgw status ; if [ $? == 0 ] ; then service ceph-radosgw stop ; else echo ; fi"
-    when:
-      ansible_os_family == 'RedHat'
+    when: ansible_os_family == 'RedHat'
 
 # Ubuntu 14.04
   - name: stop ceph rgws on ubuntu
     command: initctl stop radosgw cluster={{ cluster }} id={{ ansible_hostname }}
     failed_when: false
-    when:
-      ansible_distribution == 'Ubuntu'
+    when: ansible_distribution == 'Ubuntu'
 
 
 - name: purge ceph rbd-mirror cluster
       state: stopped
       enabled: no
     when:
-      ansible_os_family == 'RedHat' and
-      systemd_unit_files.stdout != "0"
+      - ansible_os_family == 'RedHat'
+      systemd_unit_files.stdout != "0"
 
   - name: stop ceph rbd mirror with systemd
     service:
       name: ceph-rbd-mirror@admin.service
       state: stopped
     when:
-      ansible_os_family == 'RedHat' and
-      systemd_unit_files.stdout != "0"
+      - ansible_os_family == 'RedHat'
+      systemd_unit_files.stdout != "0"
 
 # Ubuntu 14.04
   - name: stop ceph rbd mirror on ubuntu
     command: initctl stop ceph-rbd-mirror cluster={{ cluster }} id=admin
     failed_when: false
-    when:
-      ansible_distribution == 'Ubuntu'
+    when: ansible_distribution == 'Ubuntu'
 
 
 - name: purge ceph nfs cluster
       state: stopped
       enabled: no
     when:
-      ansible_os_family == 'RedHat' and
-      systemd_unit_files.stdout != "0"
+      - ansible_os_family == 'RedHat'
+      systemd_unit_files.stdout != "0"
 
   - name: stop ceph nfss with systemd
     service:
       name: nfs-ganesha
       state: stopped
     when:
-      ansible_os_family == 'RedHat' and
-      systemd_unit_files.stdout != "0"
+      - ansible_os_family == 'RedHat'
+      systemd_unit_files.stdout != "0"
 
   - name: stop ceph nfss
     shell: "service nfs-ganesha status ; if [ $? == 0 ] ; then service nfs-ganesha stop ; else echo ; fi"
-    when:
-      ansible_os_family == 'RedHat'
+    when: ansible_os_family == 'RedHat'
 
 # Ubuntu 14.04
   - name: stop ceph nfss on ubuntu
     command: initctl stop nfs-ganesha
     failed_when: false
-    when:
-      ansible_distribution == 'Ubuntu'
+    when: ansible_distribution == 'Ubuntu'
 
 
 - name: purge ceph osd cluster
     fail:
       msg: "OSD automatic discovery was detected, purge cluster does not support this scenario. If you want to purge the cluster, manually provide the list of devices in group_vars/{{ osd_group_name }} using the devices variable."
     when:
-      devices|length == 0 and
-      osd_auto_discovery
+      - devices|length == 0
+      osd_auto_discovery
 
   - name: get osd numbers
     shell: "if [ -d /var/lib/ceph/osd ] ; then ls /var/lib/ceph/osd | cut -d '-' -f 2 ; fi"
       state: stopped
       enabled: no
     when:
-      ansible_os_family == 'RedHat' and
-      systemd_unit_files.stdout != "0"
+      - ansible_os_family == 'RedHat'
+      systemd_unit_files.stdout != "0"
 
   - name: stop ceph-osd with systemd
     service:
       enabled: no
     with_items: "{{ osd_ids.stdout_lines }}"
     when:
-      ansible_os_family == 'RedHat' and
-      systemd_unit_files.stdout != "0"
+      - ansible_os_family == 'RedHat'
+      systemd_unit_files.stdout != "0"
 
 # before infernalis release, using sysvinit scripts
 # we use this test so we do not have to know which RPM contains the boot script
 
   - name: stop ceph osds
     shell: "service ceph status osd ; if [ $? == 0 ] ; then service ceph stop osd ; else echo ; fi"
-    when:
-      ansible_os_family == 'RedHat'
+    when: ansible_os_family == 'RedHat'
 
 # Ubuntu 14.04
   - name: stop ceph osds on ubuntu
         initctl stop ceph-osd cluster={{ cluster }} id=$id
       done
     failed_when: false
-    when:
-      ansible_distribution == 'Ubuntu'
+    when: ansible_distribution == 'Ubuntu'
     with_items: "{{ osd_ids.stdout_lines }}"
 
   - name: see if ceph-disk-created data partitions are present
 
   - name: umount osd data partition
     shell: umount {{ item }}
-    with_items:
-     - "{{ mounted_osd.stdout_lines }}"
+    with_items: "{{ mounted_osd.stdout_lines }}"
 
   - name: remove osd mountpoint tree
     file:
       - restart machine
       - wait for server to boot
       - remove data
-    when:
-      remove_osd_mountpoints.failed is defined
+    when: remove_osd_mountpoints.failed is defined
 
   - name: see if ceph-disk is installed
     shell: "which ceph-disk"
     shell: ceph-disk zap "{{ item }}"
     with_items: "{{ devices }}"
     when:
-     ceph_disk_present.rc == 0 and
-     ceph_data_partlabels.rc == 0 and
-     zap_block_devs
+      - ceph_disk_present.rc == 0
+      - ceph_data_partlabels.rc == 0
+      - zap_block_devs
 
   - name: get ceph journal partitions
     shell: |
       blkid | awk '/ceph journal/ { sub (":", "", $1); print $1 }'
-    when:
-      - ceph_journal_partlabels.rc == 0
+    when: ceph_journal_partlabels.rc == 0
     failed_when: false
     register: ceph_journal_partition_to_erase_path
 
       state: stopped
       enabled: no
     when:
-      ansible_os_family == 'RedHat' and
-      systemd_unit_files.stdout != "0"
+      - ansible_os_family == 'RedHat'
+      systemd_unit_files.stdout != "0"
 
   - name: stop ceph mons with systemd
     service:
       state: stopped
       enabled: no
     when:
-      ansible_os_family == 'RedHat' and
-      systemd_unit_files.stdout != "0"
+      - ansible_os_family == 'RedHat'
+      systemd_unit_files.stdout != "0"
 
   - name: stop ceph mons
     shell: "service ceph status mon ; if [ $? == 0 ] ; then service ceph stop mon ; else echo ; fi"
-    when:
-      ansible_os_family == 'RedHat'
+    when: ansible_os_family == 'RedHat'
 
   - name: stop ceph mons on ubuntu
     command: initctl stop ceph-mon cluster={{ cluster }} id={{ ansible_hostname }}
     failed_when: false
-    when:
-      ansible_distribution == 'Ubuntu'
+    when: ansible_distribution == 'Ubuntu'
 
   - name: remove monitor store and bootstrap keys
     file:
     yum:
       name: "{{ item }}"
       state: absent
-    with_items:
-      - "{{ ceph_packages }}"
-    when:
-      ansible_pkg_mgr == 'yum'
+    with_items: "{{ ceph_packages }}"
+    when: ansible_pkg_mgr == 'yum'
 
   - name: purge ceph packages with dnf
     dnf:
       name: "{{ item }}"
       state: absent
-    with_items:
-      - "{{ ceph_packages }}"
-    when:
-      ansible_pkg_mgr == 'dnf'
+    with_items: "{{ ceph_packages }}"
+    when: ansible_pkg_mgr == 'dnf'
 
   - name: purge ceph packages with apt
     apt:
       name: "{{ item }}"
       state: absent
-    with_items:
-      - "{{ ceph_packages }}"
-    when:
-      ansible_pkg_mgr == 'apt'
+    with_items: "{{ ceph_packages }}"
+    when: ansible_pkg_mgr == 'apt'
 
   - name: purge remaining ceph packages with yum
     yum:
       name: "{{ item }}"
       state: absent
-    with_items:
-      - "{{ ceph_remaining_packages }}"
+    with_items: "{{ ceph_remaining_packages }}"
     when:
-      ansible_pkg_mgr == 'yum' and
-      purge_all_packages == true
+      - ansible_pkg_mgr == 'yum'
+      purge_all_packages == true
 
   - name: purge remaining ceph packages with dnf
     dnf:
       name: "{{ item }}"
       state: absent
-    with_items:
-      - "{{ ceph_remaining_packages }}"
+    with_items: "{{ ceph_remaining_packages }}"
     when:
-      ansible_pkg_mgr == 'dnf' and
-      purge_all_packages == true
+      - ansible_pkg_mgr == 'dnf'
+      purge_all_packages == true
 
   - name: purge remaining ceph packages with apt
     apt:
       name: "{{ item }}"
       state: absent
-    with_items:
-      - "{{ ceph_remaining_packages }}"
+    with_items: "{{ ceph_remaining_packages }}"
     when:
-      ansible_pkg_mgr == 'apt' and
-      purge_all_packages == true
+      - ansible_pkg_mgr == 'apt'
+      purge_all_packages == true
 
   - name: remove config
     file:
 
   - name: remove from SysV
     shell: "update-rc.d -f ceph remove"
-    when:
-      ansible_distribution == 'Ubuntu'
+    when: ansible_distribution == 'Ubuntu'
 
   - name: remove Upstart and SysV files
     shell: "find /etc -name '*ceph*' -delete"
-    when:
-      ansible_distribution == 'Ubuntu'
+    when: ansible_distribution == 'Ubuntu'
 
   - name: remove Upstart and apt logs and cache
     shell: "find /var -name '*ceph*' -delete"
-    when:
-      ansible_distribution == 'Ubuntu'
+    when: ansible_distribution == 'Ubuntu'
 
   - name: request data removal
     local_action: shell echo requesting data removal
 
   - name: purge dnf cache
     command: dnf clean all
-    when:
-      ansible_pkg_mgr == 'dnf'
+    when: ansible_pkg_mgr == 'dnf'
 
   - name: purge RPM cache in /tmp
     file:
 
   - name: clean apt
     shell: apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
-    when:
-      ansible_pkg_mgr == 'apt'
+    when: ansible_pkg_mgr == 'apt'
 
   - name: purge rh_storage.repo file in /etc/yum.repos.d
     file:
       path: /etc/yum.repos.d/rh_storage.repo
       state: absent
-    when:
-      ansible_os_family == 'RedHat'
+    when: ansible_os_family == 'RedHat'
 
 
 - name: purge fetch directory