systemd_units.yml 4.2 KB

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