summaryrefslogtreecommitdiffstats
path: root/deployment/playbooks/roles/rhsm-unregister/rhsm-unregister/tasks/main.yaml
diff options
context:
space:
mode:
Diffstat (limited to 'deployment/playbooks/roles/rhsm-unregister/rhsm-unregister/tasks/main.yaml')
-rw-r--r--deployment/playbooks/roles/rhsm-unregister/rhsm-unregister/tasks/main.yaml14
1 files changed, 14 insertions, 0 deletions
diff --git a/deployment/playbooks/roles/rhsm-unregister/rhsm-unregister/tasks/main.yaml b/deployment/playbooks/roles/rhsm-unregister/rhsm-unregister/tasks/main.yaml
new file mode 100644
index 00000000..9b9f3b21
--- /dev/null
+++ b/deployment/playbooks/roles/rhsm-unregister/rhsm-unregister/tasks/main.yaml
@@ -0,0 +1,14 @@
+---
+- block:
+ - name: Is the host already registered?
+ command: "subscription-manager list"
+ register: subscribed
+ ignore_errors: yes
+
+ - name: Unregister host
+ redhat_subscription:
+ state: absent
+ when: "'Subscribed' in subscribed.stdout"
+ ignore_errors: yes
+
+ when: ansible_distribution == "RedHat"