I had setup the ambari db on postgres.
Also i was using ranger and ranger KMS for advanced authorization and Encryption.
Few days back, my database crashed leaving it totally inaccessible.
Now, i want to know if there is any way to deploy a new ambari server for existing cluster.
The Ranger services however if don't work can be restored later.
I was using ambari 2.2.0 with HDP stack 2.4.3.
In order to restore services like Ambari which is dependent on the Ambari Database Data, you will need to have ambari DB dump collected in advance.
Support if you have any recently collected ambari DB dump then you can try the following approach to recover your ambari configs and cluster details.
Importing the DB dump to the DB
# su postgres -c 'psql -f /PATH/TO/latest_ambari_db_dump.sql -d ambari'
Assuming that your ambari "ambari.properties" file will already be pointing to the same Postgres DB host so you can simply start the ambari server after importing the DB dump insie the ambari DB.
# ambari-server start
If you have imported the ambari Postgres DB dump to a remote (non embedded postgres) then in that case you will have to run ambari-server setup and then choose option  PostgreSQL option and then provide the DB host / user/ schema ...etc
details to point ambari to use that DB.
# ambari-server setup Using python /usr/bin/python Setup ambari-server Checking SELinux... SELinux status is 'enabled' SELinux mode is 'permissive' WARNING: SELinux is set to 'permissive' mode and temporarily disabled. OK to continue [y/n] (y)? y Customize user account for ambari-server daemon [y/n] (n)? n Adjusting ambari-server permissions and ownership... Checking firewall status... Checking JDK... Do you want to change Oracle JDK [y/n] (n)? n Completing setup... Configuring database... Enter advanced database configuration [y/n] (n)? y Configuring database... ============================================================================== Choose one of the following options:  - PostgreSQL (Embedded)  - Oracle  - MySQL / MariaDB  - PostgreSQL  - Microsoft SQL Server (Tech Preview)  - SQL Anywhere  - BDB ============================================================================== Enter choice (4): 4 Hostname : yourambariDB.example.com Port (5432): 5432 Database name (ambari): ambari Postgres schema (ambari): ambari Username (ambari): ambari Enter Database Password (bigdata): bigdata Configuring ambari database... Configuring remote database connection properties... WARNING: Before starting Ambari Server, you must run the following DDL against the database to create the schema: /var/lib/ambari-server/resources/Ambari-DDL-Postgres-CREATE.sql Proceed with configuring remote database connection properties [y/n] (y)? n WARNING: Remote database setup aborted. Ambari Server 'setup' completed with warnings.