Scott Baker | 7a32759 | 2016-06-20 17:34:06 -0700 | [diff] [blame^] | 1 | --- |
| 2 | - hosts: {{ instance_name }} |
| 3 | gather_facts: False |
| 4 | connection: ssh |
| 5 | user: ubuntu |
| 6 | sudo: yes |
| 7 | |
| 8 | tasks: |
| 9 | |
| 10 | - name: Fix /etc/hosts |
| 11 | lineinfile: |
| 12 | dest=/etc/hosts |
| 13 | regexp="127.0.0.1 localhost" |
| 14 | line="127.0.0.1 localhost {{ instance_hostname }}" |
| 15 | |
| 16 | - name: Add repo key |
| 17 | apt_key: |
| 18 | keyserver=hkp://pgp.mit.edu:80 |
| 19 | id=58118E89F3A912897C070ADBF76221572C52609D |
| 20 | |
| 21 | - name: Install Docker repo |
| 22 | apt_repository: |
| 23 | repo="deb https://apt.dockerproject.org/repo ubuntu-trusty main" |
| 24 | state=present |
| 25 | |
| 26 | - name: Install Docker |
| 27 | apt: |
| 28 | name={{ '{{' }} item {{ '}}' }} |
| 29 | state=latest |
| 30 | update_cache=yes |
| 31 | with_items: |
| 32 | - docker-engine |
| 33 | - python-pip |
| 34 | - python-httplib2 |
| 35 | |
| 36 | - name: Install docker-py |
| 37 | pip: |
| 38 | name=docker-py |
| 39 | state=latest |
| 40 | |
| 41 | - name: Start ONOS container |
| 42 | docker: |
| 43 | docker_api_version: "1.18" |
| 44 | name: {{ ONOS_container }} |
| 45 | # was: reloaded |
| 46 | state: running |
| 47 | image: onosproject/onos |
| 48 | ports: |
| 49 | - "6653:6653" |
| 50 | - "8101:8101" |
| 51 | - "8181:8181" |
| 52 | - "9876:9876" |
| 53 | |
| 54 | - name: Get Docker IP |
| 55 | script: /opt/xos/synchronizers/onos/scripts/dockerip.sh {{ ONOS_container }} |
| 56 | register: dockerip |
| 57 | |
| 58 | - name: Wait for ONOS to come up |
| 59 | wait_for: |
| 60 | host={{ '{{' }} dockerip.stdout {{ '}}' }} |
| 61 | port={{ '{{' }} item {{ '}}' }} |
| 62 | state=present |
| 63 | with_items: |
| 64 | - 8101 |
| 65 | - 8181 |
| 66 | - 9876 |