main.yml 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. ---
  2. # TODO: Enhance redhat_subscription module
  3. # to make it able to attach to a pool
  4. # to make it able to enable repositories
  5. - set_fact:
  6. rhel_subscription_user: "{{ lookup('oo_option', 'rhel_subscription_user') | default(rhsub_user, True) | default(omit, True) }}"
  7. rhel_subscription_pass: "{{ lookup('oo_option', 'rhel_subscription_pass') | default(rhsub_pass, True) | default(omit, True) }}"
  8. rhel_subscription_server: "{{ lookup('oo_option', 'rhel_subscription_server') | default(rhsub_server) }}"
  9. - fail:
  10. msg: "This role is only supported for Red Hat hosts"
  11. when: ansible_distribution != 'RedHat'
  12. - fail:
  13. msg: Either rhsub_user or the rhel_subscription_user env variable are required for this role.
  14. when: rhel_subscription_user is not defined
  15. - fail:
  16. msg: Either rhsub_pass or the rhel_subscription_pass env variable are required for this role.
  17. when: rhel_subscription_pass is not defined
  18. - name: Satellite preparation
  19. command: "rpm -Uvh http://{{ rhel_subscription_server }}/pub/katello-ca-consumer-latest.noarch.rpm"
  20. args:
  21. creates: /etc/rhsm/ca/katello-server-ca.pem
  22. when: rhel_subscription_server is defined and rhel_subscription_server
  23. - name: RedHat subscriptions
  24. redhat_subscription:
  25. username: "{{ rhel_subscription_user }}"
  26. password: "{{ rhel_subscription_pass }}"
  27. autosubscribe: yes
  28. - include: enterprise.yml
  29. when: deployment_type == 'enterprise'