curl 'http://admin:[email protected]:3000/api/datasources' -X POST -H 'Content-Type: application/json;charset=UTF-8' --data-binary '{"name":"influx","type":"influxdb","url":"http://localhost:8086","access":"proxy","isDefault":true,"database":"collectd_db","user":"admin","password":"admin"}'
Nicht sicher, wie dies im ansi-uri-Modul codiert wird. Bisher habe ich diese bekam:ansibles uri entspricht dem curl-Befehl
- name: next add the database to the grafana
uri:
url: "http://admin:[email protected]:3000/api/datasources"
method: POST
user: admin
password: admin
body: '{"name":"influx","type":"influxdb","url":"http://localhost:8086","access":"proxy","isDefault":true,"database":""{{ influxdb_database|default(collectd_db) }}"","user":"admin","password":"admin"}'
body_format: raw
# force_basic_auth: yes
Aber es funktioniert nicht und gibt folgende Fehlermeldung:
"msg": "Status code was not [200]: Request failed: <urlopen error [Errno -2] Name or service not known>",
"redirected": false,
"status": -1,
"url": "http://********:********@127.0.0.1:3000/api/datasources"
}
Versuchen Sie, die 'admin: admin @' von der URL zu entfernen –