Document Properties
Kbid
2860E9
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 - Reconfigure Postgres Server 1.1

Table of Contents

Product Version

2.2

Product To Version

 
Status

New Labels

Process

DescriptionThe process reconfigure_pgserver updates selected PostgreSQL settings of a database installed before using Process - Setup Postgres Server. Since reconfiguration of the database server requires restart of the database server, the process forces a downtime of the whole IOM system.
Example: reconfigure postgresql server
ANSIBLE_LIBRARY=Ansible4IOM/modules/ ANSIBLE_ROLES_PATH=Ansible4IOM/roles/ ansible-playbook -i config-repos/oms-plain/distributed_azure_2.2/inventory Ansible4IOM/processes/reconfigure_pgserver.yml

Steps

The process consists of the following steps:

  1. pgserver_configure
    1. Stop/disable 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.
  2. omsdb_initialization
    1. Create/update db user.
    2. Create/update database.

Background Information

The process reconfigure_pgserver updates selected configurations of an already installed PostgreSQL server. Primarily, the process is able to apply changes made to variables defined in roles/pgserver_config/defaults. Please have a look into the according file to get information about which variables might be changed after initial setup and which not.

Additionally, the process reconfigure_pgserver executes the hook post_pgserver_configuration_hook, which allows configuration changes besides predefined variables.

In a second step, the process reconfigure_pgserver reruns the role omsdb_initialization too. This enables to change settings defined in roles/omsdb_initialization/defaults. Please have a look into the according file, to get more information. Finally, the only settings to be changed during process reconfigure_pgserver, are user and password of the IOM database account, which can be controlled by variables is_oms_db_user and is_oms_db_pass (roles/oms_config/defaults).

Examples

Change the Password of the SuperUser

The password of the superuser is defined by variable PGSERVER_SUPERUSER_PASSWD 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_SUPERUSER_PASSWD
...
[all:vars]
PGSERVER_SUPERUSER_PASSWD="NewPa22w0r6"
...

Now the process reconfigure_pgserver can be executed.

Example: reconfigure 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/reconfigure_pgserver.yml

Change Port of Database Server

The port of the database server is defined by the variable PGSERVER_PORT at roles/pgserver_config/defaults. Add this variable to the inventory and give it a new value. According to the separation of components, IOM application servers need to be reconfigured to. Access of application-servers to the database is controlled by the property is.oms.db.hostlist in cluster.properties, which is reflected by variable is_oms_db_hostlist (defined at roles/oms_config/defaults). Hence this variable has to be adapted too. Also see Concept - Ansible4IOM Server Configuration Management 1.0 - 1.1.

inventory file: change setting of variables PGSERVER_SUPERUSER_PASSWD, is_oms_db_hostlist
...
[all:vars]
PGSERVER_PORT=5433
is_oms_db_hostlist="localhost:5433"
...

Now the process reconfigure_pgserver can be executed. Since IOM settings had to be changed too, the process reconfigure_oms_node needs to be run afterwards.

Example: reconfigure 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/reconfigure_pgserver.yml
ANSIBLE_LIBRARY=<path to Ansible4IOM>/modules/ ANSIBLE_ROLES_PATH=<path to Ansible4IOM>/roles/ ansible-playbook -i <path to inventory file> <path to Ansible4IOM>/processes/reconfigure_oms_node.yml

Change max_connections Setting in postgresql.conf

To change 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.

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 process reconfigure_pgserver can be executed.

Example: reconfigure 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/reconfigure_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