Skip to content
This repository was archived by the owner on Jan 12, 2020. It is now read-only.

Commit 1ddefab

Browse files
committed
add random generator
1 parent dc1e537 commit 1ddefab

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

extras.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,50 @@
130130
tls paulfantom@gmail.com
131131
}
132132
{% endfor %}
133+
134+
- name: Setup random number exporter
135+
hosts: web
136+
tasks:
137+
- name: Locally build random_exporter
138+
shell: |
139+
go get github.com/prometheus/client_golang/examples/random
140+
mv $GOPATH/bin/random /tmp/random_exporter
141+
creates: /tmp/random_exporter
142+
delegate_to: localhost
143+
run_once: true
144+
- name: Copy random_exporter binary
145+
copy:
146+
src: random
147+
dest: /usr/local/bin/random_exporter
148+
owner: root
149+
group: root
150+
mode: 0755
151+
notify: random_exporter restart
152+
- name: Copy systemd service file
153+
copy:
154+
dest: /etc/systemd/system/random_exporter.service
155+
mode: 0644
156+
content: "{{ random_exporter_systemd_service }}"
157+
notify: random_exporter restart
158+
handlers:
159+
- name: random_exporter restart
160+
systemd:
161+
name: random_exporter
162+
state: started
163+
daemon_reload: true
164+
enabled: true
165+
vars:
166+
random_exporter_systemd_service: |
167+
# Ansible managed
168+
[Unit]
169+
Description=Random Metrics Exporter
170+
After=network.target
171+
[Service]
172+
Type=simple
173+
User=nobody
174+
Group=nogroup
175+
ExecStart=/usr/local/bin/random_exporter -listen-address=:8999
176+
SyslogIdentifier=random_exporter
177+
Restart=always
178+
[Install]
179+
WantedBy=multi-user.target

0 commit comments

Comments
 (0)