blob: eb1f64e8f1b36f021d85f7f4716280a09981bfcc [file] [log] [blame]
Scott Baker58e88a82016-11-18 13:39:09 -08001---
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 Williamsc047c872017-01-11 08:38:15 -070041 src: "/usr/local/share/ca-certificates/{{ item }}"
42 dest: "{{ onos_cord_dest }}/{{ item }}"
Scott Baker58e88a82016-11-18 13:39:09 -080043 owner: "{{ ansible_user_id }}"
44 remote_src: True
Zack Williamsc047c872017-01-11 08:38:15 -070045 with_items:
46 - "cord_root_ca.crt"
47 - "cord_intermediate_ca.crt"
Scott Baker58e88a82016-11-18 13:39:09 -080048
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