101 lines
2.2 KiB
YAML
101 lines
2.2 KiB
YAML
|
---
|
||
|
- name: Install GPG
|
||
|
apt:
|
||
|
name: gnupg
|
||
|
state: present
|
||
|
register: apt_result
|
||
|
retries: 3
|
||
|
until: apt_result is succeeded
|
||
|
|
||
|
- name: Import Grafana GPG signing key
|
||
|
apt_key:
|
||
|
url: https://packages.grafana.com/gpg.key
|
||
|
state: present
|
||
|
validate_certs: false
|
||
|
register: apt_key_result
|
||
|
retries: 3
|
||
|
until: apt_key_result is succeeded
|
||
|
|
||
|
- name: Add Grafana repository
|
||
|
apt_repository:
|
||
|
repo: deb http://mirror.adm.ynerant.fr/grafana/oss/deb stable main
|
||
|
state: present
|
||
|
update_cache: true
|
||
|
|
||
|
- name: Install Grafana
|
||
|
apt:
|
||
|
name: grafana
|
||
|
state: present
|
||
|
register: apt_result
|
||
|
retries: 3
|
||
|
until: apt_result is succeeded
|
||
|
|
||
|
- name: Configure Grafana
|
||
|
ini_file:
|
||
|
path: /etc/grafana/grafana.ini
|
||
|
section: "{{ item.section }}"
|
||
|
option: "{{ item.option }}"
|
||
|
value: "{{ item.value }}"
|
||
|
mode: 0640
|
||
|
loop:
|
||
|
- section: server
|
||
|
option: root_url
|
||
|
value: "{{ grafana.root_url }}"
|
||
|
- section: analytics
|
||
|
option: reporting_enabled
|
||
|
value: "false"
|
||
|
- section: analytics
|
||
|
option: check_for_updates
|
||
|
value: "false"
|
||
|
- section: security
|
||
|
option: disable_initial_admin_creation
|
||
|
value: "true"
|
||
|
- section: security
|
||
|
option: cookie_secure
|
||
|
value: "true"
|
||
|
- section: snapshots
|
||
|
option: external_enabled
|
||
|
value: "false"
|
||
|
- section: users
|
||
|
option: allow_sign_up
|
||
|
value: "false"
|
||
|
- section: users
|
||
|
option: allow_org_create
|
||
|
value: "false"
|
||
|
- section: auth.anonymous
|
||
|
option: enabled
|
||
|
value: "true"
|
||
|
- section: auth.anonymous
|
||
|
option: hide_version
|
||
|
value: "true"
|
||
|
- section: auth.basic # Only LDAP auth
|
||
|
option: enabled
|
||
|
value: "false"
|
||
|
- section: auth.ldap
|
||
|
option: enabled
|
||
|
value: "true"
|
||
|
- section: alerting
|
||
|
option: enabled
|
||
|
value: "false"
|
||
|
notify: Restart grafana
|
||
|
|
||
|
- name: Configure Grafana LDAP
|
||
|
template:
|
||
|
src: ldap.toml.j2
|
||
|
dest: /etc/grafana/ldap.toml
|
||
|
mode: 0640
|
||
|
notify: Restart grafana
|
||
|
|
||
|
- name: Enable and start Grafana
|
||
|
systemd:
|
||
|
name: grafana-server
|
||
|
enabled: true
|
||
|
state: started
|
||
|
daemon_reload: true
|
||
|
|
||
|
- name: Indicate role in motd
|
||
|
template:
|
||
|
src: update-motd.d/05-service.j2
|
||
|
dest: /etc/update-motd.d/05-grafana
|
||
|
mode: 0755
|