From eeca37693c64c949fba2dfdfe374d702d7a09ead Mon Sep 17 00:00:00 2001 From: PurpleNinja225 Date: Sat, 6 Feb 2021 21:27:34 -0900 Subject: [PATCH] mv glances to role --- group_vars/all.yml | 8 -------- nas.yml | 9 +++++---- roles/glances/defaults/main.yml | 9 +++++++++ tasks/glances.yml => roles/glances/tasks/main.yml | 14 +++++++------- 4 files changed, 21 insertions(+), 19 deletions(-) create mode 100644 roles/glances/defaults/main.yml rename tasks/glances.yml => roles/glances/tasks/main.yml (84%) diff --git a/group_vars/all.yml b/group_vars/all.yml index ea422fcb..105a6d51 100644 --- a/group_vars/all.yml +++ b/group_vars/all.yml @@ -37,7 +37,6 @@ mymediaforalexa_enabled: false miniflux_enabled: false # System Management -glances_enabled: false stats_enabled: false guacamole_enabled: false cloudcmd_enabled: false @@ -358,13 +357,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" - ### ### nginx ### diff --git a/nas.yml b/nas.yml index b3d30af3..4618c2af 100644 --- a/nas.yml +++ b/nas.yml @@ -88,6 +88,11 @@ - gitea when: (gitea_enabled | default(False)) + - role: glances + tags: + - glances + when: (glances_enabled | default(False)) + - role: heimdall tags: - heimdall @@ -215,10 +220,6 @@ when: (thelounge_enabled | default(False)) tags: thelounge - - import_tasks: tasks/glances.yml - when: (glances_enabled | default(False)) - tags: glances - - import_tasks: tasks/znc.yml when: (znc_enabled | default(False)) tags: znc 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 20bc1387..df1e4df9 100644 --- a/tasks/glances.yml +++ b/roles/glances/tasks/main.yml @@ -1,24 +1,24 @@ -- 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: #- "/glances.conf:/glances/conf/glances.conf" - "/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 }}" - traefik.http.services.glances.loadbalancer.server.port: "61208" \ No newline at end of file + traefik.http.services.glances.loadbalancer.server.port: "61208"