Add pipefail option to shell invocations
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Jérémy Lecour 2021-05-13 15:34:27 +02:00 committed by Jérémy Lecour
parent 7dc6f0b849
commit e65340cb56
12 changed files with 13 additions and 13 deletions

View File

@ -1,7 +1,7 @@
---
- name: "hold packages (apt)"
shell: "(dpkg -l {{ item }} 2>/dev/null | grep -q -E '^(i|h)i') && ((apt-mark showhold | grep --quiet {{ item }}) || apt-mark hold {{ item }})"
shell: "set -o pipefail && (dpkg -l {{ item }} 2>/dev/null | grep -q -E '^(i|h)i') && ((apt-mark showhold | grep --quiet {{ item }}) || apt-mark hold {{ item }})"
register: apt_mark
changed_when: "item + ' set on hold.' in apt_mark.stdout"
failed_when:
@ -30,7 +30,7 @@
- apt
- name: "unhold packages (apt)"
shell: "(dpkg -l {{ item }} 2>/dev/null | grep -q -E '^(i|h)i') && ((apt-mark showhold | grep --quiet {{ item }}) && apt-mark unhold {{ item }})"
shell: "set -o pipefail && (dpkg -l {{ item }} 2>/dev/null | grep -q -E '^(i|h)i') && ((apt-mark showhold | grep --quiet {{ item }}) && apt-mark unhold {{ item }})"
register: apt_mark
changed_when: "'Canceled hold on' + item in apt_mark.stdout"
failed_when: apt_mark.rc != 0 and not apt_mark.stdout = ''

View File

@ -1,7 +1,7 @@
---
- name: Check if cron is installed
shell: "dpkg -l cron 2> /dev/null | grep -q -E '^(i|h)i'"
shell: "set -o pipefail && dpkg -l cron 2> /dev/null | grep -q -E '^(i|h)i'"
failed_when: False
changed_when: False
register: is_cron_installed

View File

@ -33,7 +33,7 @@
- ansible_distribution_major_version is version('10', '>=')
- name: Check if cron is installed
shell: "dpkg -l cron 2> /dev/null | grep -q -E '^(i|h)i'"
shell: "set -o pipefail && dpkg -l cron 2> /dev/null | grep -q -E '^(i|h)i'"
failed_when: False
changed_when: False
check_mode: no

View File

@ -1,7 +1,7 @@
---
- name: Check if cron is installed
shell: "dpkg -l cron 2> /dev/null | grep -q -E '^(i|h)i'"
shell: "set -o pipefail && dpkg -l cron 2> /dev/null | grep -q -E '^(i|h)i'"
failed_when: False
changed_when: False
check_mode: no

View File

@ -29,7 +29,7 @@
# HP gen <10: Hewlett-Packard Company Smart Array
# HP gen >=10: Adaptec Smart Storage PQI
- name: Detect if RAID is installed
shell: lspci -q | grep -e "RAID bus controller" -e "Serial Attached SCSI controller"
shell: "set -o pipefila && lspci -q | grep -e 'RAID bus controller' -e 'Serial Attached SCSI controller'"
check_mode: no
register: raidmodel
changed_when: "'FAILED' in raidmodel.stdout"

View File

@ -32,7 +32,7 @@
- postfix
- name: fetch users list
shell: getent passwd | cut -d":" -f 1 | grep -v root
shell: "set -o pipefail && getent passwd | cut -d':' -f 1 | grep -v root"
check_mode: no
register: non_root_users_list

View File

@ -85,7 +85,7 @@
#- name: Customizing /etc/fstab
- name: Check if cron is installed
shell: "dpkg -l cron 2> /dev/null | grep -q -E '^(i|h)i'"
shell: "set -o pipefail && dpkg -l cron 2> /dev/null | grep -q -E '^(i|h)i'"
failed_when: False
changed_when: False
check_mode: no

View File

@ -1,6 +1,6 @@
---
- name: Check if cron is installed
shell: "dpkg -l cron 2> /dev/null | grep -q -E '^(i|h)i'"
shell: "set -o pipefail && dpkg -l cron 2> /dev/null | grep -q -E '^(i|h)i'"
failed_when: False
changed_when: False
register: is_cron_installed

View File

@ -17,7 +17,7 @@
mode: "0644"
- name: Check if percona-release is installed
command: "dpkg -l percona-release"
command: "set -o pipefail && dpkg -l percona-release 2> /dev/null | grep -q -E '^(i|h)i'"
failed_when: False
changed_when: False
register: percona__apt_config_package_installed

View File

@ -98,7 +98,7 @@
- postfix
- name: Check if cron is installed
shell: "dpkg -l cron 2> /dev/null | grep -q -E '^(i|h)i'"
shell: "set -o pipefail && dpkg -l cron 2> /dev/null | grep -q -E '^(i|h)i'"
failed_when: False
changed_when: False
register: is_cron_installed

View File

@ -66,7 +66,7 @@
- spamassassin
- name: Check if cron is installed
shell: "dpkg -l cron 2> /dev/null | grep -q -E '^(i|h)i'"
shell: "set -o pipefail && dpkg -l cron 2> /dev/null | grep -q -E '^(i|h)i'"
failed_when: False
changed_when: False
register: is_cron_installed

View File

@ -29,7 +29,7 @@
- ssl
- name: Check if Haproxy is installed
command: dpkg -l haproxy
command: "set -o pipefail && dpkg -l haproxy 2> /dev/null | grep -q -E '^(i|h)i'"
register: haproxy_check
check_mode: False
changed_when: False