Skip to content

Instantly share code, notes, and snippets.

@disklosr
Created August 1, 2020 12:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save disklosr/9bf06608e83450570bbfd6844b6488c5 to your computer and use it in GitHub Desktop.
Save disklosr/9bf06608e83450570bbfd6844b6488c5 to your computer and use it in GitHub Desktop.
---
- 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