# vim: set ft=ansible:
---
- hosts: localhost
  connection: local
  sudo: no
  gather_facts: no
  vars_files:
  - ../vars.yml
  vars:
    cluster_hosts: "{{ groups['tag_env_' ~ cluster_id] }}"
  tasks:
  - fail:
      msg: required values not set
    when: rhsm_user is not defined or rhsm_pass is not defined or cluster_id is not defined and not (skip_subscription_management | bool)

  - add_host:
      name: "{{ item }}"
      ansible_ssh_user: openshift
      ansible_sudo: yes
      groups: oo_hosts_to_register
    with_items: cluster_hosts

- name: Register host(s)
  hosts: oo_hosts_to_register
  serial: 1
  tasks:
  - name: Enable subscription-manager
    ini_file:
      dest: /etc/yum/pluginconf.d/subscription-manager.conf
      section: main
      option: enabled
      value: 1
    when: not (skip_subscription_management | bool)

  - name: Register host
    redhat_subscription:
      username: "{{ rhsm_user }}"
      password: "{{ rhsm_pass }}"
      state: present
      pool: "^(60 Day Supported OpenShift Enterprise|Employee)"
    when: not (skip_subscription_management | bool)

# vim: set ft=ansible:
---
- hosts: localhost
  connection: local
  sudo: no
  gather_facts: no
  vars_files:
  - ../vars.yml
  vars:
    cluster_hosts: "{{ groups['tag_env_' ~ cluster_id] }}"
  tasks:
  - fail:
      msg: required values not set
    when: rhsm_user is not defined or rhsm_pass is not defined or cluster_id is not defined and not (skip_subscription_management | bool)

  - add_host:
      name: "{{ item }}"
      ansible_ssh_user: openshift
      ansible_sudo: yes
      groups: oo_hosts_to_register
    with_items: cluster_hosts

- name: Register host(s)
  hosts: oo_hosts_to_register
  serial: 1
  tasks:
  - name: Enable subscription-manager
    ini_file:
      dest: /etc/yum/pluginconf.d/subscription-manager.conf
      section: main
      option: enabled
      value: 1
    when: not (skip_subscription_management | bool)

  - name: Register host
    redhat_subscription:
      username: "{{ rhsm_user }}"
      password: "{{ rhsm_pass }}"
      state: present
      pool: "^(60 Day Supported OpenShift Enterprise|OpenShift Enterprise Premium|Employee)"
    when: not (skip_subscription_management | bool)

Add support for OpenShift Enterprise Premium RHSM pool
Add support for OpenShift Enterprise Premium RHSM pool
