]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
common: do not use pipefail when not needed
authorGuillaume Abrioux <gabrioux@redhat.com>
Mon, 30 Nov 2020 16:08:18 +0000 (17:08 +0100)
committerDimitri Savineau <savineau.dimitri@gmail.com>
Wed, 2 Dec 2020 01:18:35 +0000 (20:18 -0500)
Let's discard the ansible lint error 306 and add a "# noqa 306" on tasks
where we don't need `set -o pipefail`

Fixes: #6090
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 86a8889ee3adffc81d3435895a7a117824e779ad)

infrastructure-playbooks/purge-cluster.yml
infrastructure-playbooks/rolling_update.yml
roles/ceph-osd/tasks/start_osds.yml

index 8b86117ea64d5c8d15edc986b8ce17345bc62f85..796987aebfe1b3871ec5c41ed31b6b6e080d3598 100644 (file)
     when: lvm_volumes is not defined
 
   - name: get osd numbers
-    shell: |
-      set -o pipefail;
-      if [ -d /var/lib/ceph/osd ] ; then ls /var/lib/ceph/osd | sed 's/.*-//' ; fi
+    shell: if [ -d /var/lib/ceph/osd ] ; then ls /var/lib/ceph/osd | sed 's/.*-//' ; fi  # noqa 306
     register: osd_ids
     changed_when: false
 
 
   # NOTE(leseb): hope someone will find a more elegant way one day...
   - name: see if encrypted partitions are present
-    shell: |
-      set -o pipefail;
-      blkid -t TYPE=crypto_LUKS -s PARTLABEL -s PARTUUID | grep "ceph.*." | grep -o PARTUUID.* | cut -d '"' -f 2
+    shell: blkid -t TYPE=crypto_LUKS -s PARTLABEL -s PARTUUID | grep "ceph.*." | grep -o PARTUUID.* | cut -d '"' -f 2  # noqa 306
     register: encrypted_ceph_partuuid
-    failed_when: false
     changed_when: false
 
   - name: get osd data and lockbox mount points
-    shell: |
-      set -o pipefail;
-      (grep /var/lib/ceph/osd /proc/mounts || echo -n) | awk '{ print $2 }'
+    shell: (grep /var/lib/ceph/osd /proc/mounts || echo -n) | awk '{ print $2 }'  # noqa 306
     register: mounted_osd
     changed_when: false
 
     when: encrypted_ceph_partuuid.stdout_lines | length > 0
 
   - name: get payload_offset
-    shell: |
-      set -o pipefail;
-      cryptsetup luksDump /dev/disk/by-partuuid/{{ item }} | awk '/Payload offset:/ { print $3 }'
+    shell: cryptsetup luksDump /dev/disk/by-partuuid/{{ item }} | awk '/Payload offset:/ { print $3 }'  # noqa 306
     register: payload_offset
     with_items: "{{ encrypted_ceph_partuuid.stdout_lines }}"
     when: encrypted_ceph_partuuid.stdout_lines | length > 0
 
   - name: wipe partitions
     shell: |
-      set -o pipefail;
       wipefs --all "{{ item }}"
       dd if=/dev/zero of="{{ item }}" bs=1 count=4096
     changed_when: false
     with_items: "{{ combined_devices_list }}"
 
-  - name: zap ceph journal/block db/block wal partitions
+  - name: zap ceph journal/block db/block wal partitions  # noqa 306
     shell: |
-      set -o pipefail;
       # if the disk passed is a raw device AND the boot system disk
       if parted -s /dev/"{{ item }}" print | grep -sq boot; then
         echo "Looks like /dev/{{ item }} has a boot partition,"
index 81bcce8031098934fa6e5afdf59ef49a601f8933..12f75a492e844f5596aa071d477ebdd2d53bc409 100644 (file)
         name: ceph-facts
 
     - name: get osd numbers - non container
-      shell: |
-        set -o pipefail;
-        if [ -d /var/lib/ceph/osd ] ; then ls /var/lib/ceph/osd | sed 's/.*-//' ; fi
+      shell: if [ -d /var/lib/ceph/osd ] ; then ls /var/lib/ceph/osd | sed 's/.*-//' ; fi  # noqa 306
       register: osd_ids
       changed_when: false
 
index 5397d5841330c0df02b99375c9fb7b7f6b479087..42d2e79a1b1145583257f333f6623e247ae22b8c 100644 (file)
 
 # this is for ceph-disk, the ceph-disk command is gone so we have to list /var/lib/ceph
 - name: get osd ids
-  shell: |
-    set -o pipefail;
-    ls /var/lib/ceph/osd/ | sed 's/.*-//'
+  shell: ls /var/lib/ceph/osd/ | sed 's/.*-//'  # noqa 306
   args:
     executable: /bin/bash
   changed_when: false
+  failed_when: false
   register: osd_ids_non_container
 
 - name: set_fact container_exec_start_osd