You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

161 lines
5.5 KiB

  1. ---
  2. - block:
  3. - name: Add Debian Backports apt repo
  4. apt_repository:
  5. repo: "deb http://deb.debian.org/debian {{ ansible_distribution_release }}-backports main"
  6. state: present
  7. filename: debian-backports
  8. - name: Set libseccomp2 pin priority to apt_preferences on Debian buster
  9. copy:
  10. content: |
  11. Package: libseccomp2
  12. Pin: release a={{ ansible_distribution_release }}-backports
  13. Pin-Priority: 1001
  14. dest: "/etc/apt/preferences.d/libseccomp2"
  15. owner: "root"
  16. mode: 0644
  17. when:
  18. - ansible_distribution == "Debian"
  19. - ansible_distribution_version == "10"
  20. - name: CRI-O kubic repo name for debian os family
  21. set_fact:
  22. crio_kubic_debian_repo_name: "{{ ((ansible_distribution == 'Ubuntu') | ternary('x','')) ~ ansible_distribution ~ '_' ~ ansible_distribution_version }}"
  23. when: ansible_os_family == "Debian"
  24. - name: Add CRI-O kubic apt repo key
  25. apt_key:
  26. url: "https://{{ crio_download_base }}/{{ crio_kubic_debian_repo_name }}/Release.key"
  27. state: present
  28. when: crio_kubic_debian_repo_name is defined
  29. register: apt_key_download
  30. until: apt_key_download is succeeded
  31. retries: 4
  32. delay: "{{ retry_stagger | d(3) }}"
  33. environment: "{{ proxy_env }}"
  34. - name: Add CRI-O kubic apt repo
  35. apt_repository:
  36. repo: "deb http://{{ crio_download_base }}/{{ crio_kubic_debian_repo_name }}/ /"
  37. state: present
  38. filename: devel-kubic-libcontainers-stable
  39. when: crio_kubic_debian_repo_name is defined
  40. - name: Add CRI-O kubic cri-o apt repo
  41. apt_repository:
  42. repo: "deb {{ crio_download_crio }}{{ crio_version }}/{{ crio_kubic_debian_repo_name }}/ /"
  43. state: present
  44. filename: devel-kubic-libcontainers-stable-cri-o
  45. when: crio_kubic_debian_repo_name is defined
  46. - name: Check that amzn2-extras.repo exists
  47. stat:
  48. path: /etc/yum.repos.d/amzn2-extras.repo
  49. register: amzn2_extras_file_stat
  50. when: ansible_distribution in ["Amazon"]
  51. - name: Find docker repo in amzn2-extras.repo file
  52. lineinfile:
  53. dest: /etc/yum.repos.d/amzn2-extras.repo
  54. line: "[amzn2extra-docker]"
  55. check_mode: yes
  56. register: amzn2_extras_docker_repo
  57. when:
  58. - ansible_distribution in ["Amazon"]
  59. - amzn2_extras_file_stat.stat.exists
  60. - name: Remove docker repository
  61. ini_file:
  62. dest: /etc/yum.repos.d/amzn2-extras.repo
  63. section: amzn2extra-docker
  64. option: enabled
  65. value: "0"
  66. backup: yes
  67. mode: 0644
  68. when:
  69. - ansible_distribution in ["Amazon"]
  70. - amzn2_extras_file_stat.stat.exists
  71. - not amzn2_extras_docker_repo.changed
  72. - name: Add container-selinux yum repo
  73. yum_repository:
  74. name: copr:copr.fedorainfracloud.org:lsm5:container-selinux
  75. file: _copr_lsm5-container-selinux.repo
  76. description: Copr repo for container-selinux owned by lsm5
  77. baseurl: https://download.copr.fedorainfracloud.org/results/lsm5/container-selinux/epel-7-$basearch/
  78. gpgcheck: yes
  79. gpgkey: https://download.copr.fedorainfracloud.org/results/lsm5/container-selinux/pubkey.gpg
  80. skip_if_unavailable: yes
  81. enabled: yes
  82. repo_gpgcheck: no
  83. when: ansible_distribution in ["Amazon"]
  84. - name: Add CRI-O kubic yum repo
  85. yum_repository:
  86. name: devel_kubic_libcontainers_stable
  87. description: Stable Releases of Upstream github.com/containers packages (CentOS_$releasever)
  88. baseurl: http://{{ crio_download_base }}/CentOS_{{ ansible_distribution_major_version }}/
  89. gpgcheck: yes
  90. gpgkey: http://{{ crio_download_base }}/CentOS_{{ ansible_distribution_major_version }}/repodata/repomd.xml.key
  91. keepcache: '0'
  92. when:
  93. - ansible_os_family == "RedHat"
  94. - ansible_distribution not in ["Amazon", "Fedora"]
  95. - name: Add CRI-O kubic yum repo
  96. yum_repository:
  97. name: "devel_kubic_libcontainers_stable_cri-o_{{ crio_version }}"
  98. description: "CRI-O {{ crio_version }} (CentOS_$releasever)"
  99. baseurl: "{{ crio_download_crio }}{{ crio_version }}/CentOS_{{ ansible_distribution_major_version }}/"
  100. gpgcheck: yes
  101. gpgkey: "{{ crio_download_crio }}{{ crio_version }}/CentOS_{{ ansible_distribution_major_version }}/repodata/repomd.xml.key"
  102. when:
  103. - ansible_os_family == "RedHat"
  104. - ansible_distribution not in ["Amazon", "Fedora"]
  105. - name: Add CRI-O kubic yum repo
  106. yum_repository:
  107. name: devel_kubic_libcontainers_stable
  108. description: Stable Releases of Upstream github.com/containers packages
  109. baseurl: http://{{ crio_download_base }}/CentOS_7/
  110. gpgcheck: yes
  111. gpgkey: http://{{ crio_download_base }}/CentOS_7/repodata/repomd.xml.key
  112. keepcache: '0'
  113. when: ansible_distribution in ["Amazon"]
  114. - name: Add CRI-O kubic yum repo
  115. yum_repository:
  116. name: "devel_kubic_libcontainers_stable_cri-o_{{ crio_version }}"
  117. description: "CRI-O {{ crio_version }}"
  118. baseurl: "{{ crio_download_crio }}{{ crio_version }}/CentOS_7/"
  119. gpgcheck: yes
  120. gpgkey: "{{ crio_download_crio }}{{ crio_version }}/CentOS_7/repodata/repomd.xml.key"
  121. when: ansible_distribution in ["Amazon"]
  122. - name: Enable modular repos for CRI-O
  123. ini_file:
  124. path: "/etc/yum.repos.d/{{ item.repo }}.repo"
  125. section: "{{ item.section }}"
  126. option: enabled
  127. value: 1
  128. mode: 0644
  129. become: true
  130. when: is_ostree
  131. loop:
  132. - repo: "fedora-updates-modular"
  133. section: "updates-modular"
  134. - repo: "fedora-modular"
  135. section: "fedora-modular"
  136. - name: Enable CRI-O module
  137. command: "dnf -y module enable cri-o:{{ crio_version }}"
  138. args:
  139. warn: False
  140. register: crio_dnf_result
  141. changed_when: "'Enabling' in crio_dnf_result.stdout"
  142. become: true
  143. when:
  144. - ansible_distribution in ["Fedora"]
  145. - not is_ostree