No Description

Edin Sarajlic dfec5e0897 README: note that role is currently being developed for Debian Jessie 2 years ago
defaults fa8aae93e4 Do not hard code values in the Postgres create DB task. Use Ansible variables that the user can override 2 years ago
handlers 475b5f231e Initial commit 4 years ago
tasks fa8aae93e4 Do not hard code values in the Postgres create DB task. Use Ansible variables that the user can override 2 years ago
README dfec5e0897 README: note that role is currently being developed for Debian Jessie 2 years ago

README

Created for Debian servers. Currently being developed for Debian
Jessie.

A role for creating a Postgresql server.

Clone this git repo into your Ansible's role directory, e.g.:

git clone ansible-postgresqlserver.git roles/postgresqlserver

This role performs the following actions:
- Installs the Postgresql server software
- Installs 'autopostgresqlbackup' (default config performs nightly backups of all DBs)
- Installs 'psycopg2' (allows Ansible to perform tasks on the Postgresql server)

--

The provided task "deploy_custom_config.yml" copies files from the
source (Ansible server) to the destination (Postgresql server)

This allows you to centrally manage (and easily version control) files
that may be unique per-host, such as pg_hba.conf

Once ANY file(s) have been copied across, the Postgresql server is
reloaded.

Variables to define:

Config source, as defined by the variable:
postgresqlserver_custom_config_src
e.g. "{{ inventory_hostname }}/etc/postgresql/"

Config destination, as defined by the variable:
postgresqlserver_custom_config_dst
defaults to /etc/postgresql/

--
NOTE: The below task is provided for convenience, use with discretion.

This role provides an optional task (setup_app_db.yml) that can be
used to bootstrap a database, user, and privileges - as required by
*most* types of webapps.

Variables to define:
db_name - The name of the database to create
db_username - The username of the user to create for the above database instance
db_password - The password of the above user

To use the task, create a play for each database/user/privilege combo you require, e.g.:
- name: Database for ExampleCMS for MyWebsite
hosts: mywebsitehost

roles:
- postgresqlserver

tasks:
- include: roles/postgresqlserver/tasks/setup_app_db.yml

vars:
db_name: ecms_mywebsite
db_username: ecms_mywebsite_user
db_password: supersecretpassword