forked from ISTI-ansible-roles/ansible-roles
library/roles/postgresql: Add a playbook to install pgpool. Only the package right now.
This commit is contained in:
parent
e7fa165d38
commit
59308c5e5c
|
@ -2,6 +2,9 @@
|
|||
|
||||
pg_use_postgresql_org_repo: True
|
||||
|
||||
psql_postgresql_install: True
|
||||
postgresql_enabled: True
|
||||
psql_pgpool_install: False
|
||||
# 9.3 is the default version for Ubuntu trusty
|
||||
# It is highly recommended to use the postgresql.org repositories
|
||||
#
|
||||
|
@ -39,7 +42,6 @@ postgresql_pkgs:
|
|||
- postgresql-client-'{{ psql_version }}'
|
||||
- pgtop
|
||||
|
||||
|
||||
psql_db_name: db_name
|
||||
psql_db_user: db_user
|
||||
psql_db_pwd: "We cannot save the password into the repository. Use another variable and change pgpass.j2 accordingly. Encrypt the file that contains the variable with ansible-vault"
|
||||
|
@ -72,3 +74,7 @@ pg_backup_use_nagios: "yes"
|
|||
# Example of line needed to manage the db accesses (used by iptables too), without creating the db and the user. Useful, for example, to give someone access to the postgresql db
|
||||
#- { name: '{{ psql_db_name }}', user: '{{ psql_db_user }}', allowed_hosts: [ 'xxx.xxx.xxx.xxx/32', 'yyy.yyy.yyy.yyy/32' ] }
|
||||
|
||||
pgpool_pkgs:
|
||||
- 'postgresql-{{ psql_version }}-pgpool2'
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
---
|
||||
- name: Restart postgresql
|
||||
service: name=postgresql state=restarted
|
||||
when: postgresql_enabled
|
||||
|
||||
- name: Reload postgresql
|
||||
service: name=postgresql state=reloaded
|
||||
when: postgresql_enabled
|
||||
|
|
|
@ -2,15 +2,27 @@
|
|||
- include: postgresql_org_repo.yml
|
||||
when: pg_use_postgresql_org_repo
|
||||
- include: packages.yml
|
||||
when: psql_postgresql_install
|
||||
- include: postgis.yml
|
||||
when: postgres_install_gis_extensions
|
||||
- include: postgresql-config.yml
|
||||
when: psql_postgresql_install
|
||||
- include: psql-kernel-sharedmem.yml
|
||||
when: psql_set_shared_memory
|
||||
when:
|
||||
- psql_postgresql_install
|
||||
- psql_set_shared_memory
|
||||
- include: configure-access.yml
|
||||
when: psql_db_data is defined
|
||||
when:
|
||||
- psql_postgresql_install
|
||||
- psql_db_data is defined
|
||||
- include: manage_pg_db.yml
|
||||
when: psql_db_data is defined
|
||||
when:
|
||||
- psql_postgresql_install
|
||||
- psql_db_data is defined
|
||||
- include: postgresql-backup.yml
|
||||
when: psql_db_data is defined
|
||||
when:
|
||||
- psql_postgresql_install
|
||||
- psql_db_data is defined
|
||||
- include: pgpool-ii.yml
|
||||
when: psql_pgpool_install
|
||||
|
||||
|
|
|
@ -1,24 +1,23 @@
|
|||
---
|
||||
- name: install the postgresql packages
|
||||
apt: pkg={{ item }} state=installed
|
||||
with_items: postgresql_pkgs
|
||||
notify:
|
||||
Restart postgresql
|
||||
tags:
|
||||
- postgresql
|
||||
- postgres
|
||||
with_items: '{{ postgresql_pkgs }}'
|
||||
notify: Restart postgresql
|
||||
tags: [ 'postgresql', 'postgres' ]
|
||||
|
||||
- name: Install the packages that ansible needs to manage the postgresql users and databases
|
||||
apt: pkg={{ item }} state=installed
|
||||
with_items:
|
||||
- python-psycopg2
|
||||
tags:
|
||||
- postgresql
|
||||
- postgres
|
||||
tags: [ 'postgresql', 'postgres' ]
|
||||
|
||||
- name: Ensure that the postgresql server is started
|
||||
service: name=postgresql state=started enabled=yes
|
||||
tags:
|
||||
- postgresql
|
||||
- postgres
|
||||
when: postgresql_enabled
|
||||
tags: [ 'postgresql', 'postgres' ]
|
||||
|
||||
- name: Ensure that the postgresql server is stopped and disabled
|
||||
service: name=postgresql state=stopped enabled=no
|
||||
when: not postgresql_enabled
|
||||
tags: [ 'postgresql', 'postgres' ]
|
||||
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
- name: Install the pgpool package
|
||||
apt: name={{ item }} state=installed
|
||||
with_items: '{{ pgpool_pkgs }}'
|
||||
tags: [ 'postgresql', 'pgpool' ]
|
||||
|
Loading…
Reference in New Issue