[PROVISIONAL] docker_webservices is a role that automates the deployment of Dockerized Web Apps (or Web Services) and the generation of SSL Certificates with Caddy.
Ansible 2.4 (because of geerlingguy.docker role)
docker Python library (needed by docker_container and docker_image modules). Example installation.
docker_webservices accepts an array of objects as variable: docker_web_services. The variable has the following structure:
docker_web_services:
- name: service_name
build:
name: ""
repo: ""
context_path: ""
dockerfile: ""
caddy:
host: ""
port: ""
mail: ""
container_opts:
env: {}name:StringName of the service. Used as part of the container name and as fallback when building an image.build:OptionalObjectProvide this to instructdocker_webservicesto perform an image build (Fetching a repo containing the Dockerfile)name:OptionalStringThe name of the image to build. Falls back to the servicenamedeclared aboverepo:StringRepo from wich a clone / checkout is performed (Your Dockerfile is in here)context_path:StringPath (relative to rebo base) to use as context for docker builddockerfile:StringPath (relative to rebo base) pointing to the Dockerfile to use for docker build
caddy:ObjectConfiguration related tocaddy-genhost:StringSpace separated hostnames that Caddy should generate certs for and proxy requests for to this container (i.e. "my.host.com my1.host.com")port:StringThe port Caddy should proxy requests tomail:StringMust be a valid email in order to enable TLS
container_ops:ObjectThe plan is to accept arbitrary instructions for thedocker_containermodule here. Currently accepts onlyenv.env:ObjectKey - Value pairs that will be pass as-is todocker_container'senv.
- geerlingguy.pip
- geerlingguy.docker
- panagiks.caddy_gen
- hosts: servers
vars:
docker_web_services:
- name: my_service
build:
name: "image_name"
repo: https://github.com/handle/repo
context_path: path/
dockerfile: path/service.dockerfile
caddy:
host: "my.host.com my1.host.com"
port: "1234"
mail: "a_mail@provicer.sth"
container_opts:
env:
ENV_VAR_NAME: ENV_VAR_VAL
roles:
- { role: panagiks.docker_webservices }MIT