[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
:String
Name of the service. Used as part of the container name and as fallback when building an image.build
:Optional
Object
Provide this to instructdocker_webservices
to perform an image build (Fetching a repo containing the Dockerfile)name
:Optional
String
The name of the image to build. Falls back to the servicename
declared aboverepo
:String
Repo from wich a clone / checkout is performed (Your Dockerfile is in here)context_path
:String
Path (relative to rebo base) to use as context for docker builddockerfile
:String
Path (relative to rebo base) pointing to the Dockerfile to use for docker build
caddy
:Object
Configuration related tocaddy-gen
host
:String
Space separated hostnames that Caddy should generate certs for and proxy requests for to this container (i.e. "my.host.com my1.host.com")port
:String
The port Caddy should proxy requests tomail
:String
Must be a valid email in order to enable TLS
container_ops
:Object
The plan is to accept arbitrary instructions for thedocker_container
module here. Currently accepts onlyenv
.env
:Object
Key - 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: "[email protected]"
container_opts:
env:
ENV_VAR_NAME: ENV_VAR_VAL
roles:
- { role: panagiks.docker_webservices }
MIT