install.yml 2.1 KB

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