summaryrefslogtreecommitdiffstats
path: root/deployment/playbooks/roles/rhsm-unregister/rhsm-unregister/tasks/main.yaml
blob: 9b9f3b21b1b1bf1d7aba54f85e533ab608a27f9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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"