Skip to content

Ansible Container is a tool to build Docker images and orchestrate containers using only Ansible playbooks.

License

Notifications You must be signed in to change notification settings

llunved/ansible-container

 
 

Repository files navigation

Ansible Container

Ansible Container is a tool to build Docker images and orchestrate containers using only Ansible playbooks. It does this by building a container from which to execute Ansible and connects to your other containers via the Docker engine instead of SSH.

Why? Why not just use standard Docker tools?

  1. Dockerfile does wrong many of the things Ansible does right. We're well past the point where we should be managing build processes with manually maintained series of shell scripts. That's why we wrote Ansible in the first place.
  2. Ansible Container permits orchestration even during the build process, whereas docker build does not. For example, in a Django project, your VCS may contain a bunch of sources for static assets that need to be compiled and then collected. With Ansible Container, you can compile the static assets in your Django container and then collect them into your static file serving container.
  3. Many people use Docker for development environments only but then use Ansible playbooks to push out to staging or production. This allows you to use the same playbooks and roles in your Docker environment as in your production environments.
  4. Ansible Container does all of this without installing SSH, leaving Ansible droppings on your built images, or having excess layers to the union filesystem.

To Ansible-Container-ize your project

Run ansible-container init in the root directory of your project. This will create a directory ansible with files to get you started. Read the comments and edit to suit your needs.

To use Ansible Container

  1. ansible-container build - This will make your Ansible Container builder and use Ansible to build the images for your other containers. By the end of this run, you will have flattened, tagged images in your local Docker engine.

  2. ansible-container run - This will orchestrate running your images as described in your container.yml file, using the Ansible-Container-built images instead of the base images.

  3. ansible-container push - This will push your Ansible-Container-built images to a registry of your choice.

Feel free to see the test or test-v1 projects as an examples.

About

Ansible Container is a tool to build Docker images and orchestrate containers using only Ansible playbooks.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%