Scott Baker | 58e88a8 | 2016-11-18 13:39:09 -0800 | [diff] [blame] | 1 | --- |
| 2 | # Common ONOS setup |
| 3 | |
| 4 | # onos_cord_dest: {{ ansible_user_dir }}/onos-cord/ |
| 5 | |
| 6 | - name: Pull docker image for ONOS |
| 7 | become: yes |
| 8 | command: "docker pull {{ onos_docker_image }}" |
| 9 | tags: |
| 10 | - skip_ansible_lint # Should replace with http://docs.ansible.com/ansible/docker_module.html, when replacements are stable |
| 11 | |
| 12 | - name: Create dest directory |
| 13 | file: path="{{ onos_cord_dest }}" state=directory |
| 14 | |
| 15 | - name: Copy over SSH key |
| 16 | copy: |
| 17 | remote_src: True |
| 18 | src: "{{ node_private_key }}" |
| 19 | dest: "{{ onos_cord_dest }}/node_key" |
| 20 | owner: "{{ ansible_user_id }}" |
| 21 | mode: 0600 |
| 22 | |
| 23 | - name: Create templated ONOS files |
| 24 | template: |
| 25 | src: "{{ item }}.j2" |
| 26 | dest: "{{ onos_cord_dest }}/{{ item }}" |
| 27 | with_items: |
| 28 | - Dockerfile |
| 29 | - onos-service |
| 30 | |
| 31 | - name: Copy over ONOS playbook and other files |
| 32 | copy: |
| 33 | src: "onos-cord-docker-compose.yml" |
| 34 | dest: "{{ onos_cord_dest }}/docker-compose.yml" |
| 35 | |
| 36 | # TODO: Find the proper place for this on the dev machine rather than |
| 37 | # copying it within the head node machine. |
| 38 | |
| 39 | - name: Copy SSL Certs to ONOS so docker-compose can find it |
| 40 | copy: |
Zack Williams | c047c87 | 2017-01-11 08:38:15 -0700 | [diff] [blame] | 41 | src: "/usr/local/share/ca-certificates/{{ item }}" |
| 42 | dest: "{{ onos_cord_dest }}/{{ item }}" |
Scott Baker | 58e88a8 | 2016-11-18 13:39:09 -0800 | [diff] [blame] | 43 | owner: "{{ ansible_user_id }}" |
| 44 | remote_src: True |
Zack Williams | c047c87 | 2017-01-11 08:38:15 -0700 | [diff] [blame] | 45 | with_items: |
| 46 | - "cord_root_ca.crt" |
| 47 | - "cord_intermediate_ca.crt" |
Scott Baker | 58e88a8 | 2016-11-18 13:39:09 -0800 | [diff] [blame] | 48 | |
| 49 | - name: Build onos image |
| 50 | command: docker-compose build chdir={{ onos_cord_dest }} |
| 51 | tags: |
| 52 | - skip_ansible_lint |
| 53 | |
| 54 | - name: Start ONOS |
| 55 | command: chdir="{{ onos_cord_dest }}" docker-compose up -d |
| 56 | tags: |
| 57 | - skip_ansible_lint |
| 58 | |