Skip to content

Commit

Permalink
fixup! fix linting with ansible-lint write
Browse files Browse the repository at this point in the history
  • Loading branch information
rndmh3ro committed Jan 4, 2024
1 parent c4da526 commit afda0fd
Show file tree
Hide file tree
Showing 58 changed files with 1,555 additions and 1,520 deletions.
1 change: 1 addition & 0 deletions galaxy.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
namespace: community
name: grafana
version: 1.6.1
Expand Down
2 changes: 1 addition & 1 deletion meta/runtime.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
requires_ansible: '>=2.9.0'
requires_ansible: ">=2.9.0"
action_groups:
grafana:
- grafana_dashboard
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/targets/grafana_dashboard/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
grafana_url: "http://grafana:3000/"
grafana_username: "admin"
grafana_password: "admin"
grafana_url: http://grafana:3000/
grafana_username: admin
grafana_password: admin
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
register: result
- ansible.builtin.assert:
that:
- "result.failed == false"
- "result.changed == true"
- "result.msg == 'Dashboard test created'"
- result.failed == false
- result.changed == true
- result.msg == 'Dashboard test created'

- name: Check import grafana dashboard from file idempotency
community.grafana.grafana_dashboard:
Expand All @@ -31,8 +31,9 @@
register: result
- ansible.builtin.assert:
that:
- "result.failed == false"
- "result.changed == false"
- "result.msg == 'Dashboard test unchanged.'"
- result.failed == false
- result.changed == false
- result.msg == 'Dashboard test unchanged.'

- ansible.builtin.include_tasks: delete-dashboard.yml
- ansible.builtin.include_tasks:
file: delete-dashboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
register: result
- ansible.builtin.assert:
that:
- "result.failed == false"
- "result.changed == true"
- "result.msg == 'Dashboard ' ~ result.uid ~ ' exported to /tmp/dashboard_export.json'"
- result.failed == false
- result.changed == true
- result.msg == 'Dashboard ' ~ result.uid ~ ' exported to /tmp/dashboard_export.json'

- name: Load /tmp/dashboard_export.json or fail if missing
ansible.builtin.set_fact:
Expand All @@ -22,6 +22,6 @@
- name: Assert that exported dashboard contains formatted JSON
ansible.builtin.assert:
that:
- "exported_dashboard_lines | length >= 2"
- "exported_dashboard_lines[0] == '{'"
- "exported_dashboard_lines[-1] == '}'"
- exported_dashboard_lines | length >= 2
- exported_dashboard_lines[0] == '{'
- exported_dashboard_lines[-1] == '}'
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
ignore_errors: true
- ansible.builtin.assert:
that:
- "result.failed == true"
- "result.changed == false"
- result.failed == true
- result.changed == false
- "result.msg == 'error : Dashboard folder \\'inexistent\\' does not exist.'"
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
- name: Copy dashboard file
ansible.builtin.copy:
src: "files/dashboard.json"
dest: "/tmp/dashboard.json"
src: files/dashboard.json
dest: /tmp/dashboard.json

- name: Check import grafana dashboard from file
community.grafana.grafana_dashboard:
Expand All @@ -16,9 +16,9 @@
register: result
- ansible.builtin.assert:
that:
- "result.failed == false"
- "result.changed == true"
- "result.msg == 'Dashboard test created'"
- result.failed == false
- result.changed == true
- result.msg == 'Dashboard test created'

- name: Check import grafana dashboard from file idempotency
community.grafana.grafana_dashboard:
Expand All @@ -32,10 +32,12 @@
register: result
- ansible.builtin.assert:
that:
- "result.failed == false"
- "result.changed == false"
- "result.msg == 'Dashboard test unchanged.'"
- result.failed == false
- result.changed == false
- result.msg == 'Dashboard test unchanged.'

- ansible.builtin.include_tasks: dashboard-export.yml
- ansible.builtin.include_tasks:
file: dashboard-export.yml

- ansible.builtin.include_tasks: delete-dashboard.yml
- ansible.builtin.include_tasks:
file: delete-dashboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
dashboard_revision: "1"
overwrite: true
register: result
- assert:
- ansible.builtin.assert:
that:
- "result.failed == false"
- "result.changed == true"
- "result.msg == 'Dashboard Zabbix Host Status created'"
- result.failed == false
- result.changed == true
- result.msg == 'Dashboard Zabbix Host Status created'

- name: Check import grafana dashboard from id idempotency
community.grafana.grafana_dashboard:
Expand All @@ -29,8 +29,9 @@
register: result
- ansible.builtin.assert:
that:
- "result.failed == false"
- "result.changed == false"
- "result.msg == 'Dashboard Zabbix Host Status unchanged.'"
- result.failed == false
- result.changed == false
- result.msg == 'Dashboard Zabbix Host Status unchanged.'

- ansible.builtin.include_tasks: delete-dashboard.yml
- ansible.builtin.include_tasks:
file: delete-dashboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
dashboard_url: https://grafana.com/api/dashboards/6098/revisions/1/download
overwrite: true
register: result
- assert:
- ansible.builtin.assert:
that:
- "result.failed == false"
- "result.changed == true"
- "result.msg == 'Dashboard Zabbix Host Status created'"
- result.failed == false
- result.changed == true
- result.msg == 'Dashboard Zabbix Host Status created'

- name: Check import grafana dashboard from url idempotency
community.grafana.grafana_dashboard:
Expand All @@ -27,8 +27,9 @@
register: result
- ansible.builtin.assert:
that:
- "result.failed == false"
- "result.changed == false"
- "result.msg == 'Dashboard Zabbix Host Status unchanged.'"
- result.failed == false
- result.changed == false
- result.msg == 'Dashboard Zabbix Host Status unchanged.'

- ansible.builtin.include_tasks: delete-dashboard.yml
- ansible.builtin.include_tasks:
file: delete-dashboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
register: result
- ansible.builtin.assert:
that:
- "result.failed == false"
- "result.changed == true"
- "result.msg == 'Dashboard ' ~ result.uid ~ ' deleted'"
- result.failed == false
- result.changed == true
- result.msg == 'Dashboard ' ~ result.uid ~ ' deleted'
15 changes: 10 additions & 5 deletions tests/integration/targets/grafana_dashboard/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
---
- name: Create dashboard from url
ansible.builtin.include_tasks: dashboard-from-url.yml
ansible.builtin.include_tasks:
file: dashboard-from-url.yml

- name: Create dashboard from id
ansible.builtin.include_tasks: dashboard-from-id.yml
ansible.builtin.include_tasks:
file: dashboard-from-id.yml

- name: Create dashboard from file and export
ansible.builtin.include_tasks: dashboard-from-file-export.yml
ansible.builtin.include_tasks:
file: dashboard-from-file-export.yml

- name: Create dashboard from file by org_name
ansible.builtin.include_tasks: dashboard-by-org-name.yml
ansible.builtin.include_tasks:
file: dashboard-by-org-name.yml

- name: Create dashboard in non existing folder
ansible.builtin.include_tasks: dashboard-folder-destination.yml
ansible.builtin.include_tasks:
file: dashboard-folder-destination.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
---

grafana_url: "http://grafana:3000/"
grafana_username: "admin"
grafana_password: "admin"

...
grafana_url: http://grafana:3000/
grafana_username: admin
grafana_password: admin
Loading

0 comments on commit afda0fd

Please sign in to comment.