Skip to content

Commit

Permalink
test database
Browse files Browse the repository at this point in the history
  • Loading branch information
bbaassssiiee committed Jan 7, 2018
1 parent 769ba94 commit 90e7bee
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 10 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ Role Variables
The first three vars you must set, the others are optional.

base_postgres_mip # This is the ip address of the primary or master database
base_postgres_user # This is your user
base_postgres_pass # This is your password
vault_postgres_user # This is your user stored in vault file
vault_postgres_pass # This is your password stored in vault file

base_postgres_net # 192.168.20.0/24 This is the subnet granted access
base_postgres_role # If you want 2 hosts then one is master, the other slave
base_postgres_role # If you want 2 hosts then one is master, the other slave
base_postgres_sip # The ip address of the slave when you use 2 databases


Expand Down Expand Up @@ -52,7 +52,7 @@ Including an example of how to use your role (for instance, with variables passe
- include: dbservers/pre_tasks.yml

roles:
- bbaassssiiee.base_postgres_role
- dockpack.base_postgres_role
- rsyslog

tasks: []
Expand All @@ -68,5 +68,5 @@ BSD, MIT
Author Information
------------------
http://twitter.com/bbaassssiiee
https://github.com/bbaassssiiee/base_postgres_role.git
https://github.com/dockpack/base_postgres_role.git

4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# these python extensions are required for testing
ansible==2.3.0
ansible==2.3.2
yamllint==1.8.1
ansible-lint==3.4.5
ansible-lint==3.4.15
molecule==1.25.1
docker
26 changes: 26 additions & 0 deletions tasks/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,32 @@
- postgres
- bash

- name: 'make sure .bash_profile exists'
become: no
file: path=.bash_profile state=file
tags:
- postgres
- bash

- name: 'amend path variable'
become: no
lineinfile: dest=.bash_profile
line='export PATH=$PATH:/usr/pgsql-{{ base_postgres_m }}/bin'
state=present
tags:
- postgres
- bash

- name: 'createdb for testing'
become: no
postgresql_db:
name: "{{ ansible_user }}"

tags:
- install
- init
- postgres

- name: 'init postgresql database'
command: /etc/init.d/postgresql-{{ base_postgres_m }} initdb creates=/var/lib/pgsql/{{ base_postgres_m }}/data/postgresql.conf
become: yes
Expand Down
4 changes: 1 addition & 3 deletions templates/pg_hba.conf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,5 @@ host replication all {{ base_postgres_mip }}/32 trust
# The database needs access to the database slave
{% endif %}

{% if pg_subnet is defined %}
# The application needs access to the database
host all all {{ base_postgres_net }} password
{% endif %}
host all all {{ base_postgres_net|default('same_net') }} password
5 changes: 5 additions & 0 deletions vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---

base_postgres_user: "{{ vault_postgres_user }}"
base_postgres_pass: "{{ vault_postgres_pass }}"

0 comments on commit 90e7bee

Please sign in to comment.