| --- |
| - hosts: '{{ instance_name }}' |
| gather_facts: False |
| connection: ssh |
| user: ubuntu |
| sudo: yes |
| |
| tasks: |
| |
| - name: copy viv image |
| copy: src=viv.docker dest=/tmp/viv.docker mode=0644 |
| |
| - name: check if we have a viv container already |
| register: docker_images |
| shell: docker images |
| |
| - name: load viv container |
| shell: docker load -i /tmp/viv.docker |
| when: docker_images.stdout.find('viv') == -1 |
| |
| - name: check if viv container is already running |
| register: docker_containers |
| shell: docker ps |
| |
| - name: launch the viv container |
| 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 |
| when: docker_containers.stdout.find('viv') == -1 |
| |
| - name: remove viv |
| shell: rm -f /tmp/viv.docker |