|
299 | 299 | backrefs: true
|
300 | 300 | loop:
|
301 | 301 | - { regexp: '^name:', line: 'name: {{ ansible_hostname }}' }
|
302 |
| - - { regexp: '^ listen: .*:8008$', line: ' listen: {{ hostvars[inventory_hostname].inventory_hostname }}:8008' } |
303 |
| - - { regexp: '^ connect_address: .*:8008$', line: ' connect_address: {{ hostvars[inventory_hostname].inventory_hostname }}:8008' } |
304 |
| - - { regexp: '^ listen: ((?!8008).)*$', line: ' listen: {{ hostvars[inventory_hostname].inventory_hostname }},127.0.0.1:{{ postgresql_port }}' } |
305 |
| - - { regexp: '^ connect_address: ((?!8008).)*$', line: ' connect_address: {{ hostvars[inventory_hostname].inventory_hostname }}:{{ postgresql_port }}' } |
| 302 | + - { regexp: '^ listen: .*:{{ patroni_restapi_port }}$', line: ' listen: {{ hostvars[inventory_hostname].inventory_hostname }}:{{ patroni_restapi_port }}' } |
| 303 | + - { regexp: '^ connect_address: .*:{{ patroni_restapi_port }}$', line: ' connect_address: {{ hostvars[inventory_hostname].inventory_hostname }}:{{ patroni_restapi_port }}' } |
| 304 | + - { regexp: '^ listen: ((?!{{ patroni_restapi_port }}).)*$', line: ' listen: {{ hostvars[inventory_hostname].inventory_hostname }},127.0.0.1:{{ postgresql_port }}' } |
| 305 | + - { regexp: '^ connect_address: ((?!{{ patroni_restapi_port }}).)*$', line: ' connect_address: {{ hostvars[inventory_hostname].inventory_hostname }}:{{ postgresql_port }}' } |
306 | 306 | loop_control:
|
307 | 307 | label: "{{ item.line }}"
|
308 | 308 | when: with_haproxy_load_balancing|bool or pgbouncer_install|bool or (cluster_vip is not defined or cluster_vip | length < 1)
|
|
315 | 315 | backrefs: true
|
316 | 316 | loop:
|
317 | 317 | - { regexp: '^name:', line: 'name: {{ ansible_hostname }}' }
|
318 |
| - - { regexp: '^ listen: .*:8008$', line: ' listen: {{ hostvars[inventory_hostname].inventory_hostname }}:8008' } |
319 |
| - - { regexp: '^ connect_address: .*:8008$', line: ' connect_address: {{ hostvars[inventory_hostname].inventory_hostname }}:8008' } |
320 |
| - - { regexp: '^ listen: ((?!8008).)*$', line: ' listen: {{ hostvars[inventory_hostname].inventory_hostname }},{{ cluster_vip }},127.0.0.1:{{ postgresql_port }}' } |
321 |
| - - { regexp: '^ connect_address: ((?!8008).)*$', line: ' connect_address: {{ hostvars[inventory_hostname].inventory_hostname }}:{{ postgresql_port }}' } |
| 318 | + - { regexp: '^ listen: .*:{{ patroni_restapi_port }}$', line: ' listen: {{ hostvars[inventory_hostname].inventory_hostname }}:{{ patroni_restapi_port }}' } |
| 319 | + - { regexp: '^ connect_address: .*:{{ patroni_restapi_port }}$', line: ' connect_address: {{ hostvars[inventory_hostname].inventory_hostname }}:{{ patroni_restapi_port }}' } |
| 320 | + - { regexp: '^ listen: ((?!{{ patroni_restapi_port }}).)*$', line: ' listen: {{ hostvars[inventory_hostname].inventory_hostname }},{{ cluster_vip }},127.0.0.1:{{ postgresql_port }}' } |
| 321 | + - { regexp: '^ connect_address: ((?!{{ patroni_restapi_port }}).)*$', line: ' connect_address: {{ hostvars[inventory_hostname].inventory_hostname }}:{{ postgresql_port }}' } |
322 | 322 | loop_control:
|
323 | 323 | label: "{{ item.line }}"
|
324 | 324 | when: not with_haproxy_load_balancing|bool and not pgbouncer_install|bool and (cluster_vip is defined and cluster_vip | length > 0)
|
|
779 | 779 | state: restarted
|
780 | 780 | enabled: true
|
781 | 781 |
|
782 |
| - - name: Wait for port 8008 to become open on the host |
| 782 | + - name: "Wait for port {{ patroni_restapi_port }} to become open on the host" |
783 | 783 | wait_for:
|
784 |
| - port: 8008 |
| 784 | + port: "{{ patroni_restapi_port }}" |
785 | 785 | host: "{{ hostvars[inventory_hostname]['inventory_hostname'] }}"
|
786 | 786 | state: started
|
787 | 787 | timeout: 120
|
|
813 | 813 |
|
814 | 814 | - name: Wait for the cluster to initialize (master is the leader with the lock)
|
815 | 815 | uri:
|
816 |
| - url: "http://{{ hostvars[inventory_hostname]['inventory_hostname'] }}:8008/leader" |
| 816 | + url: "http://{{ hostvars[inventory_hostname]['inventory_hostname'] }}:{{ patroni_restapi_port }}/leader" |
817 | 817 | status_code: 200
|
818 | 818 | register: result
|
819 | 819 | until: result.status == 200
|
|
946 | 946 | state: restarted
|
947 | 947 | enabled: true
|
948 | 948 |
|
949 |
| - - name: Wait for port 8008 to become open on the host |
| 949 | + - name: "Wait for port {{ patroni_restapi_port }} to become open on the host" |
950 | 950 | wait_for:
|
951 |
| - port: 8008 |
| 951 | + port: "{{ patroni_restapi_port }}" |
952 | 952 | host: "{{ hostvars[inventory_hostname]['inventory_hostname'] }}"
|
953 | 953 | state: started
|
954 | 954 | timeout: 120
|
|
957 | 957 |
|
958 | 958 | - name: Check that the patroni is healthy on the replica server
|
959 | 959 | uri:
|
960 |
| - url: "http://{{ hostvars[inventory_hostname]['inventory_hostname'] }}:8008/health" |
| 960 | + url: "http://{{ hostvars[inventory_hostname]['inventory_hostname'] }}:{{ patroni_restapi_port }}/health" |
961 | 961 | status_code: 200
|
962 | 962 | register: replica_result
|
963 | 963 | until: replica_result.status == 200
|
|
0 commit comments