add new exporters binaries source
This commit is contained in:
parent
681b7b2d72
commit
902af9c58d
@ -26,6 +26,11 @@ prometheus_repo_postgres: prometheus-community
|
|||||||
prometheus_repo_redis: tchivert
|
prometheus_repo_redis: tchivert
|
||||||
prometheus_repo_varnish: tchivert
|
prometheus_repo_varnish: tchivert
|
||||||
|
|
||||||
|
prometheus_exporters_repo: "https://git.rznet.fr/tchivert/prometheus_exporters"
|
||||||
|
prometheus_exporters_release: "latest"
|
||||||
|
prometheus_exporters_sources: "repo"
|
||||||
|
# prometheus_exporters_sources: "origin"
|
||||||
|
|
||||||
## server
|
## server
|
||||||
prometheus_nodes_ip:
|
prometheus_nodes_ip:
|
||||||
localhost: "127.0.0.1"
|
localhost: "127.0.0.1"
|
||||||
|
@ -28,26 +28,48 @@
|
|||||||
when: exporter_upgrade == "yes"
|
when: exporter_upgrade == "yes"
|
||||||
tags: [ 'prometheus_{{ exporter }}' ]
|
tags: [ 'prometheus_{{ exporter }}' ]
|
||||||
|
|
||||||
|
# If prometheus_exporters_sources == "repo"
|
||||||
|
- name: '{{ exporter }} exporter | download from repo'
|
||||||
|
get_url:
|
||||||
|
url: "{{prometheus_exporters_repo}}/releases/download/{{prometheus_exporters_release}}/{{exporter}}_exporter"
|
||||||
|
dest: /usr/local/bin/prometheus-{{ exporter }}-exporter
|
||||||
|
remote_src: yes
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0755
|
||||||
|
ignore_errors: '{{ ansible_check_mode }}'
|
||||||
|
when: >
|
||||||
|
(not stat_result.stat.exists or exporter_upgrade == "yes") and
|
||||||
|
prometheus_exporters_sources == "repo"
|
||||||
|
tags: [ 'prometheus_{{ exporter }}' ]
|
||||||
|
|
||||||
|
# If prometheus_exporters_sources == "origin"
|
||||||
- name: '{{ exporter }} exporter | create temp path'
|
- name: '{{ exporter }} exporter | create temp path'
|
||||||
file:
|
file:
|
||||||
state: directory
|
state: directory
|
||||||
path: /tmp/prometheus_exporter/{{ exporter }}
|
path: /tmp/prometheus_exporter/{{ exporter }}
|
||||||
when: not stat_result.stat.exists or exporter_upgrade == "yes"
|
when: >
|
||||||
|
not stat_result.stat.exists or exporter_upgrade == "yes"
|
||||||
|
prometheus_exporters_sources == "origin"
|
||||||
tags: [ 'prometheus_{{ exporter }}' ]
|
tags: [ 'prometheus_{{ exporter }}' ]
|
||||||
|
|
||||||
- name: '{{ exporter }} exporter | get latest release from GitHub'
|
- name: '{{ exporter }} exporter | get latest release from GitHub'
|
||||||
shell: curl --silent "https://api.github.com/repos/{{ prometheus_repo }}/{{ exporter }}_exporter/releases/latest" | jq -r .tag_name | sed "s/v//"
|
shell: curl --silent "https://api.github.com/repos/{{ prometheus_repo }}/{{ exporter }}_exporter/releases/latest" | jq -r .tag_name | sed "s/v//"
|
||||||
register: prometheus_exporter_latest_version
|
register: prometheus_exporter_latest_version
|
||||||
run_once: true
|
run_once: true
|
||||||
when: not stat_result.stat.exists or exporter_upgrade == "yes"
|
when: >
|
||||||
|
(not stat_result.stat.exists or exporter_upgrade == "yes") and
|
||||||
|
prometheus_exporters_sources == "origin"
|
||||||
tags: [ 'prometheus_{{ exporter }}' ]
|
tags: [ 'prometheus_{{ exporter }}' ]
|
||||||
|
|
||||||
- name: '{{ exporter }} exporter | download'
|
- name: '{{ exporter }} exporter | download from origin'
|
||||||
get_url:
|
get_url:
|
||||||
url: "https://github.com/{{ prometheus_repo }}/{{ exporter }}_exporter/releases/download/v{{ prometheus_exporter_latest_version.stdout }}/{{ exporter }}_exporter-{{ prometheus_exporter_latest_version.stdout }}.{{ prometheus_os }}-{{ prometheus_arch }}.tar.gz"
|
url: "https://github.com/{{ prometheus_repo }}/{{ exporter }}_exporter/releases/download/v{{ prometheus_exporter_latest_version.stdout }}/{{ exporter }}_exporter-{{ prometheus_exporter_latest_version.stdout }}.{{ prometheus_os }}-{{ prometheus_arch }}.tar.gz"
|
||||||
dest: /tmp/prometheus_exporter/{{ exporter }}/
|
dest: /tmp/prometheus_exporter/{{ exporter }}/
|
||||||
ignore_errors: '{{ ansible_check_mode }}'
|
ignore_errors: '{{ ansible_check_mode }}'
|
||||||
when: not stat_result.stat.exists or exporter_upgrade == "yes"
|
when: >
|
||||||
|
(not stat_result.stat.exists or exporter_upgrade == "yes") and
|
||||||
|
prometheus_exporters_sources == "origin"
|
||||||
tags: [ 'prometheus_{{ exporter }}' ]
|
tags: [ 'prometheus_{{ exporter }}' ]
|
||||||
|
|
||||||
- name: '{{ exporter }} exporter | unarchive'
|
- name: '{{ exporter }} exporter | unarchive'
|
||||||
@ -55,7 +77,9 @@
|
|||||||
remote_src: yes
|
remote_src: yes
|
||||||
src: /tmp/prometheus_exporter/{{ exporter }}/{{ exporter }}_exporter-{{ prometheus_exporter_latest_version.stdout }}.{{ prometheus_os }}-{{ prometheus_arch }}.tar.gz
|
src: /tmp/prometheus_exporter/{{ exporter }}/{{ exporter }}_exporter-{{ prometheus_exporter_latest_version.stdout }}.{{ prometheus_os }}-{{ prometheus_arch }}.tar.gz
|
||||||
dest: /tmp/prometheus_exporter/{{ exporter }}/
|
dest: /tmp/prometheus_exporter/{{ exporter }}/
|
||||||
when: not stat_result.stat.exists or exporter_upgrade == "yes"
|
when: >
|
||||||
|
(not stat_result.stat.exists or exporter_upgrade == "yes") and
|
||||||
|
prometheus_exporters_sources == "origin"
|
||||||
ignore_errors: '{{ ansible_check_mode }}'
|
ignore_errors: '{{ ansible_check_mode }}'
|
||||||
tags: [ 'prometheus_{{ exporter }}' ]
|
tags: [ 'prometheus_{{ exporter }}' ]
|
||||||
|
|
||||||
@ -69,7 +93,9 @@
|
|||||||
mode: 0755
|
mode: 0755
|
||||||
notify:
|
notify:
|
||||||
- '{{ exporter }}-exporter-restart'
|
- '{{ exporter }}-exporter-restart'
|
||||||
when: not stat_result.stat.exists or exporter_upgrade == "yes"
|
when: >
|
||||||
|
(not stat_result.stat.exists or exporter_upgrade == "yes") and
|
||||||
|
prometheus_exporters_sources == "origin"
|
||||||
tags: [ 'prometheus_{{ exporter }}' ]
|
tags: [ 'prometheus_{{ exporter }}' ]
|
||||||
ignore_errors: '{{ ansible_check_mode }}'
|
ignore_errors: '{{ ansible_check_mode }}'
|
||||||
|
|
||||||
@ -77,6 +103,9 @@
|
|||||||
file:
|
file:
|
||||||
state: absent
|
state: absent
|
||||||
path: /tmp/prometheus_exporter/{{ exporter }}
|
path: /tmp/prometheus_exporter/{{ exporter }}
|
||||||
|
when: >
|
||||||
|
(not stat_result.stat.exists or exporter_upgrade == "yes") and
|
||||||
|
prometheus_exporters_sources == "origin"
|
||||||
|
|
||||||
- name: '{{ exporter }} exporter | systemd | copy unit file'
|
- name: '{{ exporter }} exporter | systemd | copy unit file'
|
||||||
template:
|
template:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user