xkjyeah / docker-compose-ansible

Ansible role to deploy applications via `docker-compose`.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

docker-compose-ansible

Ansible role to deploy applications via docker-compose.

Requirements

The target host should have docker, docker-compose and the python library docker-py installed.

Role Variables

  • code_source: 'local' or git. Set to local to get source code from the host machine, or git from a git repository.
  • git_repo: URL for a git repository.
  • get_local_commit: If code_source is set to git and this is set to true, will get a commit from the local directory instead of using a branch.
  • git_repo_version: If code_source is set to git, specify a commit or branch name to deploy
  • docker_compose_files: An array of docker-compose files to use to deploy
  • local_path: if code_source is local or if get_local_commit is true, the path to the local source code.
  • project_directory: The path on the target host to deploy source code to.
  • remove_volumes: Set to yes to remove existing volumes while deploying. Defaults to no.
  • pull_images: Set to True to pull images from a registry before creating the containers. Defaults to True.
  • build_images: Set to True to build images for containers. Defaults to True.
  • docker_become: Set to True to become with docker commands.

Example Playbook

---
- name: "Deploy Application"
  hosts: all
  roles:
    - role: docker_compose_deploy
      code_source: 'local'
      project_directory: "/home/{{ ansible_user_id }}/app"
      local_path: "{{ playbook_dir }}/app"

License

LGPL

TODO

Write tests

About

Ansible role to deploy applications via `docker-compose`.

License:GNU Lesser General Public License v3.0