--- - name: install dependencies packages apt: name: apt-transport-https retries: 2 register: result until: result is succeeded tags: grafana - name: add repository key apt_key: url: https://packages.grafana.com/gpg.key retries: 2 register: result until: result is succeeded tags: grafana - name: add repository apt_repository: repo: deb https://packages.grafana.com/oss/deb stable main tags: grafana - name: install grafana package apt: name: grafana retries: 2 register: result until: result is succeeded tags: grafana - name: copy configuration file template: src: grafana.ini.j2 dest: /etc/grafana/grafana.ini owner: root group: grafana mode: 0640 notify: restart grafana tags: grafana - name: copy ldap configuration file template: src: ldap.toml.j2 dest: /etc/grafana/ldap.toml owner: root group: grafana mode: 0640 notify: restart grafana tags: grafana - name: install plugins grafana_plugin: name: '{{ item.name }}' version: '{{ item.version|default("latest") }}' state: '{{ item.state|default("present") }}' loop: '{{ grafana_plugins }}' notify: restart grafana tags: grafana - name: enable and start service systemd: name: grafana-server state: started enabled: yes tags: grafana