install.yml 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. ---
  2. - name: Install openshift support packages
  3. package:
  4. name: "{{ openshift_node_support_packages | join(',') }}"
  5. state: latest
  6. update_cache: true
  7. async: 3600
  8. poll: 30
  9. register: result
  10. until: result is succeeded
  11. - name: Get cluster version
  12. command: >
  13. oc get clusterversion
  14. --kubeconfig={{ openshift_node_kubeconfig_path }}
  15. --output=jsonpath='{.items[0].status.desired.version}'
  16. delegate_to: localhost
  17. register: oc_get
  18. until:
  19. - oc_get.stdout is defined
  20. - oc_get.stdout != ''
  21. - name: Set fact l_cluster_version
  22. set_fact:
  23. l_cluster_version: "{{ oc_get.stdout | regex_search('^\\d+\\.\\d+') }}"
  24. - name: Override cluster version when running CI
  25. set_fact:
  26. l_cluster_version: "*"
  27. when: ci_version_override | default(false) | bool == true
  28. - name: Get kubernetes server version
  29. command: >
  30. oc version
  31. --kubeconfig={{ openshift_node_kubeconfig_path }}
  32. --output=json
  33. delegate_to: localhost
  34. register: oc_get
  35. until:
  36. - oc_get.stdout is defined
  37. - oc_get.stdout != ''
  38. - name: Set fact l_kubernetes_version
  39. set_fact:
  40. l_kubernetes_version: "{{ (oc_get.stdout | from_json).serverVersion.major ~ '.' ~ (oc_get.stdout | from_json).serverVersion.minor | regex_search('^\\d+') }}"
  41. - name: Override kubernetes version when running CI
  42. set_fact:
  43. l_kubernetes_version: "*"
  44. when: ci_version_override | default(false) | bool == true
  45. - block:
  46. - name: Install openshift packages
  47. package:
  48. name: "{{ openshift_node_packages | join(',') }}"
  49. state: latest
  50. async: 3600
  51. poll: 30
  52. register: result
  53. until: result is succeeded
  54. rescue:
  55. - name: Package install failure message
  56. fail:
  57. msg: >
  58. Unable to install {{ openshift_node_packages | join(', ') }}.
  59. Please ensure repos are configured properly to provide these packages
  60. and indicated versions.
  61. - name: Enable the CRI-O service
  62. systemd:
  63. name: "crio"
  64. enabled: yes
  65. # persistent storage in journal is needed for MachineConfig to work
  66. - name: Enable persistent storage on journal
  67. ini_file:
  68. dest: "/etc/systemd/journald.conf"
  69. section: Journal
  70. option: Storage
  71. value: "persistent"
  72. no_extra_spaces: yes