main.yaml 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. ---
  2. - name: openshift_repos detect ostree
  3. stat:
  4. path: /run/ostree-booted
  5. register: ostree_booted
  6. - block:
  7. - name: Ensure libselinux-python is installed
  8. package: name=libselinux-python state=present
  9. - name: Create any additional repos that are defined
  10. template:
  11. src: yum_repo.j2
  12. dest: /etc/yum.repos.d/openshift_additional.repo
  13. when:
  14. - openshift_additional_repos | length > 0
  15. notify: refresh cache
  16. - name: Remove the additional repos if no longer defined
  17. file:
  18. dest: /etc/yum.repos.d/openshift_additional.repo
  19. state: absent
  20. when:
  21. - openshift_additional_repos | length == 0
  22. notify: refresh cache
  23. # Note: OpenShift repositories under CentOS may be shipped through the
  24. # "centos-release-openshift-origin" package which configures the repository.
  25. # This task matches the file names provided by the package so that they are
  26. # not installed twice in different files and remains idempotent.
  27. - name: Configure origin gpg keys if needed
  28. copy:
  29. src: "{{ item.src }}"
  30. dest: "{{ item.dest }}"
  31. with_items:
  32. - src: origin/gpg_keys/openshift-ansible-CentOS-SIG-PaaS
  33. dest: /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-PaaS
  34. - src: origin/repos/openshift-ansible-centos-paas-sig.repo
  35. dest: /etc/yum.repos.d/CentOS-OpenShift-Origin.repo
  36. notify: refresh cache
  37. when:
  38. - ansible_os_family == "RedHat"
  39. - ansible_distribution != "Fedora"
  40. - openshift_deployment_type == 'origin'
  41. - openshift_enable_origin_repo | default(true) | bool
  42. # Singleton block
  43. - when: r_osr_first_run | default(true)
  44. block:
  45. - name: Ensure clean repo cache in the event repos have been changed manually
  46. debug:
  47. msg: "First run of openshift_repos"
  48. changed_when: true
  49. notify: refresh cache
  50. - name: Set fact r_osr_first_run false
  51. set_fact:
  52. r_osr_first_run: false
  53. # Force running ALL handlers now, because we expect repo cache to be cleared
  54. # if changes have been made.
  55. - meta: flush_handlers
  56. when: not ostree_booted.stat.exists