blob: e7eb6c572be3236630b8483aadebc48fb383e085 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
---
- fail:
msg: "This role is only supported for Red Hat hosts"
when: ansible_distribution != 'RedHat'
- name: Install Red Hat Subscription manager
yum:
name: subscription-manager
state: present
register: result
until: result is succeeded
- name: Is host already registered?
command: "subscription-manager version"
register: rh_subscribed
changed_when: False
- name: Register host
redhat_subscription:
username: "{{ rhsub_user }}"
password: "{{ rhsub_pass }}"
register: rh_subscription
until: rh_subscription is succeeded
when:
- "'not registered' in rh_subscribed.stdout"
- fail:
msg: 'Unable to register host with Red Hat Subscription Manager'
when:
- "'not registered' in rh_subscribed.stdout"
- rh_subscription.failed
- name: Determine if OpenShift Pool Already Attached
command: "subscription-manager list --consumed --pool-only --matches '*OpenShift*'"
register: openshift_pool_attached
changed_when: False
ignore_errors: yes
- name: Attach to OpenShift Pool
command: "subscription-manager attach --pool {{ rhsub_pool }}"
register: openshift_pool_attached
changed_when: "'Successfully attached a subscription' in openshift_pool_attached.stdout"
when: rhsub_pool not in openshift_pool_attached.stdout
- include_tasks: satellite.yml
when:
- rhsub_server is defined
- rhsub_server
|