--- - name: Set grafana container subuid ansible.builtin.set_fact: grafana_subuid: "100471" - name: Create grafana directory ansible.builtin.file: path: "{{ node['home_path'] }}/containers/{{ item }}" owner: "{{ grafana_subuid }}" group: "svadmins" state: "directory" mode: "0770" loop: - "grafana" - "grafana/data" - "grafana/etc" - "grafana/etc/provisioning" - "grafana/etc/dashboards" - "grafana/ssl" become: true - name: Deploy root certificate and key ansible.builtin.copy: content: | {{ hostvars['console']['ca']['root']['crt'] }} dest: "{{ node['home_path'] }}/containers/grafana/ssl/ilnmors_root_ca.crt" owner: "{{ grafana_subuid }}" group: "svadmins" mode: "0400" become: true notify: "notification_restart_grafana" no_log: true - name: Register secret value to podman secret containers.podman.podman_secret: name: "{{ item.name }}" data: "{{ item.value }}" state: "present" force: true loop: - name: "GF_DB_PASSWORD" value: "{{ hostvars['console']['postgresql']['password']['grafana'] }}" - name: "LDAP_BIND_PASSWORD" value: "{{ hostvars['console']['ldap']['password']['grafana'] }}" - name: "GF_ADMIN_PASSWORD" value: "{{ hostvars['console']['grafana']['user']['password'] }}" notify: "notification_restart_grafana" no_log: true - name: Deploy configruation files ansible.builtin.template: src: "{{ hostvars['console']['node']['config_path'] }}/services/containers/infra/grafana/etc/{{ item }}.j2" dest: "{{ node['home_path'] }}/containers/grafana/etc/{{ item }}" owner: "{{ grafana_subuid }}" group: "svadmins" mode: "0400" loop: - "grafana.ini" - "ldap.toml" become: true notify: "notification_restart_grafana" no_log: true - name: Deploy provisioing and dashboard files ansible.builtin.copy: src: "{{ hostvars['console']['node']['config_path'] }}/services/containers/infra/grafana/etc/provisioning/" dest: "{{ node['home_path'] }}/containers/grafana/etc/provisioning/" owner: "{{ grafana_subuid }}" group: "svadmins" mode: "0400" become: true notify: "notification_restart_grafana" - name: Deploy container file ansible.builtin.template: src: "{{ hostvars['console']['node']['config_path'] }}/services/containers/infra/grafana/grafana.container.j2" dest: "{{ node['home_path'] }}/.config/containers/systemd/grafana.container" owner: "{{ ansible_user }}" group: "svadmins" mode: "0644" notify: "notification_restart_grafana" - name: Enable grafana ansible.builtin.systemd: name: "grafana.service" state: "started" enabled: true daemon_reload: true scope: "user"