newrelic / ansible-install

Building installation support for our customers are using ansible to manage their infrastructure and services at scale
Apache License 2.0
8 stars 6 forks source link

windows error when installing on Linux Fedora 38 #40

Closed mariusa closed 1 year ago

mariusa commented 1 year ago

newrelic.yml

---
# https://github.com/newrelic/infrastructure-agent-ansible/issues/206
# By default, the infrastructure agent doesn't send data about the operating system's processes. To enable the sending of process data set enable_process_metrics to true. To fine-tune which processes you want to monitor, configure include_matching_metrics.
- hosts: localhost
  become: yes
  gather_facts: yes
  roles:
    - role: newrelic.newrelic_install
      vars:
        log_file: /var/log/newrelic/newrelic.log
        nrinfragent_state: latest
        nrinfragent_config:
          enable_process_metrics: true
          license_key: ABC
        nrinfragent_integrations:
        # The integrations package name is located in the Install and activate section of the individual integrations docs.
          - name: nri-nginx
            state: latest

Description

# ansible-playbook newrelic.yml 
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
ERROR! couldn't resolve module/action 'ansible.windows.win_file'. This often indicates a misspelling, missing collection, or incorrect module path.

The error appears to be in '/root/.ansible/roles/newrelic.newrelic_install/tasks/windows.yml': line 14, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

- name: Touch verbose output log file
  ^ here

Thanks

rthorn-nr commented 1 year ago

Hi @mariusa , based on your example playbook, I think you're looking for newrelic.newrelic-infra https://galaxy.ansible.com/newrelic/newrelic-infra

mariusa commented 1 year ago

Here's the updated ansible script for this version, same issue:

---
- hosts: localhost
  become: yes
  gather_facts: yes # https://stackoverflow.com/questions/73463325/gather-facts-seems-to-break-set-fact-and-hostvars
  roles:
    - role: newrelic.newrelic_install
      vars:
        targets:
          - infrastructure
          - logs
        install_timeout_seconds: 3000
        verbosity: debug
  environment:
    NEW_RELIC_API_KEY: "..."
    NEW_RELIC_ACCOUNT_ID: "..."
    NEW_RELIC_REGION: "US"
    NEW_RELIC_APPLICATION_NAME: "..."
ERROR! couldn't resolve module/action 'ansible.windows.win_file'. This often indicates a misspelling, missing collection, or incorrect module path.

The error appears to be in '/root/.ansible/roles/newrelic.newrelic_install/tasks/windows.yml': line 14, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

- name: Touch verbose output log file
  ^ here
rthorn-nr commented 1 year ago

Thanks for following up @mariusa

We're trying to repro. It looks like you're targeting localhost on Fedora. Would you mind sharing your command you use to run the playbook?

rthorn-nr commented 1 year ago

Was able to reproduce. Would you please run the following command to install collection dependencies and try again:

ansible-galaxy collection install ansible.windows ansible.utils

mariusa commented 1 year ago

Thanks, it did work now. It ended with

        "node": "fedora",
        "status": "INCOMPLETE",
        "summary": [
            "  Installation Summary",
            "",
            "  ⊘  infrastructure-agent-installer  (unsupported)  ",
            "  ⊘  logs-integration  (unsupported)  ",
            "",
            "  Installation incomplete. Follow the instructions at the URL below to complete the installation process. ",
            "",
            "  ⮕  https://onenr.io/0KQXp2v2zQa",
            "",
            "  --------------------",
            "",
            "",
            "We encountered an issue during the installation: no recipes were installed.",

Should I file another issue for this?

amolero-nr commented 1 year ago

Hi @mariusa! I believe that is because Fedora is not supported by the infrastructure agent. See here, please (and logs requires infrastructure).