base: do not fail when the prune entry is root's only cron line

grep -v exits 1 when it prints nothing, and with pipefail that failed
the task on both hosts, although the crontab had been rewritten
correctly. Ignore grep's exit status.

Assisted-by: Claude:fable-5-2
This commit is contained in:
Sergei Poljanski 2026-11-12 06:50:37 +04:00
commit 33fbc06681

View file

@ -70,7 +70,7 @@
- name: Drop the old prune entry from root's crontab - name: Drop the old prune entry from root's crontab
ansible.builtin.shell: | ansible.builtin.shell: |
set -o pipefail set -o pipefail
crontab -l | grep -v 'docker image prune' | crontab - crontab -l | { grep -v 'docker image prune' || true; } | crontab -
args: args:
executable: /bin/bash executable: /bin/bash
when: "'docker image prune' in root_crontab.stdout" when: "'docker image prune' in root_crontab.stdout"