Created
October 28, 2018 10:56
-
-
Save rastaman/27e56aaad11d7faea50ad671477e5261 to your computer and use it in GitHub Desktop.
Deploy a docker-compose setup with ansible
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| # $ PIP_REQUIRE_VIRTUALENV=false pip3 install docker-compose | |
| # $ ansible-playbook forge.yml -e ansible_python_interpreter=python3 | |
| - name: Deploy a docker-compose setup | |
| hosts: localhost | |
| vars_files: | |
| - docker-compose.yml | |
| tasks: | |
| - name: Create volumes | |
| docker_volume: | |
| name: "{{ item.key }}" | |
| state: present | |
| with_dict: "{{ services }}" | |
| - name: Pull images | |
| docker_image: | |
| name: "{{ item.value.image }}" | |
| state: present | |
| with_dict: "{{ services }}" | |
| - name: Deploy containers | |
| docker_service: | |
| files: | |
| - docker-compose.yml | |
| project_src: "{{ playbook_dir }}" | |
| state: present |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment