From 154543aa8f3849af825bab59a23820f2c040936d Mon Sep 17 00:00:00 2001 From: Mira Kuntz Date: Wed, 14 Aug 2024 09:46:12 +0200 Subject: [PATCH 1/2] fix grafana playbook --- grafana.yml | 23 ++++++++++++++--------- group_vars/grafana/vars.yml | 4 +++- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/grafana.yml b/grafana.yml index df919259a..781757d97 100644 --- a/grafana.yml +++ b/grafana.yml @@ -23,7 +23,7 @@ - name: Install Dependencies become: true ansible.builtin.package: - name: ['python3-virtualenv'] + name: ['python3-virtualenv', 'python3-docker'] - name: Ensure git is installed. (hxr.monitor-ssl) become: true ansible.builtin.package: @@ -43,6 +43,7 @@ ansible.posix.mount: path: /data src: /dev/vdb + fstype: xfs state: mounted become: true @@ -75,6 +76,8 @@ ## Grafana - role: galaxyproject.nginx become: true + vars: + hostname: "{{ grafana_domain }}" - grafana - role: pgs become: true @@ -106,13 +109,15 @@ state: directory owner: "{{ ansible_ssh_user }}" group: "{{ ansible_ssh_user }}" + mode: "0755" become: true - name: Get docker compose ansible.builtin.get_url: url: https://raw.githubusercontent.com/grafana/oncall/49d20f1a7e40669e901db95443603138e1a1cde4/docker-compose.yml - dest: "{{ grafana_on_call_path }}/docker_compose.yml" + dest: "{{ grafana_on_call_path }}/docker-compose.yml" owner: "{{ ansible_ssh_user }}" group: "{{ ansible_ssh_user }}" + mode: "0600" - name: Create env copy: content: | @@ -125,12 +130,12 @@ mode: "0600" no_log: true - name: Spin up OnCall - docker_compose: + community.general.docker_compose: project_src: "{{ grafana_on_call_path }}" - register: output - - name: Run `docker-compose up` again - docker_compose: + - name: Remove OnCall + when: not grafana_on_call + block: + - name: Stop all services + community.general.docker_compose: project_src: "{{ grafana_on_call_path }}" - register: output - - assert: - that: "not output.changed " + state: absent diff --git a/group_vars/grafana/vars.yml b/group_vars/grafana/vars.yml index e224fc383..412ebcef3 100644 --- a/group_vars/grafana/vars.yml +++ b/group_vars/grafana/vars.yml @@ -8,7 +8,7 @@ certbot_virtualenv_command: virtualenv-3.6 certbot_virtualenv_package_name: python3-virtualenv certbot_post_renewal: | systemctl restart nginx || true - +#hostname: "{{ grafana_domain }}" # NGINX nginx_enable_default_server: false nginx_servers: @@ -34,6 +34,8 @@ nginx_ssl_role: usegalaxy-eu.certbot nginx_conf_ssl_certificate: /etc/ssl/certs/fullchain.pem nginx_conf_ssl_certificate_key: /etc/ssl/user/privkey-nginx.pem +#setting this to false will remove the on call compose services and it's compose directory +grafana_on_call: false # Grafana grafana_version: 11.0.0 From 2c213fa9d60d75157bc8810bf373207308959716 Mon Sep 17 00:00:00 2001 From: Mira Kuntz Date: Wed, 14 Aug 2024 10:25:06 +0200 Subject: [PATCH 2/2] lint --- grafana.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grafana.yml b/grafana.yml index 781757d97..afc4e3179 100644 --- a/grafana.yml +++ b/grafana.yml @@ -77,7 +77,7 @@ - role: galaxyproject.nginx become: true vars: - hostname: "{{ grafana_domain }}" + hostname: "{{ grafana_domain }}" - grafana - role: pgs become: true