joelbirchler
2020-02-17 69dbaafbb88bdf8c03eb88d743ebe908e670cc0e
ansible/roles/set-repositories/tasks/rhn-repos.yml
@@ -18,7 +18,27 @@
    pool_ids: "{{ rhsm_pool_ids }}"
    auto_attach: false
- name: "Run 'subscription-manager to disable/enable repos"
# 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 is 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: "Run subscription-manager to disable all repos"
  command: subscription-manager repos --disable "*"
  when: disable_default_repos | d(false)
- name: "Run subscription-manager to enable repos"
  command: >-
    subscription-manager repos {% for repo in rhel_repos %}
    --enable={{ repo }}