-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinstall.yml
More file actions
54 lines (48 loc) · 1.8 KB
/
install.yml
File metadata and controls
54 lines (48 loc) · 1.8 KB
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
---
- name: Create apache_exporter system group
group:
name: "{{ apache_exporter_system_group }}"
state: present
system: true
- name: Create the apache_exporter user
user:
name: "{{ apache_exporter_system_user }}"
groups: "{{ apache_exporter_system_group }}"
append: true
shell: /usr/sbin/nologin
system: true
createhome: false
- name: Get apache_exporter binary to local folder
get_url:
url: "{{ apache_exporter_download_url }}"
dest: "/tmp/apache_exporter-{{ apache_exporter_version }}.linux-{{ go_arch }}.tar.gz"
become: "{{ false if not apache_exporter_download_localhost is defined else omit }}"
register: __download_binary
until: __download_binary is succeeded
retries: 5
delay: 2
delegate_to: "{{ 'localhost' if apache_exporter_download_localhost else inventory_hostname }}"
check_mode: false
become: false
- name: Unpack apache_exporter binary
unarchive:
src: "/tmp/apache_exporter-{{ apache_exporter_version }}.linux-{{ go_arch }}.tar.gz"
dest: "/tmp"
creates: "/tmp/apache_exporter-{{ apache_exporter_version }}.linux-{{ go_arch }}/apache_exporter"
delegate_to: "{{ 'localhost' if apache_exporter_download_localhost else inventory_hostname }}"
become: "{{ false if not apache_exporter_download_localhost else omit }}"
become: false
- name: Create local bin dir
file:
path: /usr/local/bin
state: directory
mode: 0755
- name: Propagate apache_exporter binary
copy:
src: /tmp/apache_exporter-{{ apache_exporter_version }}.linux-{{ go_arch }}/apache_exporter
dest: /usr/local/bin/apache_exporter
mode: 0750
owner: "{{ apache_exporter_system_user }}"
group: "{{ apache_exporter_system_group }}"
remote_src: "{{ false if apache_exporter_download_localhost else true }}"
notify: restart apache_exporter