Install your docker-compose service as systemd unit
None
all variables for the role must be in list named docker_services
:
docker_services:
- name: test
enabled: no
need_restart: yes
root_dir: /srv/docker/test-service
compose_template: examples/test.yml.j2
unit_template: examples/test.service.j2
my_var: var1
- name (required)
name of your service.
- enabled (optional)
Indicates autostart of service. Default is yes
.
- need_restart (optional)
Indicates need of restart action when templates changes. Default is no
.
- root_dir (required)
directory where docker-compose file will be lying.
- compose_template (required)
path to docker-compose.yml file.
- unit_template (required)
path to systemd unit for service.
Of course you can define new vars for templates and get access it while looping over the list.
None
- hosts: localhost
roles:
- { role: spigell.docker-compose-systemd }
There is a sparrowfile for sparrowdo in /tests directory. The one can use it to execute the role on vagrant, docker, etc...
BSD