Please help, I have the docker-compose file below, and I want to write an Ansible playbook that runs the docker-compose file on localhost and a remote target.
version: '2.0'
services:
weather-backend:
build: ./backend
volumes: #map backend dir and package inside container
- './backend/:/usr/src/'
- './backend/package.json:/usr/src/package.json'
#ports:
# - "9000:9000" #expose backend port - Host:container
ports:
- "9000:9000"
command: npm start
weather-frontend:
build: ./frontend
depends_on:
- weather-backend
volumes:
- './frontend/:/usr/src/'
- '/usr/src/node_modules'
ports:
- "8000:8000" #expose ports -Host:container
environment:
NODE_ENV: "development"
Since Ansible 2.1, you can have a look at the docker_compose, which can read directly a docker-compose.yml
playbook task:
- name: run the service defined in my_project's docker-compose.yml
docker_compose:
project_src: /path/to/my_project
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With