diff --git a/group_vars/all.yml b/group_vars/all.yml index ff9db995..0bf86631 100644 --- a/group_vars/all.yml +++ b/group_vars/all.yml @@ -21,7 +21,6 @@ jellyfin_enabled: false youtubedlmaterial_enabled: false # System Management -glances_enabled: false stats_enabled: false guacamole_enabled: false virtual_desktop_enabled: false @@ -297,14 +296,6 @@ gitlab_port_http: "4080" gitlab_port_https: "4443" gitlab_port_ssh: "422" -### -### Glances -### -glances_available_externally: "false" -glances_port_one: "61208" -glances_port_two: "61209" - - ### ### Guacamole ### diff --git a/nas.yml b/nas.yml index 6f504871..c42ef89b 100644 --- a/nas.yml +++ b/nas.yml @@ -103,6 +103,11 @@ - get_iplayer when: (get_iplayer_enabled | default(False)) + - role: glances + tags: + - glances + when: (glances_enabled | default(False)) + - role: gotify tags: - gotify @@ -263,10 +268,6 @@ when: (thelounge_enabled | default(False)) tags: thelounge - - import_tasks: tasks/glances.yml - when: (glances_enabled | default(False)) - tags: glances - - import_tasks: tasks/gitlab.yml when: (gitlab_enabled | default(False)) tags: gitlab diff --git a/roles/glances/defaults/main.yml b/roles/glances/defaults/main.yml new file mode 100644 index 00000000..2b5fd678 --- /dev/null +++ b/roles/glances/defaults/main.yml @@ -0,0 +1,9 @@ +--- +# enable or disable the application +glances_enabled: false +glances_available_externally: "false" + +# network +glances_hostname: "glances" +glances_port_one: "61208" +glances_port_two: "61209" diff --git a/tasks/glances.yml b/roles/glances/tasks/main.yml similarity index 84% rename from tasks/glances.yml rename to roles/glances/tasks/main.yml index 4f06b1bb..2c657fac 100644 --- a/tasks/glances.yml +++ b/roles/glances/tasks/main.yml @@ -1,23 +1,22 @@ --- -- name: Glances Docker Container +- name: Create Glances Docker Container docker_container: name: glances image: nicolargo/glances pull: true - ports: - - "{{ glances_port_one }}:61208" - - "{{ glances_port_two }}:61209" volumes: - "/var/run/docker.sock:/var/run/docker.sock:ro" - "/etc/timezone:/etc/timezone:ro" pid_mode: host + ports: + - "{{ glances_port_one }}:61208" + - "{{ glances_port_two }}:61209" env: GLANCES_OPT: "-w" restart_policy: unless-stopped - memory: 1g labels: traefik.enable: "{{ glances_available_externally }}" - traefik.http.routers.glances.rule: "Host(`glances.{{ ansible_nas_domain }}`)" + traefik.http.routers.glances.rule: "Host(`{{ glances_hostname }}.{{ ansible_nas_domain }}`)" traefik.http.routers.glances.tls.certresolver: "letsencrypt" traefik.http.routers.glances.tls.domains[0].main: "{{ ansible_nas_domain }}" traefik.http.routers.glances.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"