Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions deploy/playbooks/ansible.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[defaults]
retry_files_enabled = False
stdout_callback=debug

[ssh_connection]
pipelining=True
1 change: 0 additions & 1 deletion deploy/playbooks/roles/common/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---

- name: reload systemd
become: true
become: true
command: systemctl daemon-reload

Expand Down
6 changes: 3 additions & 3 deletions deploy/playbooks/roles/common/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,14 @@
notify:
- restart app

- include: postgresql.yml
- import_tasks: postgresql.yml
tags:
- postgres

- include: systemd.yml
- import_tasks: systemd.yml
tags:
- systemd

- include: nginx.yml
- import_tasks: nginx.yml
tags:
- nginx
4 changes: 2 additions & 2 deletions deploy/playbooks/roles/common/tasks/nginx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
notify:
- restart nginx

- include: ssl.yml
- import_tasks: ssl.yml
when: development_server == true

- name: check to see if ssl cert needs created
Expand All @@ -46,7 +46,7 @@
become: true
register: ssl_cert

- include: letsencrypt.yml
- import_tasks: letsencrypt.yml
when: development_server == false and not ssl_cert.stat.exists

- name: link nginx config
Expand Down
2 changes: 1 addition & 1 deletion deploy/playbooks/roles/common/tasks/postgresql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
become: true

- name: generate pseudo-random password for the postgres {{ app_name }} user
local_action: shell python -c "exec 'import os; print os.urandom(30).encode(\'base64\')[:${length}]'" | tee {{ playbook_dir }}/tmp/app_user_password
local_action: shell python3 -c "exec('import os,base64; print(base64.b64encode(os.urandom(30))[:${length}].decode())')" | tee {{ playbook_dir }}/tmp/app_user_password
register: generated_app_user_password
changed_when: false
when: "'postgresql_master' in group_names"
Expand Down
2 changes: 1 addition & 1 deletion deploy/playbooks/roles/common/templates/prod_db.py.j2
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ sqlalchemy_w = {
}

sqlalchemy_ro = {
'url': 'postgresql+psycopg2://{{ app_name }}:{{ postgresql_app_user_password }}@{{ standby_ip }}/{{ app_name }}',
'url': 'postgresql+psycopg2://{{ app_name }}:{{ postgresql_app_user_password }}@{{ master_ip }}/{{ app_name }}',
'echo': False,
'echo_pool': False,
'pool_recycle': 3600,
Expand Down
10 changes: 5 additions & 5 deletions deploy/playbooks/roles/common/vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
---

system_packages:
- python-dev
- python3-dev
- git
- python-virtualenv
- g++
- gcc
- libpq-dev
- postgresql
- postgresql-common
- postgresql-contrib
- python-psycopg2
- python3-psycopg2
- nginx
- vim
# needed for the ansible apt_repository module
- python-apt
- python3-apt
# - libsemanage-python
- python
- python3
- python3-virtualenv

ssl_requirements:
- openssl
Expand Down
3 changes: 1 addition & 2 deletions deploy/playbooks/roles/postgresql/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---

postgresql_version: 9.5
postgresql_version: 16
postgresql_superuser: postgres
postgresql_cluster_name: main

Expand Down Expand Up @@ -175,7 +175,6 @@ postgresql_cfg_ssl_key_file: '/etc/ssl/private/ssl-cert-snakeoil.key'
#postgresql_cfg_ssl_renegotiation_limit:
#postgresql_cfg_standard_conforming_strings:
#postgresql_cfg_statement_timeout:
postgresql_cfg_stats_temp_directory: '/var/run/postgresql/{{ postgresql_version }}-{{ postgresql_cluster_name }}.pg_stat_tmp'
#postgresql_cfg_superuser_reserved_connections: 3
#postgresql_cfg_synchronize_seqscans:
#postgresql_cfg_synchronous_commit:
Expand Down
4 changes: 2 additions & 2 deletions deploy/playbooks/roles/postgresql/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
become: true
apt:
pkg: "postgresql-{{ postgresql_version }}"
state: installed
state: present
update_cache: yes
cache_valid_time: 3600

Expand All @@ -14,5 +14,5 @@
state: present
update_cache: yes
cache_valid_time: 3600
with_items: common_packages
with_items: "{{ common_packages }}"
become: true
9 changes: 3 additions & 6 deletions deploy/playbooks/roles/postgresql/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
---

- include: install.yml
- import_tasks: install.yml

- name: ensure database service is up
service:
name: postgresql
state: started
become: true

- include: users.yml
- import_tasks: users.yml
when: "'postgresql_master' in group_names"

- include: configure.yml
- import_tasks: configure.yml
when: "'postgresql_master' in group_names"

- name: make {{ app_name }} database
Expand All @@ -22,6 +22,3 @@
when: "'postgresql_master' in group_names"
become_user: postgres
become: true

- include: standby.yml
when: "'postgresql_standby' in group_names"
50 changes: 0 additions & 50 deletions deploy/playbooks/roles/postgresql/tasks/standby.yml

This file was deleted.

2 changes: 1 addition & 1 deletion deploy/playbooks/roles/postgresql/tasks/users.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---

- name: generate pseudo-random password for the postgres replication user
local_action: shell python -c "exec 'import os; print os.urandom(30).encode(\'base64\')[:${length}]'" | tee {{ playbook_dir }}/tmp/replication_user_password
local_action: shell python -c "exec('import os,base64; print(base64.b64encode(os.urandom(30))[:${length}].decode())')" | tee {{ playbook_dir }}/tmp/replication_user_password
register: generated_replication_user_password
changed_when: false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,7 @@ xmlbinary = '{{ postgresql_cfg_xmlbinary }}'
xmloption = '{{ postgresql_cfg_xmloption }}'
{% endif %}


#------------------------------------------------------------------------------
# CUSTOMIZED OPTIONS
#------------------------------------------------------------------------------
Expand Down
4 changes: 0 additions & 4 deletions deploy/playbooks/roles/postgresql/templates/recovery.conf.j2

This file was deleted.

2 changes: 1 addition & 1 deletion deploy/playbooks/roles/postgresql/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ common_packages:
- libpq-dev
- postgresql-common
- postgresql-contrib
- python-psycopg2
- python3-psycopg2
Loading