2017-07-05 6 views
0
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" 

}

+1

Versuchen Sie, die 'admin: admin @' von der URL zu entfernen –

Antwort

0

ich zum 'Befehl' Modul zurückgreifen musste

- name: Add graphite datasource 
    command: > 
    curl 'http://admin:[email protected]{{ inventory_hostname }}:3000/api/datasources' -X POST -H 'Content-Type: application/json;charset=UTF-8' --data-binary '{"name":"Graphite Live","type":"graphite","url":"http://graphiteserver.foo.bar","access":"direct","isDefault":true,"database":"asd"}' 
1
  1. Einstellung body_format zuversuchen.
  2. Entfernen Sie die überschüssige Vertiefung vor body.
  3. Überschüssiges doppelte Anführungszeichen um "{{ influxdb_database|default(collectd_db) }}"
  4. entfernen admin:a[email protected] von url: Wert (es durch user und password bereits eingestellt ist).

Lassen Sie uns wissen, wie Sie danach kommen!

Verwandte Themen