question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error when reinstall

See original GitHub issue

What happened?

TASK [cloudalchemy.node-exporter : Create the node_exporter group] **********************************************************************************************************************************************
fatal: [server]: FAILED! => {}

MSG:

The conditional check '( not __node_exporter_is_installed.stat.exists ) or ( __node_exporter_current_version_output.stderr_lines[0].split(" ")[2] != node_exporter_version ) or ( node_exporter_binary_local_dir | length > 0 )' failed. The error was: error while evaluating conditional (( not __node_exporter_is_installed.stat.exists ) or ( __node_exporter_current_version_output.stderr_lines[0].split(" ")[2] != node_exporter_version ) or ( node_exporter_binary_local_dir | length > 0 )): list object has no element 0

The error appears to be in '/home/igorohrimenko/ansible-playbooks/roles/cloudalchemy.node-exporter/tasks/install.yml': line 2, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

---
- name: Create the node_exporter group
  ^ here

Did you expect to see some different? yes How to reproduce it (as minimally and precisely as possible): Install node_exporter ReInstall node_exporter Environment

  • Role version: 2.0

  • Ansible version information: ansible 2.9.6

  • Variables:

insert role variables relevant to the issue
  • Ansible playbook execution Logs:
insert Ansible logs relevant to the issue here

Anything else we need to know?: Problem in task:

- name: Gather currently installed node_exporter version (if any)
  command: "{{ _node_exporter_binary_install_dir }}/node_exporter --version"
  args:
    warn: false
  changed_when: false
  register: __node_exporter_current_version_output
  check_mode: false
  when: __node_exporter_is_installed.stat.exists
  tags:
    - node_exporter_install
    - skip_ansible_lint

after register print var:

TASK [cloudalchemy.node-exporter : debug] ***********************************************************************************************************************************************************************
ok: [server] => {
    "__node_exporter_current_version_output": {
        "changed": false,
        "cmd": [
            "/usr/local/bin/node_exporter",
            "--version"
        ],
        "delta": "0:00:00.007607",
        "end": "2021-07-20 14:14:00.637978",
        "failed": false,
        "rc": 0,
        "start": "2021-07-20 14:14:00.630371",
        "stderr": "",
        "stderr_lines": [],
        "stdout": "node_exporter, version 1.2.0 (branch: HEAD, revision: 12968948aec1e2b216a2ecefc45cf3a50671aecb)\n  build user:       root@6b17174de526\n  build date:       20210715-16:35:54\n  go version:       go1.16.6\n  platform:         linux/amd64",
        "stdout_lines": [
            "node_exporter, version 1.2.0 (branch: HEAD, revision: 12968948aec1e2b216a2ecefc45cf3a50671aecb)",
            "  build user:       root@6b17174de526",
            "  build date:       20210715-16:35:54",
            "  go version:       go1.16.6",
            "  platform:         linux/amd64"
        ]
    }
}

Fix, change stderr_lines to stdout_lines in this task:

- import_tasks: install.yml
  become: true
  when:
    ( not __node_exporter_is_installed.stat.exists ) or
    ( __node_exporter_current_version_output.stdout_lines[0].split(" ")[2] != node_exporter_version ) or
    ( node_exporter_binary_local_dir | length > 0 )
  tags:
    - node_exporter_install

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:7
  • Comments:9

github_iconTop GitHub Comments

25reactions
GeorgeGedoxcommented, Aug 22, 2021

@SuperQ Can you do a release of 2.0.1 please? I consider this issue to be pretty important

18reactions
utkuozdemircommented, Aug 14, 2021

It would be great if you make a new release to include this fix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

If an error occurred while updating or installing macOS
The message might say that an error occurred while downloading, preparing, or installing, or that the installer is damaged or could not be ......
Read more >
9 Ways to Fix an Error Occurred While Preparing the Installation
Fix 1: Restart your Mac · Fix 2: Check the Date and Time · Fix 3: Boot Into Safe Mode · Fix 4:...
Read more >
Fix: An Error Occurred While Preparing macOS Installation
Boot Into Safe Mode · Check Date and Time Settings · Reinstall the OS Without Erasing the Drive · Erase the Drive Before...
Read more >
“An Error Occurred While Preparing the Installation”, Fix
“An Error Occurred While Preparing the Installation”, Fix · 1. Restart your Mac. Simply restart your Mac to see if this fixes your...
Read more >
An Error Occurred While Preparing the Installation? Easy Fixes!
Change/Check Date and Time · Use macOS Recovery · Re-Download the Installer · Reinstall the OS Without Erasing the Drive · Reinstall the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found