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

Feature provisioning dashboards #121

Merged

Conversation

mxbossard
Copy link
Contributor

Add dashboard provisioning like it is laready done for datasources.
Add a parameter grafana_provisioning_synced to allow previously provisioned dashboard removal.
Add missing tags to the main task.

@mgrecar
Copy link

mgrecar commented Jan 2, 2019

Any updates on this? I could use it, and it looks like the build is failing because of a simple linting failure due to trailing empty lines.

@mxbossard
Copy link
Contributor Author

Any updates on this? I could use it, and it looks like the build is failing because of a simple linting failure due to trailing empty lines.

Sure, I fixed it. Do you know how to relaunch the review ?

@mxbossard
Copy link
Contributor Author

Any updates on this? I could use it, and it looks like the build is failing because of a simple linting failure due to trailing empty lines.

Sure, I fixed it. Do you know how to relaunch the review ?

Ok the review launches automatically. The travis build got a problem with rsync. I don't know why. Should I go on using rsyng module ? I use it to because it's a flexible way to maintain an exact copy of directory content for the provisioned grafana dashboards.

@mxbossard mxbossard force-pushed the feature-provisioning_dashboards branch from 5cc73ea to e45dde2 Compare January 3, 2019 14:48
@paulfantom
Copy link
Member

CI is using docker containers with minimal tool set which doesn't include rsync which in turn is needed by synchronize module.

README.md Outdated Show resolved Hide resolved
when: grafana_use_provisioning
register: synchronize_result

- name: Set privileges on provisioned dashboards
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this task and next one are only executed when previous one was changed, then it might be better to use those as handlers instead of using when: synchronize_result.changed and registering variable. In the end that's what handlers are for. I don't know why this wasn't showing up in CI, but when I run it locally I immediately got linter errors:

    [ANSIBLE0016] Tasks that run when changed should likely be handlers
    /home/paulfantom/cloudalchemy/ansible-grafana/tasks/dashboards.yml:174
    Task/Handler: Set privileges on provisioned dashboards
    
    [ANSIBLE0016] Tasks that run when changed should likely be handlers
    /home/paulfantom/cloudalchemy/ansible-grafana/tasks/dashboards.yml:183
    Task/Handler: Set privileges on provisioned dashboards directory

Copy link
Contributor Author

@mxbossard mxbossard Jan 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes I see. I never used handlers for this kind of situation. I'll do that immediatly.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can notify multiple handlers from one task like:

- name: doing sth
  command: echo "OK"
  notify:
    - do thing A
    - do thing B

@paulfantom
Copy link
Member

This is almost ready to be merged, just this one ANSIBLE0016 issue. After fixing that I will merge this and create a new release 😄

@paulfantom paulfantom merged commit 27c9814 into cloudalchemy:master Jan 8, 2019
@paulfantom
Copy link
Member

Well done! Thank you very much for this! 🎉

@mxbossard
Copy link
Contributor Author

Ouf ! 😄

dimavin pushed a commit to intento/ansible-grafana that referenced this pull request Jan 16, 2019
* Fix grafana provisioning dir scaned on remote host rathen on localhost. And add missing tags.

* Add parameter and tasks to use grafana dashboard provsioning like it already exists for datasources.

* Fix yaml lint, and remove unused commented task.

* Add a rsync install task when using grafana_provisioning.

* Fix dashboard permissions for idempotency.

* Move rsync installation to molecule default prepare playbook. Add a note about rsync need in README.

* Fix molecule default prepare playbook by removing bad condition.

* Move rsync requirement to requirements section.

* Add "provisioned dashboards changed" handler.

* Replace when "provisioned dashboards changed" tasks by a handler notification.

* Fix lint: remove trailing spaces

[minor] release
@lock
Copy link

lock bot commented Mar 24, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Mar 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants