Giter VIP home page Giter VIP logo

ansible-deploy-docker-compose's Introduction

zal_ari.deploy-docker-compose

Deploy a docker-compose stack (TM) remotely.

Requirements

The host needs to have docker and docker-compose installed and the ansible_user must be able to run docker.

Role Variables

  • docker_compose_path: Path to docker-compose binary defaults to /usr/local/bin/docker-compose
  • remote_deploy_base_path: Base path, where the docker-compose stack is deployed, defaults to /srv/docker (which will most likely need sudo perms)
  • remote_deploy_name: Folder name that gets appended to the remote_deploy_base_path; defaults to docker-stack
  • remote_pull_images: Should docker-compose pull be run before bringing up the stack? Defaults to false.
  • deploy_path: Path where to local docker-compose.yml is stored; will get copied to server and must end with /!
  • (optional) remote_docker_login_registry: Private docker registry; initially not set and thus will default to the DockerHub.
  • (optional) remote_docker_login_user: Login for (private) docker registry; initially not set.
  • (optional) remote_docker_login_pass: Password for (private) docker registry; initially not set. `
  • (optional) force_recreation: Force container recreation, by calling docker-compose down before bringing the stack up -d. It defaults to false. This is useful if you have changes that a normal up -d would not pick up (i.e. changes in bind-mounted volumes).
  • (optional) force_recreation_args: Additional arguments that are used for the remote docker-compose down call before bringing up the stack. Defaults to || true (sic!) to prevent failure of docker-compose down because it exits with non-zero codes, while for example trying to delete an external network.
  • remote_remove_only: Remove remote docker-compose stack by invoking docker-compose down; defaults to false. Setting it to true, will skip deploying the stack (but will still copy it).
  • remote_remove_args: Additional arguments that get passed to docker-compose down if remote_remove_only is set to true. Defaults to --rmi all --remove-orphans

Note: it is advised to set remote_docker_login_pass via the environment when invoking ansible-playbook instead of setting it in the actual playbook (and thus keep secrets out of a repo). An easy way to do so would be ansible-playbook -i inventory -e "remote_docker_login_pass=$MY_DOCKER_LOGIN" playbook-yml

Dependencies

Nope.

Example Playbook

- hosts: servers
  roles:
    - role: zal_ari.deploy_docker_compose
      deploy_path: test/fixture/
      remote_deploy_base_path: /tmp/docker
      remote_deploy_name: hello-world
      remote_pull_images: True

TODO

  • allow for login into multiple private docker registries
  • add docker-based test env
  • use Travis for building and automagic releases to Ansible Galaxy.

PRs are welcome.

License

MIT

Author Information

Christian Ulbrich [email protected], Zalari GmbH

ansible-deploy-docker-compose's People

Contributors

christianulbrich avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.