Zack Williams | b273a42 | 2016-05-18 13:33:00 -0700 | [diff] [blame] | 1 | --- |
| 2 | # docker-compose-pull/tasks/main.yml |
| 3 | |
Zack Williams | 2e5d51a | 2016-05-18 16:45:22 -0700 | [diff] [blame] | 4 | # Note: build/pull are mutually exclusive in this case |
Zack Williams | b273a42 | 2016-05-18 13:33:00 -0700 | [diff] [blame] | 5 | |
| 6 | - name: Build images from dockerhub with docker-compose |
| 7 | command: ansible "{{ item.name }}" -b -u ubuntu -m command \ |
| 8 | -a "docker-compose build chdir={{ item.path | expanduser }}" |
| 9 | with_items: "{{ docker_compose_list | selectattr('build') | list}}" |
| 10 | |
Zack Williams | 2e5d51a | 2016-05-18 16:45:22 -0700 | [diff] [blame] | 11 | - name: Pull images from dockerhub with docker-compose |
| 12 | command: ansible "{{ item.name }}" -b -u ubuntu -m command \ |
| 13 | -a "docker-compose pull chdir={{ item.path | expanduser }}" |
| 14 | with_items: "{{ docker_compose_list | rejectattr('build') | list}}" |
| 15 | |
Zack Williams | b273a42 | 2016-05-18 13:33:00 -0700 | [diff] [blame] | 16 | - name: Run "docker-compose up" where required |
| 17 | command: ansible "{{ item.name }}" -b -u ubuntu -m command \ |
| 18 | -a "docker-compose up -d chdir={{ item.path | expanduser }}" |
| 19 | with_items: "{{ docker_compose_list | selectattr('up') | list}}" |
| 20 | |