| --- |
| # Common ONOS setup |
| |
| # onos_cord_dest: {{ ansible_user_dir }}/onos-cord/ |
| |
| - 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_cord_dest }}" state=directory |
| |
| - name: Copy over SSH key |
| copy: |
| remote_src: True |
| src: "{{ node_private_key }}" |
| dest: "{{ onos_cord_dest }}/node_key" |
| owner: "{{ ansible_user_id }}" |
| mode: 0600 |
| |
| - name: Create templated ONOS files |
| template: |
| src: "{{ item }}.j2" |
| dest: "{{ onos_cord_dest }}/{{ item }}" |
| with_items: |
| - Dockerfile |
| - onos-service |
| |
| - name: Copy over ONOS playbook and other files |
| copy: |
| src: "onos-cord-docker-compose.yml" |
| dest: "{{ onos_cord_dest }}/docker-compose.yml" |
| |
| # TODO: Find the proper place for this on the dev machine rather than |
| # copying it within the head node machine. |
| |
| - name: Copy SSL Certs to ONOS so docker-compose can find it |
| copy: |
| src: "/usr/local/share/ca-certificates/{{ item }}" |
| dest: "{{ onos_cord_dest }}/{{ item }}" |
| owner: "{{ ansible_user_id }}" |
| remote_src: True |
| with_items: |
| - "cord_root_ca.crt" |
| - "cord_intermediate_ca.crt" |
| |
| - name: Build onos image |
| command: docker-compose build chdir={{ onos_cord_dest }} |
| tags: |
| - skip_ansible_lint |
| |
| - name: Start ONOS |
| command: chdir="{{ onos_cord_dest }}" docker-compose up -d |
| tags: |
| - skip_ansible_lint |
| |