In the next article, I discuss how to Backup and restore PostgreSQL databases with Ansible using a database dump. We have seen how to install and configure a PostgreSQL database with a database user, and how to run an initial SQL migration (or any other SQL script). Service : name=postgresql state=restarted name : "Find out if PostgreSQL is initialized" ![]() Let's now create the Ansible playbook! First, we need to install the database itself, along with psycopg2-binary Python library that will allow us to use Ansible PostgreSQL modules postgresql_db, postgresql_user, postgresql_privs and postgresql_pg_hba. On Centos 8, the default firewall service needs to be enabled if you expect to connect to Postgres from a remote computer. Just create ansible.cfg and hosts.ini files with the proper connection information, or modify the playbook itself. The playbook expects that we configure the target machines using an inventory file. Therefore, this tutorial will use the official Postgres repository. PostgreSQL delivers many advanced utilities, including materialized views. Advantages and Disadvantages of PostgreSQL. If you have not already done so, create a Linode account and Compute Instance. ![]() But as of the writing of this tutorial, the version that is available in the CentOS 7 Base repository is obsolete. Install and Use PostgreSQL on CentOS 8 Before You Begin. When needed, use Ansible Vault or environment variables when running the playbook. Postgres can be installed using default CentOS repositories. In other cases, most Linux systems also make it easy to build. When available, this is the recommended way to install PostgreSQL, since it provides proper integration with the operating system, including automatic patching and other management functionality. Note that storing passwords in plain text is not the best idea. PostgreSQL is available integrated with the package management on most Linux platforms.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |