Skip to content

while-true-do/ansible-role-srv_postgresql

Repository files navigation

Github (tag) Github (license) Github (issues) Github (pull requests)

Travis (com)

Ansible (min. version) Ansible (platforms) Ansible (tags)

Ansible Role: srv_postgresql

An Ansible Role to install and configure postgresql.

Motivation

Postgresql is a very common database server, used by many applications, teams and companies.

Description

This role installs and configures postgresql.

  • install postgresql
  • configure postgresql user
  • configure hba access

Requirements

Used Modules:

Installation

Install from Ansible Galaxy

ansible-galaxy install while_true_do.srv_postgresql

Install from Github

git clone https://github.com/while-true-do/ansible-role-srv_postgresql.git while_true_do.srv_postgresql

Usage

Role Variables

---
# defaults file for while_true_do.srv_postgresql

## Package Management
wtd_srv_postgresql_package:
  - postgresql-server
  - postgresql-contrib
# State can be present|latest|absent
wtd_srv_postgresql_package_state: "present"

## User Management
# This user will also be ths postgres super user
wtd_srv_postgresql_user:
  name: "postgres"
  group: "postgres"

## Configuration Management
wtd_srv_postgresql_conf_data: "/var/lib/pgsql/data"
# For local connections via postgres_user defaults will be set
wtd_srv_postgresql_conf_hba: []
# - type: "local"
#   database: "all"
#   user: "all"
#   method: "peer"
# - type: "host"
#   database: "somedatabase"
#   user: "someuser"
#   address: "192.168.10.0/24"
#   method: "ident"

## Service Management
wtd_srv_postgresql_service: "postgresql"
# State can be started|stopped
wtd_srv_postgresql_service_state: "started"
wtd_srv_postgresql_service_enabled: true

## Firewalld Management
wtd_srv_postgresql_fw_mgmt: true
wtd_srv_postgresql_fw_service: "postgresql"
# State can be enabled|disabled
wtd_srv_postgresql_fw_state: "enabled"
# Zone can be according to defined zones on your machine.
wtd_srv_postgresql_fw_zone: "public"

Example Playbook

Running Ansible Roles can be done in a playbook.

Simple

---
- hosts: all
  roles:
    - role: while_true_do.srv_postgresql

Known Issues

  1. RedHat Testing is currently not possible in public, due to limitations in subscriptions.
  2. Some services and features cannot be tested properly, due to limitations in docker.

Testing

Most of the "generic" tests are located in the Test Library.

Ansible specific testing is done with Molecule.

Infrastructure testing is done with testinfra.

Automated testing is done with Travis CI.

Contribute

Thank you so much for considering to contribute. We are very happy, when somebody is joining the hard work. Please fell free to open Bugs, Feature Requests or Pull Requests after reading the Contribution Guideline.

See who has contributed already in the kudos.txt.

License

This work is licensed under a BSD-3-Clause License.

Contact