copr-builders: automatically unsubscribe when subscription fails

Seems the subscription manager Ansible module fails to unregister the
machine when the pool attachement fails.  This terminates our playbook,
and the whole machine - but RHSM keeps tracking the system.
This commit is contained in:
Pavel Raiskup 2022-01-17 14:47:19 +01:00
parent 57f259c3e1
commit f546a6fd96

View file

@ -101,6 +101,16 @@
- copr_red_hat_subscription_password is defined
tags:
- red_hat_subscription
ignore_errors: true
register: subscription
- name: Cleanup subscription before failure
community.general.redhat_subscription:
state: absent
when: subscription.failed
- fail: msg="Could not subscribe"
when: subscription.failed
- name: install copr-builder and other latest packages
dnf: state=latest pkg={{ packages }}