Configures docker stacks
This role install and deploy
- dockge: A fancy, easy-to-use and reactive self-hosted docker compose.yaml stack-oriented manager
- A systemd like file to handle compose stacks under
/opt/stacks
as systemd with ease
- Docker should be installed in your machine, you can do it, using geerlingguy.docker as i do
- Docker should have compose plugin and not docker-compose
Available variables are listed below, along with defautl values (see defaults/main.yml)
docker_stacks_dir: "/opt/stacks"
# if you want to change the owner and group of the docker_stacks_dir
docker_stacks_owner: "{{ ansible_user }}"
# if you want to change the owner and group of the docker_stacks_dir
docker_stacks_group: "{{ ansible_user }}"
# if you want to install dockge stack set this to true
docker_stacks_dockge_install: false
docker_stacks_dir
is the directory where stacks will be deployed and configured to be used by [email protected]. dockge is deployed as a stack also here.
If you wanna change the default user used by ansible by another user present in the box, you can use both docker_stacks_owner
and docker_stacks_group
to make sure that directories are chown to this.
A stack is a folder under docker_stacks_dir
(Defaults to /opt/stacks
) that should contains a compose-like file inside.
Once this role is installed, you can start/stop/enable/disable stacks using systemd as following:
enable
: systemd enable docker-stack@<name of the folder inside /opt/stacks>disable
: systemd disable docker-stack@<name of the folder inside /opt/stacks>start
: systemd start docker-stack@<name of the folder inside /opt/stacks>stop
: systemd stop docker-stack@<name of the folder inside /opt/stacks>status
: systemd status docker-stack@<name of the folder inside /opt/stacks>
If you wanna installs dockge set docker_stacks_dockge_install
variable to true
. It will installs and starts the service so you can manage it as usual
user@host $ sudo systemctl <command> docker-stack@dockge
There's a shellx community plugin for docker-stacks integration at shellx-docker-stacks
- [email protected]: original idea from https://gist.github.com/mosquito/b23e1c1e5723a7fd9e6568e5cf91180f
- dockge-compose.yaml: original file getted from https://github.com/louislam/dockge/blob/master/compose.yaml