---
- name: Disable all repositories
  command: subscription-manager repos --disable="*"

- set_fact:
    default_ose_version: '3.6'
  when: deployment_type == 'openshift-enterprise'

- set_fact:
    ose_version: "{{ lookup('env', 'ose_version') | default(default_ose_version, True) }}"

- fail:
    msg: "{{ ose_version }} is not a valid version for {{ deployment_type }} deployment type"
  when:
    - deployment_type == 'openshift-enterprise'
    - ose_version not in ['3.1', '3.2', '3.3', '3.4', '3.5', '3.6']

- name: Enable RHEL repositories
  command: subscription-manager repos \
               --enable="rhel-7-server-rpms" \
               --enable="rhel-7-server-extras-rpms" \
               --enable="rhel-7-server-ose-{{ ose_version }}-rpms" \
               --enable="rhel-7-fast-datapath-rpms"
  register: subscribe_repos
  until: subscribe_repos | succeeded

---
- name: Disable all repositories
  command: subscription-manager repos --disable="*"

- set_fact:
    default_ose_version: '3.6'
  when: deployment_type == 'openshift-enterprise'

- set_fact:
    ose_version: "{{ lookup('env', 'ose_version') | default(default_ose_version, True) }}"

- fail:
    msg: "{{ ose_version }} is not a valid version for {{ deployment_type }} deployment type"
  when:
    - deployment_type == 'openshift-enterprise'
    - ose_version not in ['3.1', '3.2', '3.3', '3.4', '3.5', '3.6'] )

- name: Enable RHEL repositories
  command: subscription-manager repos \
               --enable="rhel-7-server-rpms" \
               --enable="rhel-7-server-extras-rpms" \
               --enable="rhel-7-server-ose-{{ ose_version }}-rpms" \
               --enable="rhel-7-fast-datapath-rpms"
  register: subscribe_repos
  until: subscribe_repos | succeeded

Revert "Fix syntax error caused by an extra paren"
Revert "Fix syntax error caused by an extra paren"

The rhel_subscribe fixes will be done in a separate pull request.

This reverts commit e05e4d3d4fab4eaf462a23f5d5ee39fb57f4f0a0.
