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.

95 lines
3.2 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. become: true
  15. when: not skip_http_proxy_on_os_packages
  16. # For Oracle Linux install public repo
  17. - name: Download Oracle Linux public yum repo
  18. get_url:
  19. url: https://yum.oracle.com/public-yum-ol7.repo
  20. dest: /etc/yum.repos.d/public-yum-ol7.repo
  21. when:
  22. - use_oracle_public_repo|default(true)
  23. - '''ID="ol"'' in os_release.stdout_lines'
  24. - (ansible_distribution_version | float) < 7.6
  25. environment: "{{ proxy_env }}"
  26. - name: Enable Oracle Linux repo
  27. ini_file:
  28. dest: /etc/yum.repos.d/public-yum-ol7.repo
  29. section: "{{ item }}"
  30. option: enabled
  31. value: "1"
  32. with_items:
  33. - ol7_latest
  34. - ol7_addons
  35. - ol7_developer_EPEL
  36. when:
  37. - use_oracle_public_repo|default(true)
  38. - '''ID="ol"'' in os_release.stdout_lines'
  39. - (ansible_distribution_version | float) < 7.6
  40. - name: Enable Oracle Linux repo
  41. ini_file:
  42. dest: "/etc/yum.repos.d/oracle-linux-ol{{ ansible_distribution_major_version }}.repo"
  43. section: "ol{{ ansible_distribution_major_version }}_addons"
  44. option: "{{ item.option }}"
  45. value: "{{ item.value }}"
  46. with_items:
  47. - { option: "enabled", value: "1" }
  48. - { option: "baseurl", value: "http://yum.oracle.com/repo/OracleLinux/OL{{ ansible_distribution_major_version }}/addons/x86_64/" }
  49. when:
  50. - use_oracle_public_repo|default(true)
  51. - '''ID="ol"'' in os_release.stdout_lines'
  52. - (ansible_distribution_version | float) >= 7.6
  53. - name: Install EPEL for Oracle Linux repo package
  54. package:
  55. name: "oracle-epel-release-el{{ ansible_distribution_major_version }}"
  56. state: present
  57. when:
  58. - use_oracle_public_repo|default(true)
  59. - '''ID="ol"'' in os_release.stdout_lines'
  60. - (ansible_distribution_version | float) >= 7.6
  61. # CentOS ships with python installed
  62. - name: Check presence of fastestmirror.conf
  63. stat:
  64. path: /etc/yum/pluginconf.d/fastestmirror.conf
  65. get_attributes: no
  66. get_checksum: no
  67. get_mime: no
  68. register: fastestmirror
  69. # the fastestmirror plugin can actually slow down Ansible deployments
  70. - name: Disable fastestmirror plugin if requested
  71. lineinfile:
  72. dest: /etc/yum/pluginconf.d/fastestmirror.conf
  73. regexp: "^enabled=.*"
  74. line: "enabled=0"
  75. state: present
  76. become: true
  77. when:
  78. - fastestmirror.stat.exists
  79. - not centos_fastestmirror_enabled
  80. # libselinux-python is required on SELinux enabled hosts
  81. # See https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#managed-node-requirements
  82. - name: Install libselinux python package
  83. package:
  84. name: "{{ ( (ansible_distribution_major_version | int) < 8) | ternary('libselinux-python','python3-libselinux') }}"
  85. state: present
  86. become: true