1
0
Fork 0
mirror of https://gitlab.com/s3lph/ansible-collection-prometheus synced 2024-11-22 09:41:01 +01:00
ansible-collection-prometheus/roles/prometheus_node/tasks/debian10.yml
2020-11-13 12:09:39 +01:00

56 lines
1.8 KiB
YAML

---
- name: check if package files already exist
stat:
path: "/root/{{ item.name }}_{{ item.version }}_{{ item.arch }}.deb"
loop:
- name: prometheus-node-exporter
version: 1.0.1+ds-1
arch: amd64
- name: prometheus-node-exporter-collectors
version: 0+git20201003.8db38d1-1
arch: all
register: prometheus_node_register_ucs_deb_stat
- name: download packages
get_url:
url: "https://{{ debian_mirror }}/debian/pool/main/{{ pfirst | urlencode() }}/{{ package | urlencode() }}/{{ package | urlencode() }}_{{ version | urlencode() }}_{{ arch | urlencode() }}.deb" # noqa 204
dest: "/root/{{ package }}_{{ version }}_{{ arch }}.deb"
vars:
pfirst: "{{ item.item.name[:1] }}"
package: "{{ item.item.name }}"
version: "{{ item.item.version }}"
arch: "{{ item.item.arch }}"
when: not item.stat.exists
loop: "{{ prometheus_node_register_ucs_deb_stat.results }}"
- name: install packages
apt:
deb: "/root/{{ item.item.name }}_{{ item.item.version }}_{{ item.item.arch }}.deb"
loop: "{{ prometheus_node_register_ucs_deb_stat.results }}"
- name: start prometheus-node-exporter.service
systemd:
name: prometheus-node-exporter.service
state: started
enabled: yes
- name: start prometheus-node-exporter-apt.timer
systemd:
name: prometheus-node-exporter-apt.timer
state: started
enabled: yes
- name: install smartmontools
apt:
name: smartmontools
state: present
when:
- ansible_virtualization_role == 'host'
- name: start prometheus-node-exporter-smartmon.timer
systemd:
name: prometheus-node-exporter-smartmon.timer
state: "{{ (ansible_virtualization_role == 'host' and not smartmon_exporter_force_off) | ternary('started', 'stopped') }}"
enabled: "{{ ansible_virtualization_role == 'host' }}"