systemd_units.yml 4.3 KB

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