--- - name: Configure listen on IP addresses ansible.builtin.lineinfile: path: /var/lib/pgsql/data/postgresql.conf regexp: '^\s*listen_addresses\s*=' insertafter: '#\s*listen_addresses\s*=' line: "listen_addresses = 'localhost, {{ postgresql_listen_address }}'" when: postgresql_listen_address | trim != '' notify: - restart postgresql - name: Configure max connections number ansible.builtin.lineinfile: path: /var/lib/pgsql/data/postgresql.conf regexp: '^\s*max_connections\s*=' insertafter: '#\s*max_connections\s*=' line: "max_connections = {{ postgresql_max_connections }}" when: postgresql_max_connections is defined notify: - restart postgresql - name: Configure password encryption algorithm ansible.builtin.lineinfile: path: /var/lib/pgsql/data/postgresql.conf regexp: '^\s*password_encryption\s*=' insertafter: '#\s*password_encryption\s*=' line: "password_encryption = {{ postgresql_password_encryption }}" when: postgresql_password_encryption in ('scram-sha-256', 'md5') notify: - restart postgresql