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: |
| 41 | src: "/usr/local/share/ca-certificates/keystone_juju_ca_cert.crt" |
| 42 | dest: "{{ onos_cord_dest }}/xos-certs.crt" |
| 43 | owner: "{{ ansible_user_id }}" |
| 44 | remote_src: True |
| 45 | |
| 46 | - name: Build onos image |
| 47 | command: docker-compose build chdir={{ onos_cord_dest }} |
| 48 | tags: |
| 49 | - skip_ansible_lint |
| 50 | |
| 51 | - name: Start ONOS |
| 52 | command: chdir="{{ onos_cord_dest }}" docker-compose up -d |
| 53 | tags: |
| 54 | - skip_ansible_lint |
| 55 | |