fix: remove unneeded download step that can cause ratelimit

Signed-off-by: gardar <gardar@users.noreply.github.com>
This commit is contained in:
gardar 2024-09-28 02:57:10 +00:00
parent c8b2516c7f
commit 050c9d3347
No known key found for this signature in database
GPG key ID: 00872BAF59D98753
2 changed files with 13 additions and 25 deletions

View file

@ -1,4 +1,12 @@
---
- name: Create configuration directory
ansible.builtin.file:
path: "/etc/snmp_exporter"
state: directory
owner: root
group: root
mode: 0755
- name: Copy the SNMP Exporter systemd service file
ansible.builtin.template:
src: snmp_exporter.service.j2
@ -9,24 +17,9 @@
notify:
- restart snmp_exporter
- name: Download snmp configuration file from github repository
ansible.builtin.get_url:
url: "https://raw.githubusercontent.com/prometheus/snmp_exporter/v{{ snmp_exporter_version }}/snmp.yml"
dest: /etc/snmp_exporter/snmp.yml
owner: root
group: root
mode: 0644
register: _download_config
until: _download_config is success
retries: 5
delay: 2
notify:
- reload snmp_exporter
when: not (snmp_exporter_config_file)
- name: Copy configuration file
ansible.builtin.template:
src: "{{ snmp_exporter_config_file }}"
src: "{{ snmp_exporter_config_file | default(__snmp_exporter_config_file, true) }}"
dest: /etc/snmp_exporter/snmp.yml
owner: root
group: root
@ -34,4 +27,7 @@
no_log: "{{ false if (lookup('env', 'CI')) or (lookup('env', 'MOLECULE_PROVISIONER_NAME')) else true }}"
notify:
- reload snmp_exporter
when: (snmp_exporter_config_file)
vars:
__snmp_exporter_config_file: "{{ (snmp_exporter_binary_local_dir) |
ternary(snmp_exporter_binary_local_dir ~ '/snmp.yml',
snmp_exporter_archive_path ~ '/snmp_exporter-' ~ snmp_exporter_version ~ '.linux-' ~ go_arch ~ '/snmp.yml') }}"

View file

@ -49,11 +49,3 @@
- snmp_exporter_binary_local_dir | length > 0
- not snmp_exporter_skip_install
notify: restart snmp_exporter
- name: Create configuration directory
ansible.builtin.file:
path: "/etc/snmp_exporter"
state: directory
owner: root
group: root
mode: 0755