Skip to content

Commit

Permalink
fix: Use always section instead of rescue to remove RHEL subscription (
Browse files Browse the repository at this point in the history
…#690)

Using a `rescue` section hides errors in the failed task. From docs:

> If an error occurs in the block and the rescue task succeeds, Ansible
> reverts the failed status of the original task for the run and continues
> to run the play as if the oriinal task had succeeded. The rescued task
> is considered successful

In this case we want the error to be propagated, and should use an
`always` section to ensure the machine is unregistered from RHSM.
  • Loading branch information
jimmidyson authored Feb 23, 2023
1 parent a4ecf53 commit 3729abe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ansible/provision.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
- import_role:
name: sysprep
when: sysprep # make the finalize process skipable
rescue:
always:
- name: Remove RHEL subscription
block:
- name: Remove subscriptions
Expand Down

0 comments on commit 3729abe

Please sign in to comment.