1
0
forked from infra/ansible
infra/roles/grafana/tasks/main.yml

37 lines
1.2 KiB
YAML
Raw Permalink Normal View History

2020-01-08 12:08:06 +01:00
---
- name: Enable grafana apt-key
2021-11-03 18:33:51 +01:00
apt_key: url="https://packages.grafana.com/gpg.key"
2020-01-08 12:08:06 +01:00
- name: Enable grafana repository
2021-11-03 18:33:51 +01:00
apt_repository: repo="deb https://packages.grafana.com/oss/deb stable main"
2020-01-08 12:08:06 +01:00
- name: Install grafana
apt: name=grafana
- name: Ensure certificates are available
command: openssl req -x509 -nodes -newkey rsa:2048 -keyout /etc/nginx/ssl/{{ grafana_domain }}.key -out /etc/nginx/ssl/{{ grafana_domain }}.crt -days 730 -subj "/CN={{ grafana_domain }}" creates=/etc/nginx/ssl/{{ grafana_domain }}.crt
notify: Restart nginx
- name: Request nsupdate key for certificate
include_role: name=acme-dnskey-generate
vars:
acme_dnskey_san_domains:
- "{{ grafana_domain }}"
2020-07-31 21:38:33 +02:00
when: "'kitchen' in group_names"
2020-01-08 12:08:06 +01:00
- name: Configure certificate manager for grafana
template: src=certs.j2 dest=/etc/acertmgr/{{ grafana_domain }}.conf
notify: Run acertmgr
- name: Configure vhost
template: src=vhost.j2 dest=/etc/nginx/sites-available/grafana
notify: Restart nginx
- name: Enable vhost
file: src=/etc/nginx/sites-available/grafana dest=/etc/nginx/sites-enabled/grafana state=link
notify: Restart nginx
- name: Start grafana
2020-07-31 21:38:33 +02:00
service: name=grafana-server state=started enabled=yes