Refactor grafana vars

This commit is contained in:
Salt 2020-08-02 19:40:39 -05:00
parent 75aeaca8ee
commit 7c53558f8f
3 changed files with 16 additions and 16 deletions

View File

@ -15,7 +15,7 @@
mysql_user:
name: grafana
host: localhost
password: "{{ grafana_mysql_password }}"
password: "{{ grafana.mysql_password }}"
priv: "grafana.*:ALL,GRANT"
login_user: root
login_password: "{{ mysql.root_password }}"
@ -32,22 +32,22 @@
- name: Template out vhost
template:
src: "apache2-vhost-ssl.conf"
dest: "/etc/apache2/sites-available/{{ grafana_url }}.conf"
dest: "/etc/apache2/sites-available/{{ grafana.url }}.conf"
notify: restart apache
- name: Create webroot
file:
state: directory
path: "{{ grafana_webroot }}"
path: "{{ grafana.webroot }}"
- name: Enable site
command:
cmd: "a2ensite {{ grafana_url }}.conf"
creates: "/etc/apache2/sites-enabled/{{ grafana_url }}.conf"
cmd: "a2ensite {{ grafana.url }}.conf"
creates: "/etc/apache2/sites-enabled/{{ grafana.url }}.conf"
notify: restart apache
- name: Generate certificate
include_role:
name: https
vars:
website_url: "{{ grafana_url }}"
website_url: "{{ grafana.url }}"
- name: Add and configure packages
block:
- name: Add APT signing key

View File

@ -1,4 +1,4 @@
# Configuration for {{ grafana_url }}
# Configuration for {{ grafana.url }}
# vim:ft=apache:
# Accept connections from non-SNI clients
@ -8,19 +8,19 @@ SSLProxyEngine on
# Website configuration
<VirtualHost *:80>
ServerName {{ grafana_url }}
Redirect permanent / https://{{ grafana_url }}
ServerName {{ grafana.url }}
Redirect permanent / https://{{ grafana.url }}
</VirtualHost>
<VirtualHost *:443>
SSLEngine on
SSLCertificateFile /etc/pki/cert/crt/{{ grafana_url }}.crt
SSLCertificateKeyFile /etc/pki/cert/private/{{ grafana_url }}.key
SSLCertificateChainFile /etc/pki/cert/crt/{{ grafana_url }}-fullchain.crt
SSLCertificateFile /etc/pki/cert/crt/{{ grafana.url }}.crt
SSLCertificateKeyFile /etc/pki/cert/private/{{ grafana.url }}.key
SSLCertificateChainFile /etc/pki/cert/crt/{{ grafana.url }}-fullchain.crt
SSLProtocol {{ ssl_protocol }}
SSLCipherSuite {{ ssl_cipher_suite }}
ServerName {{ grafana_url }}
DocumentRoot {{ grafana_webroot }}
<Directory "{{ grafana_webroot }}">
ServerName {{ grafana.url }}
DocumentRoot {{ grafana.webroot }}
<Directory "{{ grafana.webroot }}">
Require all granted
AllowOverride All
Options MultiViews FollowSymlinks

View File

@ -78,7 +78,7 @@ host = 127.0.0.1:3306
name = grafana
user = grafana
# If the password contains # or ; you have to wrap it with triple quotes. Ex """#password;"""
password = {{ grafana_mysql_password }}
password = {{ grafana.mysql_password }}
# Use either URL or the previous fields to configure the database
# Example: mysql://user:secret@host:port/database