Skip to main content

The obscene docker-compose deploy with ansible cli

Project description

Deploying a docker-compose.yml

Provide ssh configuration and target dir as first argument, then the path to a docker-compose.yml file:

ansible-compose user@host:22/absolute/target/path ./docker-compose-example.yml

Or, deploy from a url, just like kubectl apply would let you:

ansible-compose user@host:22/absolute/target/path https://raw.git.../docker-compose.yml

Automatic creation of volume dirs

It will try to automatically create the volume bind dirs for you. To set the uid and/or guid, set them as env vars, either in the compose.yml:

environment:
  uid: 1001
  gid: 100

Or on the command line

Transforms for docker-compose.yml on the CLI

You can also apply transforms to the docker-compose.yml on the command line with env vars: servicename_environment_something=foo will overwrite the something env var of the servicename service with the foo value, whereas setting drop_servicename_environment_something=1 will drop the value at all.

This kind of filter will also work on service options ie. servicename_image=foo or drop_servicename_image=1 would respectively override and drop the image key of the servicename service. It also works on services themselves, and any other key at the first level of the compose document.

Note that any other argument will be passed to ansible-playbook.

Running commands on the compose of a target

Provide ssh configuration and target dir as first argument, then the docker-compose command:

ansible-compose user@host:22/absolute/target/path stop
ansible-compose user@host:22/absolute/target/path start
ansible-compose user@host:22/absolute/target/path logs
ansible-compose user@host:22/absolute/target/path help

Installation

pip install --user ansible-container
export PATH="$HOME/.local/bin:$PATH"
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ansible-compose-0.1.4.post4.tar.gz (4.7 kB view details)

Uploaded Source

File details

Details for the file ansible-compose-0.1.4.post4.tar.gz.

File metadata

  • Download URL: ansible-compose-0.1.4.post4.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.6

File hashes

Hashes for ansible-compose-0.1.4.post4.tar.gz
Algorithm Hash digest
SHA256 3e47369a056bd1fc107031fc185063115b646d8b9472e382a19d34765abb34d4
MD5 501b0600365a917fd2c9d483d18013b9
BLAKE2b-256 3fe4b75958e27e8623f268bf68bb1280181787d5c13417cec5b66abc049a290f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page