Skip to content
This repository has been archived by the owner on Mar 14, 2023. It is now read-only.

Commit

Permalink
Add DATA_SOURCE_NAME auth support.
Browse files Browse the repository at this point in the history
* Add ENV-based `DATA_SOURCE_NAME` authentication config.
* Update default version to current release.

Signed-off-by: Ben Kochie <[email protected]>
  • Loading branch information
SuperQ committed Jun 30, 2018
1 parent 1b1f736 commit b2f0453
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 3 additions & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
---
mysqld_exporter_version: 0.16.0
mysqld_exporter_version: 0.11.0
mysqld_exporter_web_listen_address: "0.0.0.0:9104"

mysqld_exporter_dsn: "exporter:password@(localhost:3306)/"

mysqld_exporter_my_cnf: ""

mysqld_exporter_collect: []
Expand Down
6 changes: 3 additions & 3 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
- include: preflight.yml

- name: Create the Node Exporter group
- name: Create the MySQL Exporter group
group:
name: "{{ __mysqld_exporter_group }}"
state: present
system: true

- name: Create the Node Exporter user
- name: Create the MySQL Exporter user
user:
name: "{{ __mysqld_exporter_user }}"
groups: "{{ __mysqld_exporter_group }}"
Expand Down Expand Up @@ -43,7 +43,7 @@
copy:
src: "/tmp/mysqld_exporter-{{ mysqld_exporter_version }}.linux-{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}/mysqld_exporter"
dest: "/usr/local/bin/mysqld_exporter"
mode: 0750
mode: 0755
owner: root
group: root
notify:
Expand Down
3 changes: 3 additions & 0 deletions templates/mysqld_exporter.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ After=network.target
Type=simple
User={{ __mysqld_exporter_user }}
Group={{ __mysqld_exporter_group }}
{% if mysqld_exporter_dsn != "" %}
Environment="DATA_SOURCE_NAME={{ mysqld_exporter_dsn }}"
{% endif %}
ExecStart=/usr/local/bin/mysqld_exporter \
--web.listen-address {{ mysqld_exporter_web_listen_address }} \
{% for c in mysqld_exporter_collect -%}
Expand Down

0 comments on commit b2f0453

Please sign in to comment.