Revert Ansible URI module in favor of curl.
I can not get the URI module does not seem to work even with "force_basic_auth" vs just using curl while POST-ing a new datasource into Grafana API. Change-Id: Ice644fe9293bee667d75dbbd09a73eaee40cd8e6
This commit is contained in:
parent
405207faa4
commit
56879dfcb2
@ -138,13 +138,20 @@
|
|||||||
#
|
#
|
||||||
# Add graphite server as a default datasource
|
# Add graphite server as a default datasource
|
||||||
#
|
#
|
||||||
- name: Create Data Source on grafana server
|
# (akrzos) I reverted this back to the "old" way after testing Ansible 2.3.0.0
|
||||||
uri:
|
# which still could not POST with basic auth through uri vs curl command.
|
||||||
method: POST
|
- name: Create data_source.json
|
||||||
header: 'Content-Type: application/json'
|
template:
|
||||||
body: "{{ lookup('template', 'data_source.json.j2') |to_json }}"
|
src: data_source.json.j2
|
||||||
body_format: json
|
dest: "{{role_path}}/files/data_source.json"
|
||||||
url: http://{{grafana_host}}:{{grafana_port}}/api/datasources
|
connection: local
|
||||||
username: "{{ grafana_username }}"
|
|
||||||
password: "{{ grafana_password }}"
|
- name: Create Data Source on grafana server
|
||||||
|
command: "curl -X POST -H 'Content-Type: application/json' -d @{{role_path}}/files/data_source.json http://{{grafana_username}}:{{grafana_password}}@{{grafana_host}}:{{grafana_port}}/api/datasources"
|
||||||
|
connection: local
|
||||||
|
tags:
|
||||||
|
- skip_ansible_lint
|
||||||
|
|
||||||
|
- name: Remove leftover json file
|
||||||
|
file: path={{role_path}}/files/data_source.json state=absent
|
||||||
connection: local
|
connection: local
|
||||||
|
Loading…
x
Reference in New Issue
Block a user