systemd_units.yml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. ---
  2. # input variables
  3. # - openshift.node.node_image
  4. # - openshift_image_tag
  5. # - openshift.common.is_containerized
  6. # - openshift.node.ovs_image
  7. # - openshift.common.use_openshift_sdn
  8. # - openshift.common.service_type
  9. # - openshift.node.debug_level
  10. # - openshift.common.config_base
  11. # - openshift.common.http_proxy
  12. # - openshift.common.portal_net
  13. # - openshift.common
  14. # - openshift.common.http_proxy
  15. # notify:
  16. # - restart openvswitch
  17. # - restart node
  18. # This file is included both in the openshift_master role and in the upgrade
  19. # playbooks.
  20. - name: Install Node dependencies docker service file
  21. template:
  22. dest: "/etc/systemd/system/{{ openshift.common.service_type }}-node-dep.service"
  23. src: openshift.docker.node.dep.service
  24. register: install_node_dep_result
  25. when: openshift.common.is_containerized | bool
  26. - name: Install Node docker service file
  27. template:
  28. dest: "/etc/systemd/system/{{ openshift.common.service_type }}-node.service"
  29. src: openshift.docker.node.service
  30. register: install_node_result
  31. when: openshift.common.is_containerized | bool
  32. - name: Create the openvswitch service env file
  33. template:
  34. src: openvswitch.sysconfig.j2
  35. dest: /etc/sysconfig/openvswitch
  36. when: openshift.common.is_containerized | bool
  37. register: install_ovs_sysconfig
  38. notify:
  39. - restart openvswitch
  40. # May be a temporary workaround.
  41. # https://bugzilla.redhat.com/show_bug.cgi?id=1331590
  42. - name: Create OpenvSwitch service.d directory
  43. file: path=/etc/systemd/system/openvswitch.service.d/ state=directory
  44. when: openshift.common.use_openshift_sdn | default(true) | bool
  45. - name: Install OpenvSwitch service OOM fix
  46. template:
  47. dest: "/etc/systemd/system/openvswitch.service.d/01-avoid-oom.conf"
  48. src: openvswitch-avoid-oom.conf
  49. when: openshift.common.use_openshift_sdn | default(true) | bool
  50. register: install_oom_fix_result
  51. notify:
  52. - restart openvswitch
  53. - name: Install OpenvSwitch docker service file
  54. template:
  55. dest: "/etc/systemd/system/openvswitch.service"
  56. src: openvswitch.docker.service
  57. when: openshift.common.is_containerized | bool and openshift.common.use_openshift_sdn | default(true) | bool
  58. notify:
  59. - restart openvswitch
  60. - name: Configure Node settings
  61. lineinfile:
  62. dest: /etc/sysconfig/{{ openshift.common.service_type }}-node
  63. regexp: "{{ item.regex }}"
  64. line: "{{ item.line }}"
  65. create: true
  66. with_items:
  67. - regex: '^OPTIONS='
  68. line: "OPTIONS=--loglevel={{ openshift.node.debug_level | default(2) }}"
  69. - regex: '^CONFIG_FILE='
  70. line: "CONFIG_FILE={{ openshift.common.config_base }}/node/node-config.yaml"
  71. - regex: '^IMAGE_VERSION='
  72. line: "IMAGE_VERSION={{ openshift_image_tag }}"
  73. notify:
  74. - restart node
  75. - name: Configure Proxy Settings
  76. lineinfile:
  77. dest: /etc/sysconfig/{{ openshift.common.service_type }}-node
  78. regexp: "{{ item.regex }}"
  79. line: "{{ item.line }}"
  80. create: true
  81. with_items:
  82. - regex: '^HTTP_PROXY='
  83. line: "HTTP_PROXY={{ openshift.common.http_proxy | default('') }}"
  84. - regex: '^HTTPS_PROXY='
  85. line: "HTTPS_PROXY={{ openshift.common.https_proxy | default('') }}"
  86. - regex: '^NO_PROXY='
  87. line: "NO_PROXY={{ openshift.common.no_proxy | default([]) }},{{ openshift.common.portal_net }},{{ hostvars[groups.oo_first_master.0].openshift.master.sdn_cluster_network_cidr }}"
  88. when: ('http_proxy' in openshift.common and openshift.common.http_proxy != '')
  89. notify:
  90. - restart node
  91. - name: Reload systemd units
  92. command: systemctl daemon-reload
  93. when: (openshift.common.is_containerized | bool and (install_node_result | changed or install_ovs_sysconfig | changed or install_node_dep_result | changed)) or install_oom_fix_result | changed
  94. notify:
  95. - restart node