add db task to playbook
Some checks failed
🏃‍♂️Run Ansible / install_ansible (push) Failing after 2m1s

This commit is contained in:
master of disaster
2025-12-18 00:33:55 +01:00
parent 4dccc527b6
commit 20644e85a2

View File

@@ -1,6 +1,33 @@
- name: Gather facts from all hosts - hosts:
hosts: grafana_servers - 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 gather_facts: true
become: true become: true
roles: roles:
- grafana - grafana
- handlers