blob: 9a098a0e1fde2b21abfca67b6873294c79913791 [file] [log] [blame]
Matteo Scandolo7781b5b2017-08-08 13:05:26 -07001
2# Copyright 2017-present Open Networking Foundation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16
Scott Baker7a327592016-06-20 17:34:06 -070017---
18- hosts: {{ instance_name }}
19 gather_facts: False
20 connection: ssh
21 user: ubuntu
Sapan Bhatia38ef8b82017-02-07 11:32:56 -080022 become: yes
Scott Baker7a327592016-06-20 17:34:06 -070023
24 tasks:
25
26 - name: Fix /etc/hosts
27 lineinfile:
28 dest=/etc/hosts
29 regexp="127.0.0.1 localhost"
30 line="127.0.0.1 localhost {{ instance_hostname }}"
31
32 - name: Add repo key
33 apt_key:
34 keyserver=hkp://pgp.mit.edu:80
35 id=58118E89F3A912897C070ADBF76221572C52609D
36
37 - name: Install Docker repo
38 apt_repository:
39 repo="deb https://apt.dockerproject.org/repo ubuntu-trusty main"
40 state=present
41
42 - name: Install Docker
43 apt:
44 name={{ '{{' }} item {{ '}}' }}
45 state=latest
46 update_cache=yes
47 with_items:
48 - docker-engine
49 - python-pip
50 - python-httplib2
51
52 - name: Install docker-py
53 pip:
54 name=docker-py
55 state=latest
56
57 - name: Start ONOS container
58 docker:
59 docker_api_version: "1.18"
60 name: {{ ONOS_container }}
61 # was: reloaded
62 state: running
63 image: onosproject/onos
64 ports:
65 - "6653:6653"
66 - "8101:8101"
67 - "8181:8181"
68 - "9876:9876"
69
70 - name: Get Docker IP
71 script: /opt/xos/synchronizers/onos/scripts/dockerip.sh {{ ONOS_container }}
72 register: dockerip
73
74 - name: Wait for ONOS to come up
75 wait_for:
76 host={{ '{{' }} dockerip.stdout {{ '}}' }}
77 port={{ '{{' }} item {{ '}}' }}
78 state=present
79 with_items:
80 - 8101
81 - 8181
82 - 9876