---
# Common ONOS setup

- name: Pull docker image for ONOS
  become: yes
  command: "docker pull {{ onos_docker_image }}"
  tags:
    - skip_ansible_lint # Should replace with http://docs.ansible.com/ansible/docker_module.html, when replacements are stable

- name: Create dest directory
  file:
    path: "{{ onos_fabric_dest }}"
    state: directory

- name: Create templated ONOS files
  template:
    src: "{{ item }}.j2"
    dest: "{{ onos_fabric_dest }}/{{ item }}"
  with_items:
    - docker-compose.yml

# Note: we do not rebuild onos container for the fabric

- name: Start ONOS
  command: chdir="{{ onos_fabric_dest }}" docker-compose up -d
  tags:
    - skip_ansible_lint

