systemd_units.yml 3.8 KB

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