| | |
| | | # vim: set ft=ansible: |
| | | --- |
| | | - name: Force unregister before register |
| | | redhat_subscription: |
| | | state: absent |
| | | register: task_result |
| | | until: task_result | succeeded |
| | | retries: 10 |
| | | delay: 5 |
| | | |
| | | - name: register node with subscription-manager |
| | | - name: Force unregister before register |
| | | command: "{{ item }}" |
| | | args: |
| | | warn: False |
| | | with_items: |
| | | - 'subscription-manager clean' |
| | | - 'subscription-manager remove --all' |
| | | - 'yum remove -y "katello-ca-consumer-*"' |
| | | |
| | | - name: 'Register system using Red Hat Subscription Manager' |
| | | redhat_subscription: |
| | | state: present |
| | | username: "{{ rhel_subscription_user }}" |
| | | password: "{{ rhel_subscription_pass }}" |
| | | autosubscribe: false |
| | | register: task_result |
| | | until: task_result | succeeded |
| | | retries: 10 |
| | | delay: 5 |
| | | pool_ids: "{{ rhsm_pool_ids }}" |
| | | auto_attach: false |
| | | |
| | | # TODO: should take pool ids from a var |
| | | - name: get product pool id |
| | | shell: /usr/bin/subscription-manager list --all --available --matches="*{{rhn_pool_id_string}}*" | awk '/Pool ID/ {print $3}' | head -1 |
| | | # command: subscription-manager list --all --available --matches="OpenShift Container Platform" | awk '/Pool ID/ {print $3}' | head -1 |
| | | register: pool_id |
| | | until: pool_id | succeeded |
| | | retries: 10 |
| | | delay: 5 |
| | | |
| | | - name: attach host to subscription pool |
| | | shell: /usr/bin/subscription-manager attach --pool={{ pool_id.stdout }} |
| | | register: task_result |
| | | until: task_result.rc == 0 |
| | | retries: 10 |
| | | delay: 5 |
| | | |
| | | - name: enable repos for rhel |
| | | command: subscription-manager repos --enable "{{ item }}" |
| | | with_items: |
| | | - '{{ rhel_repos }}' |
| | | - name: "Run 'subscription-manager to disable/enable repos" |
| | | command: >- |
| | | subscription-manager repos {% for repo in rhel_repos %} |
| | | --enable={{ repo }} |
| | | {% endfor %} |
| | | when: rhel_repos | default([]) | length > 0 |