add db task to playbook
Some checks failed
🏃♂️Run Ansible / install_ansible (push) Failing after 2m1s
Some checks failed
🏃♂️Run Ansible / install_ansible (push) Failing after 2m1s
This commit is contained in:
@@ -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
|
||||||
Reference in New Issue
Block a user