Skip to content

Instantly share code, notes, and snippets.

@mrtyler
Created March 2, 2017 22:32
Show Gist options
  • Save mrtyler/25218e61e1b0eec06d0b58accf4ba3af to your computer and use it in GitHub Desktop.
Save mrtyler/25218e61e1b0eec06d0b58accf4ba3af to your computer and use it in GitHub Desktop.
# This part appears to work. It returns json.
- name: Check if influxdb datasource configured
uri:
method: GET
user: "{{ grafana_admin_login|quote }}"
password: "{{ grafana_admin_password|quote }}"
force_basic_auth: true
body_format: json
url: "http://localhost:{{ grafana_port }}/api/datasources"
register: datasources
- name: Configure influxdb datasource
uri:
method: POST
user: "{{ grafana_admin_login|quote }}"
password: "{{ grafana_admin_password|quote }}"
force_basic_auth: true
body_format: json
body: {
}
url: "http://localhost:{{ grafana_port }}/api/datasources"
# when: "\"type\": \"influxdb\" not in datasources.json"
when: "{{ influxdb_datasource|to_json }} not in datasources.json"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment