Skip to content

Commit

Permalink
Merge pull request #1296 from mira-miracoli/ansible-compose-not-commu…
Browse files Browse the repository at this point in the history
…nity

fix grafana playbook
  • Loading branch information
mira-miracoli authored Aug 20, 2024
2 parents cf56795 + 2c213fa commit a2baee3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
23 changes: 14 additions & 9 deletions grafana.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -38,6 +38,7 @@
ansible.posix.mount:
path: /data
src: /dev/vdb
fstype: xfs
state: mounted
become: true

Expand Down Expand Up @@ -70,6 +71,8 @@
## Grafana
- role: galaxyproject.nginx
become: true
vars:
hostname: "{{ grafana_domain }}"
- grafana
- role: pgs
become: true
Expand Down Expand Up @@ -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: |
Expand All @@ -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
4 changes: 3 additions & 1 deletion group_vars/grafana/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

Expand Down

0 comments on commit a2baee3

Please sign in to comment.