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.

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