blob: 9a098a0e1fde2b21abfca67b6873294c79913791 [file] [log] [blame]
# Copyright 2017-present Open Networking Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
---
- hosts: {{ instance_name }}
gather_facts: False
connection: ssh
user: ubuntu
become: yes
tasks:
- name: Fix /etc/hosts
lineinfile:
dest=/etc/hosts
regexp="127.0.0.1 localhost"
line="127.0.0.1 localhost {{ instance_hostname }}"
- name: Add repo key
apt_key:
keyserver=hkp://pgp.mit.edu:80
id=58118E89F3A912897C070ADBF76221572C52609D
- name: Install Docker repo
apt_repository:
repo="deb https://apt.dockerproject.org/repo ubuntu-trusty main"
state=present
- name: Install Docker
apt:
name={{ '{{' }} item {{ '}}' }}
state=latest
update_cache=yes
with_items:
- docker-engine
- python-pip
- python-httplib2
- name: Install docker-py
pip:
name=docker-py
state=latest
- name: Start ONOS container
docker:
docker_api_version: "1.18"
name: {{ ONOS_container }}
# was: reloaded
state: running
image: onosproject/onos
ports:
- "6653:6653"
- "8101:8101"
- "8181:8181"
- "9876:9876"
- name: Get Docker IP
script: /opt/xos/synchronizers/onos/scripts/dockerip.sh {{ ONOS_container }}
register: dockerip
- name: Wait for ONOS to come up
wait_for:
host={{ '{{' }} dockerip.stdout {{ '}}' }}
port={{ '{{' }} item {{ '}}' }}
state=present
with_items:
- 8101
- 8181
- 9876