If you change your postgres listen address, the reconfigure will fail until you restart postgres

ZD Ticket were first realized: https://gitlab.zendesk.com/agent/tickets/82687

* template[/var/opt/gitlab/postgresql/data/postgresql.conf] action create
    - update content in file /var/opt/gitlab/postgresql/data/postgresql.conf from 5f5a5d to 29a794
    --- /var/opt/gitlab/postgresql/data/postgresql.conf	2017-08-15 21:44:50.661566500 +0000
    +++ /var/opt/gitlab/postgresql/data/.chef-postgresql.conf20170921-21901-xvpi62	2017-09-21 16:26:48.877799299 +0000
    @@ -60,7 +60,7 @@
     
     # - Connection Settings -
     
    -listen_addresses = ''    # what IP address(es) to listen on;
    +listen_addresses = '159.XXX.165.XXX'    # what IP address(es) to listen on;
               # comma-separated list of addresses;
               # defaults to 'localhost', '*' = all
               # (change requires restart)
  * execute[reload postgresql] action run
    - execute /opt/gitlab/bin/gitlab-ctl hup postgresql
  * execute[start postgresql] action run (skipped due to not_if)

Fails due to migrations not being able to connect:

 ================================================================================
    Error executing action `run` on resource 'bash[migrate gitlab-rails database]'
    ================================================================================
    
    Mixlib::ShellOut::ShellCommandFailed
    ------------------------------------
    Expected process to exit with [0], but received '1'
    ---- Begin output of "bash"  "/tmp/chef-script20170921-21901-1629s3o" ----
    STDOUT: rake aborted!
    PG::ConnectionBad: could not connect to server: Connection refused
    	Is the server running on host "159.XXX.165.XXX" and accepting
    	TCP/IP connections on port 5432?
    /opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:49:in `block (3 levels) in <top (required)>'
    /opt/gitlab/embedded/bin/bundle:22:in `load'
    /opt/gitlab/embedded/bin/bundle:22:in `<main>'
    Tasks: TOP => gitlab:db:configure
    (See full trace by running task with --trace)
    STDERR: 
    ---- End output of "bash"  "/tmp/chef-script20170921-21901-1629s3o" ----
# netstat -lpnt | grep postgres
tcp        0      0 127.0.0.1:9187          0.0.0.0:*               LISTEN      29639/postgres_expo
# gitlab-ctl restart postgresql
ok: run: postgresql: (pid 23962) 1s
# netstat -lpnt | grep postgres
tcp        0      0 159.XXX.165.XXX:5432    0.0.0.0:*               LISTEN      23962/postgres  
tcp        0      0 127.0.0.1:9187          0.0.0.0:*               LISTEN      29639/postgres_expo

Now reconfigures will apply cleanly. This is affecting geo instructions so definitely a priority to fix.