config.yml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. ---
  2. - name: Install the systemd units
  3. include: systemd_units.yml
  4. - name: Start and enable openvswitch service
  5. systemd:
  6. name: openvswitch.service
  7. enabled: yes
  8. state: started
  9. daemon_reload: yes
  10. when:
  11. - openshift.common.is_containerized | bool
  12. - openshift_node_use_openshift_sdn | default(true) | bool
  13. register: ovs_start_result
  14. until: not ovs_start_result | failed
  15. retries: 3
  16. delay: 30
  17. - set_fact:
  18. ovs_service_status_changed: "{{ ovs_start_result | changed }}"
  19. - file:
  20. dest: "{{ (openshift_node_kubelet_args|default({'config':None})).config}}"
  21. state: directory
  22. when: openshift_node_kubelet_args is defined and 'config' in openshift_node_kubelet_args
  23. # TODO: add the validate parameter when there is a validation command to run
  24. - name: Create the Node config
  25. template:
  26. dest: "{{ openshift.common.config_base }}/node/node-config.yaml"
  27. src: node.yaml.v1.j2
  28. backup: true
  29. owner: root
  30. group: root
  31. mode: 0600
  32. notify:
  33. - restart node
  34. - name: Configure Node Environment Variables
  35. lineinfile:
  36. dest: /etc/sysconfig/{{ openshift.common.service_type }}-node
  37. regexp: "^{{ item.key }}="
  38. line: "{{ item.key }}={{ item.value }}"
  39. create: true
  40. with_dict: "{{ openshift.node.env_vars | default({}) }}"
  41. notify:
  42. - restart node
  43. # Necessary because when you're on a node that's also a master the master will be
  44. # restarted after the node restarts docker and it will take up to 60 seconds for
  45. # systemd to start the master again
  46. - when: openshift.common.is_containerized | bool
  47. block:
  48. - name: Wait for master API to become available before proceeding
  49. # Using curl here since the uri module requires python-httplib2 and
  50. # wait_for port doesn't provide health information.
  51. command: >
  52. curl --silent --tlsv1.2 --cacert {{ openshift.common.config_base }}/node/ca.crt
  53. {{ openshift_node_master_api_url }}/healthz/ready
  54. args:
  55. # Disables the following warning:
  56. # Consider using get_url or uri module rather than running curl
  57. warn: no
  58. register: api_available_output
  59. until: api_available_output.stdout == 'ok'
  60. retries: 120
  61. delay: 1
  62. changed_when: false
  63. - name: Start and enable node dep
  64. systemd:
  65. daemon_reload: yes
  66. name: "{{ openshift.common.service_type }}-node-dep"
  67. enabled: yes
  68. state: started
  69. - name: Start and enable node
  70. systemd:
  71. name: "{{ openshift.common.service_type }}-node"
  72. enabled: yes
  73. state: started
  74. daemon_reload: yes
  75. register: node_start_result
  76. until: not node_start_result | failed
  77. retries: 1
  78. delay: 30
  79. ignore_errors: true
  80. - name: Dump logs from node service if it failed
  81. command: journalctl --no-pager -n 100 -u {{ openshift.common.service_type }}-node
  82. when: node_start_result | failed
  83. - name: Abort if node failed to start
  84. fail:
  85. msg: Node failed to start please inspect the logs and try again
  86. when: node_start_result | failed
  87. - name: Setup tuned
  88. include: tuned.yml
  89. static: yes
  90. - set_fact:
  91. node_service_status_changed: "{{ node_start_result | changed }}"