First stab at autogenerating replication ips for pg_hba

This commit is contained in:
Kevin Fenzi 2016-10-17 19:22:41 +00:00
parent a5894c93be
commit eb69def46c
3 changed files with 21 additions and 1 deletions

View file

@ -273,6 +273,12 @@ db-qastg01.qa.fedoraproject.org
db-fas01.stg.phx2.fedoraproject.org
db01.stg.phx2.fedoraproject.org
db03.stg.phx2.fedoraproject.org
# postgresql bidirectional replication servers
[pgbdr]
# postgresql bidirectional replication servers (stg)
[pgbdr-stg]
db-koji01.stg.phx2.fedoraproject.org
db-koji02.stg.phx2.fedoraproject.org
pgbdr01.stg.phx2.fedoraproject.org

View file

@ -51,7 +51,7 @@
- postgresql
- name: Add our postgres config file.
copy: >
template: >
src={{ item }}
dest=/var/lib/pgsql/9.4-bdr/data/{{ item }}
owner=postgres

View file

@ -76,6 +76,20 @@ host all all 0.0.0.0 0.0.0.0 md5
# Note, I can't think of a reason to make this more restrictive than ipv4 but
# only fakefas needs it so far
host all all ::1/128 md5
{% for host in groups['pgbdr-stg']|sort %}
# staging replication hosts
{% if 'eth0_ip' in hostvars[host] %}# {{ host }}
host replication all {{ hostvars[host]['eth0_ip'] }} md5
{% else %}# {{ host }} has no 'eth0_ip' listed
{% endif %}
{% endfor %}
{% for host in groups['pgbdr']|sort %}
# production replication hosts
{% if 'eth0_ip' in hostvars[host] %}# {{ host }}
host replication all {{ hostvars[host]['eth0_ip'] }} md5
{% else %}# {{ host }} has no 'eth0_ip' listed
{% endif %}
{% endfor %}
host all all 10.5.126.188/32 trust
host all all 10.5.126.189/32 trust
host replication all 10.5.126.188/32 trust