Gabe Black | 816018e | 2017-01-18 19:52:28 +0000 | [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: copy viv image |
| 11 | copy: src=viv.docker dest=/tmp/viv.docker mode=0644 |
| 12 | |
| 13 | - name: check if we have a viv container already |
| 14 | register: docker_images |
| 15 | shell: docker images |
| 16 | |
| 17 | - name: load viv container |
| 18 | shell: docker load -i /tmp/viv.docker |
| 19 | when: docker_images.stdout.find('viv') == -1 |
| 20 | |
| 21 | - name: check if viv container is already running |
| 22 | register: docker_containers |
| 23 | shell: docker ps |
| 24 | |
| 25 | - name: launch the viv container |
| 26 | shell: docker run -d -p 8080:8080 -p 8082:8082 -v /dev:/dev -v /mnt:/mnt -v /lib/modules:/lib/modules --net=host --privileged -e IMODE="mmap" -e BLOCKING=1 --name=viv viv /opt/startContainer |
| 27 | when: docker_containers.stdout.find('viv') == -1 |
| 28 | |
| 29 | - name: remove viv |
| 30 | shell: rm -f /tmp/viv.docker |