main.yaml 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. ---
  2. # TODO: Add flag for enabling EPEL repo, default to false
  3. # TODO: Add subscription-management config, with parameters
  4. # for username, password, poolid(name), and official repos to
  5. # enable/disable. Might need to make a module that extends the
  6. # subscription management module to take a poolid and enable/disable the
  7. # proper repos correctly.
  8. - assert:
  9. that: openshift.common.deployment_type in known_openshift_deployment_types
  10. - name: Ensure libselinux-python is installed
  11. yum:
  12. pkg: libselinux-python
  13. state: present
  14. when: ansible_pkg_mgr == "yum"
  15. - name: Ensure libselinux-python is installed
  16. dnf:
  17. pkg: libselinux-python
  18. state: present
  19. when: ansible_pkg_mgr == "dnf"
  20. - name: Create any additional repos that are defined
  21. template:
  22. src: yum_repo.j2
  23. dest: /etc/yum.repos.d/openshift_additional.repo
  24. when: openshift_additional_repos | length > 0
  25. notify: refresh yum cache
  26. - name: Remove the additional repos if no longer defined
  27. file:
  28. dest: /etc/yum.repos.d/openshift_additional.repo
  29. state: absent
  30. when: openshift_additional_repos | length == 0
  31. notify: refresh yum cache
  32. - name: Remove any yum repo files for other deployment types RHEL/CentOS
  33. file:
  34. path: "/etc/yum.repos.d/{{ item | basename }}"
  35. state: absent
  36. with_fileglob:
  37. - '*/repos/*'
  38. when: not (item | search("/files/" ~ openshift_deployment_type ~ "/repos")) and
  39. (ansible_os_family == "RedHat" and ansible_distribution != "Fedora")
  40. notify: refresh yum cache
  41. - name: Remove any yum repo files for other deployment types Fedora
  42. file:
  43. path: "/etc/yum.repos.d/{{ item | basename }}"
  44. state: absent
  45. with_fileglob:
  46. - '*/repos/*'
  47. when: not (item | search("/files/fedora-" ~ openshift_deployment_type ~ "/repos")) and
  48. (ansible_distribution == "Fedora")
  49. notify: refresh dnf cache
  50. - name: Configure gpg keys if needed
  51. copy: src={{ item }} dest=/etc/pki/rpm-gpg/
  52. with_fileglob:
  53. - "{{ openshift_deployment_type }}/gpg_keys/*"
  54. notify: refresh yum cache
  55. - name: Configure yum repositories RHEL/CentOS
  56. copy: src={{ item }} dest=/etc/yum.repos.d/
  57. with_fileglob:
  58. - "{{ openshift_deployment_type }}/repos/*"
  59. notify: refresh yum cache
  60. when: (ansible_os_family == "RedHat" and ansible_distribution != "Fedora")
  61. - name: Configure yum repositories Fedora
  62. copy: src={{ item }} dest=/etc/yum.repos.d/
  63. with_fileglob:
  64. - "fedora-{{ openshift_deployment_type }}/repos/*"
  65. notify: refresh dnf cache
  66. when: (ansible_distribution == "Fedora")