---
- name: Install Node service file
  template:
    dest: "/etc/systemd/system/{{ openshift.common.service_type }}-node.service"
    src: "{{ openshift.common.is_containerized | bool | ternary('openshift.docker.node.service', 'node.service.j2') }}"
  when: not openshift.common.is_node_system_container | bool
  notify:
  - reload systemd units
  - restart node

- when: openshift.common.is_containerized | bool
  block:
  - name: include node deps docker service file
    include: config/install-node-deps-docker-service-file.yml

  - name: include ovs service environment file
    include: config/install-ovs-service-env-file.yml

  - name: Install Node system container
    include: node_system_container.yml
    when:
    - openshift.common.is_node_system_container | bool

  - name: Install OpenvSwitch system containers
    include: openvswitch_system_container.yml
    when:
    - openshift_node_use_openshift_sdn | bool
    - openshift.common.is_openvswitch_system_container | bool

- block:
  - name: Pre-pull openvswitch image
    command: >
      docker pull {{ openshift.node.ovs_image }}:{{ openshift_image_tag }}
    register: pull_result
    changed_when: "'Downloaded newer image' in pull_result.stdout"

  - include: config/install-ovs-docker-service-file.yml
  when:
  - openshift.common.is_containerized | bool
  - openshift_node_use_openshift_sdn | bool
  - not openshift.common.is_openvswitch_system_container | bool

- include: config/configure-node-settings.yml
- include: config/configure-proxy-settings.yml
