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.

117 lines
4.1 KiB

Fixes for CentOS 8 (#5213) * Fix python3-libselinux installation for RHEL/CentOS 8 In bootstrap-centos.yml we haven't gathered the facts, so #5127 couldn't work Minimum ansible version to run kubespray is 2.7.8, so ansible_distribution_major_version is defined an there is no need to default it Signed-off-by: Etienne Champetier <champetier.etienne@gmail.com> * Restart NetworkManager for RHEL/CentOS 8 network.service doesn't exist anymore # systemctl status network Unit network.service could not be found. Signed-off-by: Etienne Champetier <champetier.etienne@gmail.com> * Add module_hotfixes=True to docker / containerd yum repo config https://bugzilla.redhat.com/show_bug.cgi?id=1734081 https://bugzilla.redhat.com/show_bug.cgi?id=1756473 Without this setting you end up with the following error: # yum install docker-ce Failed to set locale, defaulting to C Last metadata expiration check: 0:03:21 ago on Thu Sep 26 22:00:05 2019. Error: Problem: package docker-ce-3:19.03.2-3.el7.x86_64 requires containerd.io >= 1.2.2-3, but none of the providers can be installed - cannot install the best candidate for the job - package containerd.io-1.2.2-3.3.el7.x86_64 is excluded - package containerd.io-1.2.2-3.el7.x86_64 is excluded - package containerd.io-1.2.4-3.1.el7.x86_64 is excluded - package containerd.io-1.2.5-3.1.el7.x86_64 is excluded - package containerd.io-1.2.6-3.3.el7.x86_64 is excluded (try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages) Signed-off-by: Etienne Champetier <champetier.etienne@gmail.com>
5 years ago
  1. ---
  2. - name: Gather host facts to get ansible_distribution_version ansible_distribution_major_version
  3. setup:
  4. gather_subset: '!all'
  5. filter: ansible_distribution_*version
  6. - name: Add proxy to yum.conf or dnf.conf if http_proxy is defined
  7. ini_file:
  8. path: "{{ ( (ansible_distribution_major_version | int) < 8) | ternary('/etc/yum.conf','/etc/dnf/dnf.conf') }}"
  9. section: main
  10. option: proxy
  11. value: "{{ http_proxy | default(omit) }}"
  12. state: "{{ http_proxy | default(False) | ternary('present', 'absent') }}"
  13. no_extra_spaces: true
  14. mode: 0644
  15. become: true
  16. when: not skip_http_proxy_on_os_packages
  17. # For Oracle Linux install public repo
  18. - name: Download Oracle Linux public yum repo
  19. get_url:
  20. url: https://yum.oracle.com/public-yum-ol7.repo
  21. dest: /etc/yum.repos.d/public-yum-ol7.repo
  22. when:
  23. - use_oracle_public_repo|default(true)
  24. - '''ID="ol"'' in os_release.stdout_lines'
  25. - (ansible_distribution_version | float) < 7.6
  26. environment: "{{ proxy_env }}"
  27. - name: Enable Oracle Linux repo
  28. ini_file:
  29. dest: /etc/yum.repos.d/public-yum-ol7.repo
  30. section: "{{ item }}"
  31. option: enabled
  32. value: "1"
  33. mode: 0644
  34. with_items:
  35. - ol7_latest
  36. - ol7_addons
  37. - ol7_developer_EPEL
  38. when:
  39. - use_oracle_public_repo|default(true)
  40. - '''ID="ol"'' in os_release.stdout_lines'
  41. - (ansible_distribution_version | float) < 7.6
  42. - name: Install EPEL for Oracle Linux repo package
  43. package:
  44. name: "oracle-epel-release-el{{ ansible_distribution_major_version }}"
  45. state: present
  46. when:
  47. - use_oracle_public_repo|default(true)
  48. - '''ID="ol"'' in os_release.stdout_lines'
  49. - (ansible_distribution_version | float) >= 7.6
  50. - name: Enable Oracle Linux repo
  51. ini_file:
  52. dest: "/etc/yum.repos.d/oracle-linux-ol{{ ansible_distribution_major_version }}.repo"
  53. section: "ol{{ ansible_distribution_major_version }}_addons"
  54. option: "{{ item.option }}"
  55. value: "{{ item.value }}"
  56. mode: 0644
  57. with_items:
  58. - { option: "name", value: "ol{{ ansible_distribution_major_version }}_addons" }
  59. - { option: "enabled", value: "1" }
  60. - { option: "baseurl", value: "http://yum.oracle.com/repo/OracleLinux/OL{{ ansible_distribution_major_version }}/addons/$basearch/" }
  61. when:
  62. - use_oracle_public_repo|default(true)
  63. - '''ID="ol"'' in os_release.stdout_lines'
  64. - (ansible_distribution_version | float) >= 7.6
  65. - name: Enable Centos extra repo for Oracle Linux
  66. ini_file:
  67. dest: "/etc/yum.repos.d/centos-extras.repo"
  68. section: "extras"
  69. option: "{{ item.option }}"
  70. value: "{{ item.value }}"
  71. mode: 0644
  72. with_items:
  73. - { option: "name", value: "CentOS-{{ ansible_distribution_major_version }} - Extras" }
  74. - { option: "enabled", value: "1" }
  75. - { option: "gpgcheck", value: "0" }
  76. - { option: "baseurl", value: "http://mirror.centos.org/centos/{{ ansible_distribution_major_version }}/extras/$basearch/{% if ansible_distribution_major_version|int > 7 %}os/{% endif %}" }
  77. when:
  78. - use_oracle_public_repo|default(true)
  79. - '''ID="ol"'' in os_release.stdout_lines'
  80. - (ansible_distribution_version | float) >= 7.6
  81. - (ansible_distribution_version | float) < 9
  82. # CentOS ships with python installed
  83. - name: Check presence of fastestmirror.conf
  84. stat:
  85. path: /etc/yum/pluginconf.d/fastestmirror.conf
  86. get_attributes: no
  87. get_checksum: no
  88. get_mime: no
  89. register: fastestmirror
  90. # the fastestmirror plugin can actually slow down Ansible deployments
  91. - name: Disable fastestmirror plugin if requested
  92. lineinfile:
  93. dest: /etc/yum/pluginconf.d/fastestmirror.conf
  94. regexp: "^enabled=.*"
  95. line: "enabled=0"
  96. state: present
  97. become: true
  98. when:
  99. - fastestmirror.stat.exists
  100. - not centos_fastestmirror_enabled
  101. # libselinux-python is required on SELinux enabled hosts
  102. # See https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#managed-node-requirements
  103. - name: Install libselinux python package
  104. package:
  105. name: "{{ ( (ansible_distribution_major_version | int) < 8) | ternary('libselinux-python','python3-libselinux') }}"
  106. state: present
  107. become: true