Skip to content
This repository has been archived by the owner on May 31, 2023. It is now read-only.

Add separate grafana_api_url variable #71

Merged
merged 1 commit into from
Jul 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ All variables which can be overridden are stored in [defaults/main.yml](defaults
| `grafana_address` | 0.0.0.0 | Address on which grafana listens |
| `grafana_port` | 3000 | port on which grafana listens |
| `grafana_url` | "http://{{ grafana_address }}:{{ grafana_port }}" | Full URL used to access Grafana from a web browser |
| `grafana_api_url` | "{{ grafana_url }}" | URL used for API calls in provisioning if different from public URL. See [this issue](https://github.com/cloudalchemy/ansible-grafana/issues/70). |
| `grafana_domain` | "{{ ansible_fqdn \| default(ansible_host) \| default('localhost') }}" | setting is only used in as a part of the `root_url` option. Useful when using GitHub or Google OAuth |
| `grafana_server` | { protocol: http, enforce_domain: false, socket: "", cert_key: "", cert_file: "", enable_gzip: false, static_root_path: public, router_logging: false } | [server](http://docs.grafana.org/installation/configuration/#server) configuration section |
| `grafana_security` | { admin_user: admin, admin_password: "" } | [security](http://docs.grafana.org/installation/configuration/#security) configuration section |
Expand Down
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ grafana_port: 3000

# External Grafana address. Variable maps to "root_url" in grafana server section
grafana_url: "http://{{ grafana_address }}:{{ grafana_port }}"
grafana_api_url: "{{ grafana_url }}"
grafana_domain: "{{ ansible_fqdn | default(ansible_host) | default('localhost') }}"

# Additional options for grafana "server" section
Expand Down
4 changes: 2 additions & 2 deletions tasks/api_keys.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

- name: Check api key list
uri:
url: "{{ grafana_url }}/api/auth/keys"
url: "{{ grafana_api_url }}/api/auth/keys"
user: "{{ grafana_security.admin_user }}"
password: "{{ grafana_security.admin_password }}"
force_basic_auth: true
Expand All @@ -18,7 +18,7 @@

- name: Create grafana api keys
uri:
url: "{{ grafana_url }}/api/auth/keys"
url: "{{ grafana_api_url }}/api/auth/keys"
user: "{{ grafana_security.admin_user }}"
password: "{{ grafana_security.admin_password }}"
force_basic_auth: true
Expand Down
2 changes: 1 addition & 1 deletion tasks/dashboards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@

- name: import grafana dashboards
uri:
url: "{{ grafana_url }}/api/dashboards/db"
url: "{{ grafana_api_url }}/api/dashboards/db"
user: "{{ grafana_security.admin_user }}"
password: "{{ grafana_security.admin_password }}"
force_basic_auth: true
Expand Down
6 changes: 3 additions & 3 deletions tasks/datasources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
- block:
- name: Check datasources list (api)
uri:
url: "{{ grafana_url }}/api/datasources"
url: "{{ grafana_api_url }}/api/datasources"
user: "{{ grafana_security.admin_user }}"
password: "{{ grafana_security.admin_password }}"
force_basic_auth: true
Expand All @@ -12,7 +12,7 @@

- name: Create grafana datasources (api)
uri:
url: "{{ grafana_url }}/api/datasources"
url: "{{ grafana_api_url }}/api/datasources"
user: "{{ grafana_security.admin_user }}"
password: "{{ grafana_security.admin_password }}"
force_basic_auth: true
Expand All @@ -25,7 +25,7 @@

- name: Update grafana datasources (api)
uri:
url: "{{ grafana_url }}/api/datasources/{{ (
url: "{{ grafana_api_url }}/api/datasources/{{ (
datasources['json'] |
selectattr('name', 'equalto', item['name']) |
map(attribute='id') |
Expand Down
4 changes: 2 additions & 2 deletions tasks/notifications.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
- name: Check alert notifications list
uri:
url: "{{ grafana_url }}/api/alert-notifications"
url: "{{ grafana_api_url }}/api/alert-notifications"
user: "{{ grafana_security.admin_user }}"
password: "{{ grafana_security.admin_password }}"
force_basic_auth: true
Expand All @@ -11,7 +11,7 @@

- name: Create grafana alert notification channels
uri:
url: "{{ grafana_url }}/api/alert-notifications"
url: "{{ grafana_api_url }}/api/alert-notifications"
user: "{{ grafana_security.admin_user }}"
password: "{{ grafana_security.admin_password }}"
force_basic_auth: true
Expand Down