Giter VIP home page Giter VIP logo

Comments (11)

nemcikjan avatar nemcikjan commented on July 18, 2024

any updates on this?

from ansible-node-exporter.

wowpetr avatar wowpetr commented on July 18, 2024

Did some debugging of ansible.builtin.uri module and found how to solve this. You need to run your playbook with -K or --ask-become-pass (ask for privilege escalation password) and you will be asked for sudo password of your local machine (not target). Seems that ansible.builtin.uri module requires sudo of your local machine somehow.

from ansible-node-exporter.

sixtus avatar sixtus commented on July 18, 2024

it crashes the whole python process for me on my mac. Passing -K does not fix it.

from ansible-node-exporter.

wowpetr avatar wowpetr commented on July 18, 2024

To @sixtus:
If it crashes during multithreading tasks on your mac then it isn't related to this problem and you have to add this line "export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES" to your .zshrc/.bashrc and restart your terminal session

from ansible-node-exporter.

sixtus avatar sixtus commented on July 18, 2024

@wowpetr thanks, that fixed the crash, however I need to pass a version, "Get latest release" fails with FAILED! => {"censored": "the output has been hidden due to the fact that 'no_log: true' was specified for this result"}

from ansible-node-exporter.

wowpetr avatar wowpetr commented on July 18, 2024

@sixtus with -K argument and local sudo password provided?

from ansible-node-exporter.

sixtus avatar sixtus commented on July 18, 2024

@wowpetr I run into a different problem now, so -K seems to help. Why I need local sudo rights to run ansible beats me though (and doesn't build confidence)

from ansible-node-exporter.

wowpetr avatar wowpetr commented on July 18, 2024

@sixtus when I was debugging it I could see that get-uri module downloads the github version page locally to parse the latest version and it needs access to stderr which requires sudo (at least it says so).

from ansible-node-exporter.

humberto-garza avatar humberto-garza commented on July 18, 2024

Running into this issue as well:

node_exporter_version = latest

TASK [cloudalchemy.node_exporter : Get checksum list from github] **********************************************************************************************************************************************************************************
task path: /usr/share/ansible/roles/cloudalchemy.node_exporter/tasks/preflight.yml:99
fatal: [<REDACTED> -> localhost]: FAILED! =>
  msg: 'An unhandled exception occurred while running the lookup plugin ''url''. Error was a <class ''ansible.errors.AnsibleError''>, original message: Received HTTP error for https://github.com/prometheus/node_exporter/releases/download/vlatest/sha256sums.txt : HTTP Error 404: Not Found'

Does not exist:
https://github.com/prometheus/node_exporter/releases/download/vlatest/sha256sums.txt

from ansible-node-exporter.

Dmitry099 avatar Dmitry099 commented on July 18, 2024

I've faced with same issue.

As I understand, in string https://github.com/cloudalchemy/ansible-node-exporter/blob/master/tasks/preflight.yml#L91), we're trying to override node_exporter_version variable by using set_fact.

- name: "Set node_exporter version to {{ _latest_release.json.tag_name[1:] }}"
      set_fact:
        node_exporter_version: "{{ _latest_release.json.tag_name[1:] }}"

However, set_fact have low precedence and precedence is more important than the order in which the value is assigned.
For more info please see -> https://stackoverflow.com/questions/27038553/ansible-set-fact-doesnt-change-the-variable-value

Workaround is to create additional variable (i.e. internal variable _node_exporter_version) which will be used instead of variable node_exporter_version in steps after "Set node_exporter version to" and add additional step to define this variable for node exporter with predefined version.
Example:

- block:
    - name: Get latest release
      uri:
        url: "https://api.github.com/repos/prometheus/node_exporter/releases/latest"
        method: GET
        return_content: true
        status_code: 200
        body_format: json
        user: "{{ lookup('env', 'GH_USER') | default(omit) }}"
        password: "{{ lookup('env', 'GH_TOKEN') | default(omit) }}"
      no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}"
      register: _latest_release
      until: _latest_release.status == 200
      retries: 5

    - name: "Set internal variable for node_exporter version to {{ _latest_release.json.tag_name[1:] }}"
      set_fact:
        _node_exporter_version: "{{ _latest_release.json.tag_name[1:] }}"
  when:
    - node_exporter_version == "latest"
    - node_exporter_binary_local_dir | length == 0
  delegate_to: localhost
  run_once: true
  
- name: "Set internal variable for node_exporter version to {{ node_exporter_version }}"
    set_fact:
      _node_exporter_version: "{{ node_exporter_version }}"
  when:
    - node_exporter_version != "latest"
  

from ansible-node-exporter.

SuperQ avatar SuperQ commented on July 18, 2024

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

from ansible-node-exporter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.