common: do not use pipefail when not needed

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 86a8889ee3)
pull/6105/head
Guillaume Abrioux 2020-11-30 17:08:18 +01:00 committed by Dimitri Savineau
parent 679d3e2d10
commit 6b04f1154f
3 changed files with 8 additions and 22 deletions

View File

@ -388,9 +388,7 @@
when: lvm_volumes is not defined when: lvm_volumes is not defined
- name: get osd numbers - name: get osd numbers
shell: | shell: if [ -d /var/lib/ceph/osd ] ; then ls /var/lib/ceph/osd | sed 's/.*-//' ; fi # noqa 306
set -o pipefail;
if [ -d /var/lib/ceph/osd ] ; then ls /var/lib/ceph/osd | sed 's/.*-//' ; fi
register: osd_ids register: osd_ids
changed_when: false changed_when: false
@ -412,17 +410,12 @@
# NOTE(leseb): hope someone will find a more elegant way one day... # NOTE(leseb): hope someone will find a more elegant way one day...
- name: see if encrypted partitions are present - name: see if encrypted partitions are present
shell: | shell: blkid -t TYPE=crypto_LUKS -s PARTLABEL -s PARTUUID | grep "ceph.*." | grep -o PARTUUID.* | cut -d '"' -f 2 # noqa 306
set -o pipefail;
blkid -t TYPE=crypto_LUKS -s PARTLABEL -s PARTUUID | grep "ceph.*." | grep -o PARTUUID.* | cut -d '"' -f 2
register: encrypted_ceph_partuuid register: encrypted_ceph_partuuid
failed_when: false
changed_when: false changed_when: false
- name: get osd data and lockbox mount points - name: get osd data and lockbox mount points
shell: | shell: (grep /var/lib/ceph/osd /proc/mounts || echo -n) | awk '{ print $2 }' # noqa 306
set -o pipefail;
(grep /var/lib/ceph/osd /proc/mounts || echo -n) | awk '{ print $2 }'
register: mounted_osd register: mounted_osd
changed_when: false changed_when: false
@ -466,9 +459,7 @@
when: encrypted_ceph_partuuid.stdout_lines | length > 0 when: encrypted_ceph_partuuid.stdout_lines | length > 0
- name: get payload_offset - name: get payload_offset
shell: | shell: cryptsetup luksDump /dev/disk/by-partuuid/{{ item }} | awk '/Payload offset:/ { print $3 }' # noqa 306
set -o pipefail;
cryptsetup luksDump /dev/disk/by-partuuid/{{ item }} | awk '/Payload offset:/ { print $3 }'
register: payload_offset register: payload_offset
with_items: "{{ encrypted_ceph_partuuid.stdout_lines }}" with_items: "{{ encrypted_ceph_partuuid.stdout_lines }}"
when: encrypted_ceph_partuuid.stdout_lines | length > 0 when: encrypted_ceph_partuuid.stdout_lines | length > 0
@ -586,15 +577,13 @@
- name: wipe partitions - name: wipe partitions
shell: | shell: |
set -o pipefail;
wipefs --all "{{ item }}" wipefs --all "{{ item }}"
dd if=/dev/zero of="{{ item }}" bs=1 count=4096 dd if=/dev/zero of="{{ item }}" bs=1 count=4096
changed_when: false changed_when: false
with_items: "{{ combined_devices_list }}" 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: | shell: |
set -o pipefail;
# if the disk passed is a raw device AND the boot system disk # if the disk passed is a raw device AND the boot system disk
if parted -s /dev/"{{ item }}" print | grep -sq boot; then if parted -s /dev/"{{ item }}" print | grep -sq boot; then
echo "Looks like /dev/{{ item }} has a boot partition," echo "Looks like /dev/{{ item }} has a boot partition,"

View File

@ -368,9 +368,7 @@
name: ceph-facts name: ceph-facts
- name: get osd numbers - non container - name: get osd numbers - non container
shell: | shell: if [ -d /var/lib/ceph/osd ] ; then ls /var/lib/ceph/osd | sed 's/.*-//' ; fi # noqa 306
set -o pipefail;
if [ -d /var/lib/ceph/osd ] ; then ls /var/lib/ceph/osd | sed 's/.*-//' ; fi
register: osd_ids register: osd_ids
changed_when: false changed_when: false

View File

@ -11,12 +11,11 @@
# this is for ceph-disk, the ceph-disk command is gone so we have to list /var/lib/ceph # this is for ceph-disk, the ceph-disk command is gone so we have to list /var/lib/ceph
- name: get osd ids - name: get osd ids
shell: | shell: ls /var/lib/ceph/osd/ | sed 's/.*-//' # noqa 306
set -o pipefail;
ls /var/lib/ceph/osd/ | sed 's/.*-//'
args: args:
executable: /bin/bash executable: /bin/bash
changed_when: false changed_when: false
failed_when: false
register: osd_ids_non_container register: osd_ids_non_container
- name: set_fact container_exec_start_osd - name: set_fact container_exec_start_osd