Giter VIP home page Giter VIP logo

ansible-postgresql-role's Introduction

PostgreSQL Ansible role Build Status

Ansible role which installs and configures PostgreSQL clusters, databases and users.

See role page on Ansible Galaxy.

Installation

This role has been tested on Ansible 2.3.0 and higher.

To install:

ansible-galaxy install trainline-eu.ansible_postgresql_role

Dependencies

No dependencies

Recommended dependencies:

Compatibility matrix

This table lists the tested version of OS/PostgreSQL couples.

Distribution / PostgreSQL 9.1 9.4 9.5 9.6 10 11
Debian 8.x ⛔ ✅
Debian 9.x ⛔ ✅
  • ✅ - tested, works fine
  • ❔ - will work in the future (help out if you can)
  • ⁉️ - maybe works, not tested
  • ⛔ - PostgreSQL has reached EOL

Variables

# Basic settings
postgres_listen_addresses: [ '127.0.0.1' ] # Optional
postgres_log_dir: '/home/postgres-logs'    # Optional
postgres_data_dir: '/home/postgres'        # Optional
postgres_clusters:                         # Mandatory
  - version: 11                              # Mandatory
    name: 'main'                             # Mandatory
    port: 5432                               # Mandatory
    checksums: True                          # Optional
    fsync_enabled: False                     # Optional
    archive_enabled: False                   # Optional
    # List of users to be created (optional)
    users:
      - username: 'replicator'                 # Mandatory
        password: 'SuperSecret'                # Mandatory
        permissions: 'REPLICATION'             # Mandatory
    # List of databases to be created (optional)
    databases:
      - dbname: my_database                    # Mandatory
        owner: john                            # Mandatory
        extensions:                            # Optional
          - names: [ 'postgis', 'postgis_topology' ]
            apt_deps: [ 'postgresql-11-postgis' ]

# Postgres config (Optional)
postgres_log_line_prefix: '%m [%p] database: %d host: %h user: %u '
postgres_datestyle: 'iso, dmy'
postgres_locale_formats: fr_FR.UTF-8
postgres_text_search_config: pg_catalog.french

# Postgres pg_hba config (optional)
postgres_allowed_hosts:
  - user: all
    range: 10.0.0.0/24
postgres_replication_hosts:
  - user: replicator
    range: 10.0.0.0/24

# Ansible related Configuration
postgres_become_method: su  # Optional

# Barman connectivity
postgres_barman_server: barman.example.com  # Required if at least one server has archive_enabled enabled
postgres_barman_rsync_enabled: False        # Optional
postgres_barman_rsync_options: ''           # Optional
postgres_barman_remote_user: barman         # Optional
postgres_barman_path_prefix: '~'            # Optional, required if using rsync

Testing

This project comes with a test/main.yml testing playbook. It uses Docker to provision containers locally and sets up a 3 node postgresql cluster with a barman server.

Coverage of this playbook is probably not complete but at least it's there.

If you are contributing, please first test your changes in a new playbook in the test/ directory within docker containers, (using the targeted distribution), and if possible, ensure your change is covered in the tests found in .travis.yml.

License

Licensed under the MIT License. See the LICENSE file for details.

Thanks

Creators:

Maintainers:

Feedback, bug-reports, requests, ...

Are welcome!

ansible-postgresql-role's People

Contributors

chtitux avatar kapouer avatar paulrbr avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.