diff --git a/grafana.yml b/grafana.yml index f67e8ee76..88bdd3081 100644 --- a/grafana.yml +++ b/grafana.yml @@ -18,7 +18,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: @@ -38,6 +38,7 @@ ansible.posix.mount: path: /data src: /dev/vdb + fstype: xfs state: mounted become: true @@ -70,6 +71,8 @@ ## Grafana - role: galaxyproject.nginx become: true + vars: + hostname: "{{ grafana_domain }}" - grafana - role: pgs become: true @@ -101,13 +104,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: | @@ -120,12 +125,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