blob: fceefaeab436312c078f482eb2cb7f8d50868e8b [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
vars:
sflow_port: {{ sflow_port }}
sflow_api_port: {{ sflow_api_port }}
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: sflow pub-sub config
template: src=/opt/xos/synchronizers/monitoring/templates/sflow_pub_sub/sflow_pub_sub_config.j2 dest=/usr/local/share/sflow_pub_sub.conf mode=0777
- name: Start SFLOW pub-sub container
docker:
docker_api_version: "1.18"
name: {{ sflow_container }}
# was: reloaded
state: running
image: srikanthvavila/sflowpubsub
expose:
- {{ sflow_api_port }}
- {{ sflow_port }}/udp
ports:
- "{{ sflow_port }}:{{ sflow_port }}/udp"
- "{{ sflow_api_port }}:{{ sflow_api_port }}"
volumes:
- /usr/local/share/sflow_pub_sub.conf:/usr/local/share/sflow_pub_sub/sflow_pub_sub.conf
- name: Get Docker IP
#TODO: copy dockerip.sh to monitoring service synchronizer
script: /opt/xos/synchronizers/onos/scripts/dockerip.sh {{ sflow_container }}
register: dockerip
- name: Wait for SFlow service to come up
wait_for:
host={{ '{{' }} dockerip.stdout {{ '}}' }}
port={{ '{{' }} item {{ '}}' }}
state=present
with_items:
- {{ sflow_api_port }}