Created
April 24, 2018 19:33
-
-
Save skamithi/73ee1a8fa26590af79e48f6290607cf0 to your computer and use it in GitHub Desktop.
installing postgres on 2nd postgres node
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: second_database | |
tasks: | |
- name: Find recovery.conf | |
find: | |
paths: /var/lib/pgsql | |
recurse: yes | |
patterns: recovery.conf | |
register: recovery_conf_path | |
- name: Remove recovery.conf | |
file: | |
path: "{{ item.path }}" | |
state: absent | |
with_items: "{{ recovery_conf_path.files }}" | |
- name: Add replica to database group | |
add_host: | |
name: "{{ inventory_hostname }}" | |
groups: database | |
tags: | |
- always | |
- import_role: | |
name: repos_el | |
when: ansible_os_family == "RedHat" | |
- import_role: | |
name: packages_el | |
vars: | |
packages_el_install_tower: false | |
packages_el_install_postgres: true | |
when: ansible_os_family == "RedHat" | |
- import_role: | |
name: postgres | |
vars: | |
postgres_allowed_ipv4: "0.0.0.0/0" | |
postgres_allowed_ipv6: "::/0" | |
postgres_username: "{{ pg_username }}" | |
postgres_password: "{{ pg_password }}" | |
postgres_database: "{{ pg_database }}" | |
max_postgres_connections: 1024 | |
postgres_shared_memory_size: "{{ (ansible_memtotal_mb*0.3)|int }}" | |
postgres_work_mem: "{{ (ansible_memtotal_mb*0.03)|int }}" | |
postgres_maintenance_work_mem: "{{ (ansible_memtotal_mb*0.04)|int }}" | |
tags: | |
- postgresql_database | |
- import_role: | |
name: firewall | |
vars: | |
firewalld_http_port: "{{ nginx_http_port }}" | |
firewalld_https_port: "{{ nginx_https_port }}" | |
tags: | |
- firewall | |
when: ansible_os_family == 'RedHat' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[second_database] | |
postgres | |
[all:vars] | |
pg_username=awx | |
pg_password=1q2w3e | |
pg_database=awx |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment