Document Properties
Kbid
28602D
Last Modified
08-Dec-2022
Added to KB
16-May-2018
Public Access
Everyone
Status
Online
Doc Type
References
Product
  • IOM 3.0
  • IOM 3.1
  • IOM 3.2
  • IOM 3.3
  • IOM 3.4
  • IOM 3.5
  • IOM 3.6
  • IOM 3.7
  • IOM 4.0
  • IOM 4.1
  • IOM 4.2
  • IOM 4.3
  • IOM 4.4
Process - Setup Postgres Server 1.1

Table of Contents

Product Version

2.2

Product To Version

 
Status

New Labels

Process

DescriptionThe process setup_pgserver installs a simple PostgreSQL-server, without any high-availabilty features. It can be used by IOM application-servers.
Example: setup postgresql server
ANSIBLE_LIBRARY=<path to Ansible4IOM>/modules/ ANSIBLE_ROLES_PATH=<path to Ansible4IOM>/roles/ ansible-playbook -i <path to inventory file>/inventory <path to Ansible4IOM>/processes/setup_pgserver.yml

Steps

The process consists of the following steps:

  1. pgrepo_install
    1. Install PostgreSQL repository.
  2. pgclient_install
    1. Install PG client yum package.
  3. pgserver_install
    1. Stop/disable PostgreSQL service.
    2. Install yum packages.
    3. Initialize PostgreSQL server.
  4. pgserver_configure
    1. Stop/disable PostgreSQL service.
    2. Install initial pg_hba.conf in order to allow setting superusers password.
    3. Set default values in postgresql.conf.
    4. Start/enable service (wait for DB to get ready).
    5. Update superusers password.
    6. Install productive pg_hba.conf in order to restrict access as much as possible.
    7. Run post_pgserver_configuration_hook.
    8. Restart service to apply changes.

Background Information

The process setup_pgserver installs a PostgreSQL server. Primarily the process is controlled by variables defined in roles/pgserver_config/defaults. Please have a look into the according file to get information about which variables are available.

Additionally, the process setup_pgserver executes hook post_pgserver_configuration_hook, which allows custom configuration changes of PostgreSQL-server besides predefined variables.

To use a server installed this way, a database account suitable for IOM has to be created. The creation of the account is covered by Process - Setup or Reconfigure Database Account.

Examples

Use a Custom Data Directory

The data directory is defined by variable PGSERVER_DATA at roles/pgserver_config/defaults. Add this variable to the inventory and give it a new value. Also see Concept - Ansible4IOM Server Configuration Management 1.0 - 1.1.

inventory file: change setting of variable PGSERVER_DATA
...
[all:vars]
PGSERVER_DATA="/ha-raid/pg-data"
...

The according directory can be created before running the setup process.

Now the process setup_pgserver can be executed.

Example: setup postgresql server
ANSIBLE_LIBRARY=<path to Ansible4IOM>/modules/ ANSIBLE_ROLES_PATH=<path to Ansible4IOM>/roles/ ansible-playbook -i <path to inventory file> <path to Ansible4IOM>/processes/setup_pgserver.yml

Use a Custom Setting for max_connections in postgresql.conf

To set database server settings besides predefined variables, the hook post_pgserver_configuration_hook has to be implemented. Depending on the scope of the hook (project or installation), the file post_pgserver_configuration_hook.yml has to be stored in the directory global_hooks or installation_hooks. Also see Concept - Ansible4IOM Server Configuration Management 1.0 - 1.1.

Note

It is important to use variables PGSERVER_DATA and PGServerOSUser (see roles/pgserver_config/defaults) for a robust implementation of the hook.
post_pgserver_configuration_hook.yml
- name: update postgreSQL configuration
  ini_file:
    dest: "{{PGSERVER_DATA}}/postgresql.conf"
    section: ""
    option: "{{item.option}}"
    value: "{{item.value}}"
  with_items:
    - { option: max_connections, value: 500 }
  become: true
  become_user: "{{PGServerOSUser}}"

Now the process setup_pgserver can be executed.

Example: setup postgresql server
ANSIBLE_LIBRARY=<path to Ansible4IOM>/modules/ ANSIBLE_ROLES_PATH=<path to Ansible4IOM>/roles/ ansible-playbook -i <path to inventory file> <path to Ansible4IOM>/processes/setup_pgserver.yml
Disclaimer

The information provided in the Knowledge Base may not be applicable to all systems and situations. Intershop Communications will not be liable to any party for any direct or indirect damages resulting from the use of the Customer Support section of the Intershop Corporate Web site, including, without limitation, any lost profits, business interruption, loss of programs or other data on your information handling system.

Customer Support
Knowledge Base
Product Resources
Tickets