config.yml 3.1 KB

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