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

View File

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

View File

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