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 |
Zack Williams | 30c01f9 | 2017-02-19 23:38:52 -0700 | [diff] [blame] | 30 | - org.ops4j.pax.logging.cfg |
Scott Baker | 58e88a8 | 2016-11-18 13:39:09 -0800 | [diff] [blame] | 31 | |
| 32 | - name: Copy over ONOS playbook and other files |
| 33 | copy: |
| 34 | src: "onos-cord-docker-compose.yml" |
| 35 | dest: "{{ onos_cord_dest }}/docker-compose.yml" |
| 36 | |
| 37 | # TODO: Find the proper place for this on the dev machine rather than |
| 38 | # copying it within the head node machine. |
| 39 | |
| 40 | - name: Copy SSL Certs to ONOS so docker-compose can find it |
| 41 | copy: |
Zack Williams | c047c87 | 2017-01-11 08:38:15 -0700 | [diff] [blame] | 42 | src: "/usr/local/share/ca-certificates/{{ item }}" |
| 43 | dest: "{{ onos_cord_dest }}/{{ item }}" |
Scott Baker | 58e88a8 | 2016-11-18 13:39:09 -0800 | [diff] [blame] | 44 | owner: "{{ ansible_user_id }}" |
| 45 | remote_src: True |
Zack Williams | c047c87 | 2017-01-11 08:38:15 -0700 | [diff] [blame] | 46 | with_items: |
| 47 | - "cord_root_ca.crt" |
| 48 | - "cord_intermediate_ca.crt" |
Scott Baker | 58e88a8 | 2016-11-18 13:39:09 -0800 | [diff] [blame] | 49 | |
| 50 | - name: Build onos image |
| 51 | command: docker-compose build chdir={{ onos_cord_dest }} |
| 52 | tags: |
| 53 | - skip_ansible_lint |
| 54 | |
| 55 | - name: Start ONOS |
| 56 | command: chdir="{{ onos_cord_dest }}" docker-compose up -d |
| 57 | tags: |
| 58 | - skip_ansible_lint |