--- - name: add debian repository include_role: name: apt-repo/grafana - name: install apt packages apt: name: grafana state: present - name: configure grafana server loop: "{{ grafana_config_server | dict2items }}" loop_control: label: "{{ item.key }}" ini_file: path: /etc/grafana/grafana.ini section: server option: "{{ item.key }}" value: "{{ item.value | string }}" notify: restart grafana - name: configure grafana analytics loop: "{{ grafana_config_analytics | dict2items }}" loop_control: label: "{{ item.key }}" ini_file: path: /etc/grafana/grafana.ini section: analytics option: "{{ item.key }}" value: "{{ item.value | string }}" notify: restart grafana - name: configure grafana security loop: "{{ grafana_config_security | dict2items }}" loop_control: label: "{{ item.key }}" ini_file: path: /etc/grafana/grafana.ini section: security option: "{{ item.key }}" value: "{{ item.value | string }}" notify: restart grafana - name: configure grafana users loop: "{{ grafana_config_users | dict2items }}" loop_control: label: "{{ item.key }}" ini_file: path: /etc/grafana/grafana.inig section: users option: "{{ item.key }}" value: "{{ item.value | string }}" notify: restart grafana - name: make sure grafan-server is enabled and started systemd: name: grafana-server state: started enabled: yes - name: configure nginx vhost vars: nginx_vhost: name: grafana template: generic-proxy-no-buffering hostnames: - "_" locations: '/': proxy_pass: "http://127.0.0.1:{{ grafana_config_server.http_port | default(3000) }}" extra_directives: |- client_max_body_size 0; include_role: name: nginx/vhost