Skip to content

Add ability to perform download and installation of apache_exporter b… #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

apache_exporter_version: 0.5.0

# Must we perform download and propagation from localhost (true) or not (false)
apache_exporter_download_localhost: true

apache_exporter_system_group: apache-exp
apache_exporter_system_user: "{{ apache_exporter_system_group }}"

Expand Down
8 changes: 5 additions & 3 deletions tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@
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
delegate_to: "{{ 'localhost' if apache_exporter_download_localhost else inventory_hostname }}"
check_mode: false
become: false

Expand All @@ -32,8 +33,8 @@
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
check_mode: false
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
Expand All @@ -49,4 +50,5 @@
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