Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin installation made idempotent. #21

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
13 changes: 11 additions & 2 deletions tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,18 @@
- name: grafana-configure | Ensure that Grafana-Server is started
service: name=grafana-server state=started enabled=yes

- name: grafana-configure | Check installed plugins
raw: "grafana-cli plugins ls |tail -n +2 |head -n -3 |awk '{print $1}'"
changed_when: false
register: result

- set_fact:
grafana_plugins_to_install: "{{ grafana_plugins_install| difference(result.stdout_lines) }}"

- name: grafana-configure | Install plugins
command: "grafana-cli plugins install {{item}}"
with_items: "{{grafana_plugins_install}}"
with_items: "{{grafana_plugins_to_install}}"
when: grafana_plugins_to_install is defined
notify: grafana restart

# - name: grafana-configure | Setup passlib
Expand All @@ -24,4 +33,4 @@
- name: grafana-configure | Compile Nginx configuration
template: src=nginx.conf.j2 dest={{nginx_dir|default('/etc/nginx')}}/sites-enabled/grafana.conf
when: grafana_nginx
notify: nginx reload
notify: nginx reload