Skip to content

Commit

Permalink
fix: remove unneeded download step that can cause ratelimit
Browse files Browse the repository at this point in the history
Signed-off-by: gardar <[email protected]>
  • Loading branch information
gardar committed Sep 28, 2024
1 parent c8b2516 commit 050c9d3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 25 deletions.
30 changes: 13 additions & 17 deletions roles/snmp_exporter/tasks/configure.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -9,29 +17,17 @@
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
mode: 0644
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') }}"
8 changes: 0 additions & 8 deletions roles/snmp_exporter/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 050c9d3

Please sign in to comment.