Skip to content
This repository has been archived by the owner on Mar 6, 2023. It is now read-only.

Refactor: Unnecessary call to github if node_exporter already installed #262

Closed
cdrice opened this issue Feb 20, 2022 · 1 comment
Closed
Labels
enhancement New feature or request

Comments

@cdrice
Copy link

cdrice commented Feb 20, 2022

Current logic implemented in the final block of tasks/preflight.yml (Get checksum list from github and Get checksum for {{ go_arch }} architecture) are unnecessary to execute if node_exporter is already installed and at the desired version.

Potential refactoring solutions:

1 - Move block to tasks/install.yml. Since the inclusion of this task list is dependent on "is node_exporter already at the correct version" logic in tasks/main.yml, they would only be run if installation is required.

2 - Replicate logic for calling block to only call if installation will be required. Seems smelly and not DRY, as it would require duplication of logic already present in tasks/main.yml.

3 - Further refactor "is node_exporter already at the correct version" logic currently in tasks/main.yml and use this logic to set a Boolean value which could then be inspected elsewhere (in the current preflight logic to pull the checksum list as well as the logic to include the install tasks).

Option 1 is arguably easiest. Option 2 is smelly and only mentioned for the sake of discussion. Option 3 may be most flexible, at the cost of some additional complexity. It is attractive, however, as it decouples logic from main.yml, leaving an arguably more elegant main task list for the role.

The logic for "is node_exporter already the correct version" appears to be in flux related to some other issues and PRs I see open, so I have not authored any specific update for this request.

I would happy to author a PR for whichever option (or another solution) the project maintainer prefers, if desired.

@cdrice cdrice added the enhancement New feature or request label Feb 20, 2022
@SuperQ
Copy link
Collaborator

SuperQ commented Mar 6, 2023

This role has been deprecated in favor of a the prometheus-community/ansible collection.

@SuperQ SuperQ closed this as completed Mar 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants