b146181174
This uses the Grafana container created with Iddfafe852166fe95b3e433420e2e2a4a6380fc64 to run the grafana.opendev.org service. We retain the old model of an Apache reverse-proxy; it's well tested and understood, it's much easier than trying to map all the SSL termination/renewal/etc. into the Grafana container and we don't have to convince ourselves the container is safe to be directly web-facing. Otherwise this is a fairly straight forward deployment of the container. As before, it uses the graph configuration kept in project-config which is loaded in with grafyaml, which is included in the container. Once nice advantage is that it makes it quite easy to develop graphs locally, using the container which can talk to the public graphite instance. The documentation has been updated with a reference on how to do this. Change-Id: I0cc76d29b6911aecfebc71e5fdfe7cf4fcd071a4
88 lines
1.8 KiB
YAML
88 lines
1.8 KiB
YAML
- name: Ensure docker-compose directory exists
|
|
file:
|
|
state: directory
|
|
path: /etc/grafana-docker
|
|
|
|
- name: Write settings file
|
|
template:
|
|
src: docker-compose.yaml.j2
|
|
dest: /etc/grafana-docker/docker-compose.yaml
|
|
|
|
- name: Ensure config directory exists
|
|
file:
|
|
state: directory
|
|
path: /etc/grafana
|
|
|
|
- name: Ensure secrets config directory exists
|
|
file:
|
|
state: directory
|
|
path: /etc/grafana/secrets
|
|
|
|
- name: Make admin_password
|
|
copy:
|
|
content: '{{ grafana_admin_password }}'
|
|
dest: /etc/grafana/secrets/admin_password
|
|
|
|
- name: Make admin_user
|
|
copy:
|
|
content: '{{ grafana_admin_user }}'
|
|
dest: /etc/grafana/secrets/admin_user
|
|
|
|
- name: Make secret_key
|
|
copy:
|
|
content: '{{ grafana_secret_key }}'
|
|
dest: /etc/grafana/secrets/secret_key
|
|
|
|
- name: Install apache2
|
|
apt:
|
|
name:
|
|
- apache2
|
|
- apache2-utils
|
|
state: present
|
|
|
|
- name: Apache modules
|
|
apache2_module:
|
|
state: present
|
|
name: "{{ item }}"
|
|
loop:
|
|
- rewrite
|
|
- proxy
|
|
- proxy_http
|
|
- ssl
|
|
- headers
|
|
- proxy_wstunnel
|
|
|
|
- name: Copy apache config
|
|
template:
|
|
src: grafana.vhost.j2
|
|
dest: /etc/apache2/sites-enabled/000-default.conf
|
|
owner: root
|
|
group: root
|
|
mode: 0644
|
|
notify: grafana Reload apache2
|
|
|
|
- name: Sync project-config
|
|
include_role:
|
|
name: sync-project-config
|
|
|
|
- name: Run docker-compose pull
|
|
shell:
|
|
cmd: docker-compose pull
|
|
chdir: /etc/grafana-docker/
|
|
|
|
- name: Run docker-compose up
|
|
shell:
|
|
cmd: docker-compose up -d
|
|
chdir: /etc/grafana-docker/
|
|
|
|
- name: Run docker prune to cleanup unneeded images
|
|
shell:
|
|
cmd: docker image prune -f
|
|
|
|
- name: Import dashboards to container
|
|
shell:
|
|
cmd: |
|
|
docker-compose exec -T grafana /usr/local/bin/update-grafana
|
|
chdir: /etc/grafana-docker/
|
|
|