summaryrefslogtreecommitdiffstats
path: root/roles/rhel_subscribe/tasks/main.yml
blob: 8fb2fc042c5eb1ee1789e2e6e4de5a9091794cec (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
---
# TODO: Enhance redhat_subscription module
#       to make it able to attach to a pool
#       to make it able to enable repositories

- set_fact:
    rhel_subscription_user: "{{ lookup('oo_option', 'rhel_subscription_user') | default(rhsub_user, True) | default(omit, True) }}"
    rhel_subscription_pass: "{{ lookup('oo_option', 'rhel_subscription_pass') | default(rhsub_pass, True) | default(omit, True) }}"

- fail:
    msg: "This role is only supported for Red Hat hosts"
  when: ansible_distribution != 'RedHat'

- fail:
    msg: Either rsub_user or the rhel_subscription_user env variable are required for this role.
  when: rhel_subscription_user is not defined

- fail:
    msg: Either rsub_pass or the rhel_subscription_pass env variable are required for this role.
  when: rhel_subscription_pass is not defined

- name: RedHat subscriptions
  redhat_subscription:
    username: "{{ rhel_subscription_user }}"
    password: "{{ rhel_subscription_pass }}"
    autosubscribe: yes

- include: enterprise.yml
  when: deployment_type == 'enterprise'