blob: 8d853a2aaee94386bef7bef0eb85182e62eb6174 [file] [log] [blame]
Scott Baker31acc652016-06-23 15:47:56 -07001---
2- hosts: {{ instance_name }}
3 gather_facts: False
4 connection: ssh
5 user: ubuntu
6 sudo: yes
7 vars:
8 sflow_port: {{ sflow_port }}
9 sflow_api_port: {{ sflow_api_port }}
10
11 tasks:
12
13 - name: Fix /etc/hosts
14 lineinfile:
15 dest=/etc/hosts
16 regexp="127.0.0.1 localhost"
17 line="127.0.0.1 localhost {{ instance_hostname }}"
18
19 - name: Add repo key
20 apt_key:
21 keyserver=hkp://pgp.mit.edu:80
22 id=58118E89F3A912897C070ADBF76221572C52609D
23
24 - name: Install Docker repo
25 apt_repository:
26 repo="deb https://apt.dockerproject.org/repo ubuntu-trusty main"
27 state=present
28
29 - name: Install Docker
30 apt:
31 name={{ '{{' }} item {{ '}}' }}
32 state=latest
33 update_cache=yes
34 with_items:
35 - docker-engine
36 - python-pip
37 - python-httplib2
38
39 - name: Install docker-py
40 pip:
41 name=docker-py
42 state=latest
43
44 - name: sflow pub-sub config
45 template: src=/opt/xos/synchronizers/monitoring_channel/templates/sflow_pub_sub/sflow_pub_sub_config.j2 dest=/usr/local/share/sflow_pub_sub.conf mode=0777
46
47 - name: Start SFLOW pub-sub container
48 docker:
49 docker_api_version: "1.18"
50 name: {{ sflow_container }}
51 # was: reloaded
52 state: running
53 image: srikanthvavila/sflowpubsub
54 expose:
55 - {{ sflow_api_port }}
56 - {{ sflow_port }}/udp
57 ports:
58 - "{{ sflow_port }}:{{ sflow_port }}/udp"
59 - "{{ sflow_api_port }}:{{ sflow_api_port }}"
60 volumes:
61 - /usr/local/share/sflow_pub_sub.conf:/usr/local/share/sflow_pub_sub/sflow_pub_sub.conf
62
63 - name: Get Docker IP
64 #TODO: copy dockerip.sh to monitoring service synchronizer
65 script: /opt/xos/synchronizers/onos/scripts/dockerip.sh {{ sflow_container }}
66 register: dockerip
67
68 - name: Wait for SFlow service to come up
69 wait_for:
70 host={{ '{{' }} dockerip.stdout {{ '}}' }}
71 port={{ '{{' }} item {{ '}}' }}
72 state=present
73 with_items:
74 - {{ sflow_api_port }}