cloudalchemy / ansible-node-exporter

Provision basic metrics exporter for prometheus monitoring tool
MIT License
500 stars 272 forks source link

Example code in the README doesn't generate a CSR file #281

Closed anthonyeleven closed 1 year ago

anthonyeleven commented 1 year ago

What happened?

TASK [Create cert and key] ** fatal: [prom-test.tor3.indexww.com]: FAILED! => { "changed": false }

MSG:

[Errno 2] No such file or directory: '/etc/node_exporter/tls.csr'

Did you expect to see some different?

How to reproduce it (as minimally and precisely as possible):

pre_tasks:

Environment Rocky Linux release 8.5 (Green Obsidian)

insert role variables relevant to the issue
insert Ansible logs relevant to the issue here

Anything else we need to know?:

poehlerflorian commented 1 year ago

I had the same problem and solved it by creating a private key and then the certificate from that private key.

- name: Create private key
  community.crypto.openssl_privatekey:
    path: /etc/node_exporter/tls.key
    type: Ed25519 # Optional, can be removed to create a RSA key

- name: Create cert
  community.crypto.x509_certificate:
    path: /etc/node_exporter/tls.cert
    privatekey_path: /etc/node_exporter/tls.key
    provider: selfsigned

See also https://docs.ansible.com/ansible/latest/collections/community/crypto/docsite/guide_selfsigned.html

SuperQ commented 1 year ago

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