patches.yml 1.14 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
---

- name: Configure PostgreSQL listen address and authorization in pg_hba.conf on Ubuntu
  block:
#    - name: Configure hostname on Ubuntu
#      hostname:
#        name: "{{ ansible_hostname }}.{{ domain_name }}" 
#        use: systemd 

#    - name: Configure /etc/hosts on Ubuntu
#      lineinfile:
#        path: /etc/hosts
#        insertafter: EOF
#        line: "{{ ansible_default_ipv4.address }}\t{{ ansible_nodename }}\t{{ ansible_hostname }}"
#        backup: yes
#        state: present

    - name: Configure PostgreSQL listen address on Ubuntu
      lineinfile:
        path: "/etc/postgresql/{{ postgresql_version.version.major }}/{{ cluster_name }}/postgresql.conf"
        regexp: '^#listen_addresses ='
        line: 'listen_addresses = {{ ansible_nodename }}'
        backrefs: yes
        backup: yes

    - name: Set autorization in pg_hba.conf on Ubuntu
      postgresql_pg_hba:
        dest: /etc/postgresql/{{ postgresql_version.version.major }}/{{ cluster_name }}/pg_hba.conf
        databases: "{{ database_name }}"
        users: "{{ database_user }}"
        address: "{{ provider_ip }}/24"
        contype: host
        method: trust

...