You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/test/integration/targets/grafana_datasource/tasks/postgres.yml

62 lines
1.7 KiB
YAML

---
- name: Create postgres datasource
grafana_datasource:
name: "datasource-postgres"
grafana_url: "http://127.0.0.1:3000"
grafana_user: "admin"
grafana_password: "admin"
org_id: "1"
ds_type: "postgres"
ds_url: "postgres.company.com:5432"
database: "db"
user: "postgres"
password: "iampgroot"
sslmode: "verify-full"
register: result
- debug:
var: result
- assert:
that:
- "result.changed == true"
- "result.name == 'datasource-postgres'"
- "result.msg == 'Datasource datasource-postgres created : Datasource added'"
- name: Check postgres datasource creation idempotency
grafana_datasource:
name: "datasource-postgres"
grafana_url: "http://127.0.0.1:3000"
grafana_user: "admin"
grafana_password: "admin"
org_id: "1"
ds_type: "postgres"
ds_url: "postgres.company.com:5432"
database: "db"
user: "postgres"
password: "iampgroot"
sslmode: "verify-full"
register: result
- debug:
var: result
- assert:
that:
# Idempotency is not working currently
# "result.changed == false"
- "result.name == 'datasource-postgres'"
- "result.after.basicAuth == false"
- "result.after.database == 'db'"
- "result.after.isDefault == false"
- "result.after.jsonData.sslmode == 'verify-full'"
- "result.after.jsonData.tlsAuth == false"
- "result.after.jsonData.tlsAuthWithCACert == false"
- "result.after.name == 'datasource-postgres'"
- "result.after.orgId == 1"
- "result.after.type == 'postgres'"
- "result.after.url == 'postgres.company.com:5432'"
- "result.after.user == 'postgres'"
- "result.after.withCredentials == false"