-
-
Save disklosr/9bf06608e83450570bbfd6844b6488c5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: "{{target}}" | |
become: yes | |
gather_facts: no | |
connection: ssh | |
vars: | |
- service_name: "glances.web" | |
tasks: | |
- name: Copy config file | |
copy: | |
src: glances.conf | |
dest: /opt/{{service_name}} | |
- name: Run container | |
docker_container: | |
name: "{{service_name}}" | |
recreate: true | |
restart_policy: unless-stopped | |
purge_networks: true | |
networks_cli_compatible: yes | |
pull: true | |
tty: yes | |
pid_mode: host #allows the running container to see host's processes | |
image: 'nicolargo/glances:latest' | |
env: | |
GLANCES_OPT: "-w" | |
command: "/bin/bash -c 'pip install --upgrade glances && python -m glances -C /glances/conf/glances.conf $GLANCES_OPT'" | |
volumes: | |
- /var/run/docker.sock:/var/run/docker.sock | |
- /opt/{{service_name}}/glances.conf:/glances/conf/glances.conf:ro | |
labels: | |
"traefik.enable": "true" | |
"traefik.http.routers.glances.rule": "Host(`status.{{inventory_hostname}}.{{ domain_name }}`)" | |
"traefik.http.routers.glances.middlewares": "authelia" | |
networks: | |
- name: "traefik-network" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment