diff --git a/playbooks/deploy_grafana.yml.ansible b/playbooks/deploy_grafana.yml.ansible index c2cb59b..f3819f0 100644 --- a/playbooks/deploy_grafana.yml.ansible +++ b/playbooks/deploy_grafana.yml.ansible @@ -1,6 +1,33 @@ -- name: Gather facts from all hosts - hosts: grafana_servers +- hosts: + - grafana + - postgresql + gather_facts: true + become: true + tasks: + - name: Create List with right interface + ansible.builtin.set_fact: + node_ips_eth0: "{{ groups['gitea'] | map('extract', hostvars, ['ansible_facts', 'eth0', 'ipv4', 'address']) }}" + + - name: Fügen Sie die Gitea pg_hba Einträge zur Patroni-Liste hinzu + ansible.builtin.set_fact: + # Fügt die neuen Zeilen zur Liste hinzu + postgresql_additional_pg_hba: "{{ postgresql_additional_pg_hba | default([]) + ['host ' + gitea_db_name + ' ' + gitea_db_user + ' ' + item + '/32 scram-sha-256'] }}" + loop: "{{ node_ips_eth0 }}" + run_once: true + + - name: Update Patroni Configuration with new pg_hba entries + ansible.builtin.include_role: + name: postgresql + tasks_from: add_app_database.yml.ansible + vars: + postgresql_App_db_owner: "{{ grafana_db_user }}" + postgresql_App_db_owner_password: "{{ grafana_db_password }}" + postgresql_App_db_name: "{{ grafana_db_name }}" + +- hosts: + - grafana gather_facts: true become: true roles: - grafana + - handlers \ No newline at end of file