/
mesos_exporter.yml
56 lines (45 loc) · 1.28 KB
/
mesos_exporter.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
- hosts: masters
remote_user: centos
become: true
tasks:
- name: detect host ip
shell: /opt/mesosphere/bin/detect_ip
register: source_host_ip
- set_fact:
host_ip: "{{ source_host_ip.stdout }}"
- name: create directory
file:
path: /tmp/mesos_exporter/
state: directory
mode: 0755
- name: download archive and extract
unarchive:
src: https://github.com/mesos/mesos_exporter/releases/download/v1.1.1/mesos_exporter-1.1.1.linux-amd64.tar.gz
dest: /tmp/
remote_src: yes
- name: Copy binary to /usr/bin/
copy:
remote_src: True
src: /tmp/mesos_exporter-1.1.1.linux-amd64/mesos_exporter
dest: /usr/bin/
mode: 0755
- name: configure systemd config
blockinfile:
dest: "/etc/systemd/system/mesos-exporter.service"
state: present
create: yes
block: |
[Unit]
Description=DC/OS Mesos Exporter service
[Service]
Restart=always
RestartSec=5
ExecStart=/bin/sh -c '/usr/bin/mesos_exporter -enableMasterState -master http://{{ host_ip }}:5050'
[Install]
WantedBy=multi-user.target
- name: enable service
systemd:
name: mesos-exporter.service
state: restarted
enabled: yes
daemon_reload: yes