This commit is contained in:
dima 2024-11-18 23:52:42 +03:00
parent 293bf6d004
commit 3bf99fc8f0
8 changed files with 30 additions and 22 deletions

View File

@ -2,3 +2,4 @@
inventory = inventory.yml
roles_path = ./roles
force_color = true
interpreter_python = /usr/bin/python3

View File

@ -1,6 +1,4 @@
all:
children:
postgres_servers:
hosts:
192.168.0.71:
ansible_user: ansible
hosts:
192.168.0.71:
ansible_user: ansible

View File

@ -1,4 +1,4 @@
- name: Configure postgresql.conf with template
- name: Configure postgresql.conf
template:
src: postgresql.conf.j2
dest: /var/lib/pgsql/data/postgresql.conf
@ -7,7 +7,7 @@
mode: '0644'
notify: Restart PostgreSQL
- name: Configure pg_hba.conf with template
- name: Configure pg_hba.conf
template:
src: pg_hba.conf.j2
dest: /var/lib/pgsql/data/pg_hba.conf

View File

@ -5,7 +5,7 @@
encoding: UTF8
state: present
- name: Create contacts table in PostgreSQL
- name: Create contacts table
community.postgresql.postgresql_query:
db: '{{ postgres_db }}'
query: |

View File

@ -1,4 +1,4 @@
- name: Insert data into PostgreSQL database idempotently
- name: Insert data into PostgreSQL database
community.postgresql.postgresql_query:
db: '{{ postgres_db }}'
query: |

View File

@ -4,7 +4,9 @@
permanent: true
state: enabled
become: true
- name: Reload firewall using command
command: firewall-cmd --reload
- name: Reload firewalld
systemd:
name: firewalld
state: reloaded
become: true

View File

@ -1,12 +1,11 @@
listen_addresses = '{{ postgres_listen_addresses | default("*") }}'
listen_addresses = '{{ postgres_listen_addresses }}'
port = {{ postgres_port | default(5432) }}
port = {{ postgres_port }}
max_connections = {{ postgres_max_connections | default(100) }}
shared_buffers = {{ postgres_shared_buffers | default("128MB") }}
effective_cache_size = {{ postgres_effective_cache_size | default("4GB") }}
maintenance_work_mem = {{ postgres_maintenance_work_mem | default("64MB") }}
checkpoint_completion_target = {{ postgres_checkpoint_completion_target | default(0.7) }}
wal_buffers = {{ postgres_wal_buffers | default("16MB") }}
default_statistics_target = {{ postgres_default_statistics_target | default(100) }}
max_connections = {{ postgres_max_connections }}
shared_buffers = {{ postgres_shared_buffers }}
effective_cache_size = {{ postgres_effective_cache_size }}
maintenance_work_mem = {{ postgres_maintenance_work_mem }}
checkpoint_completion_target = {{ postgres_checkpoint_completion_target }}
wal_buffers = {{ postgres_wal_buffers }}
default_statistics_target = {{ postgres_default_statistics_target }}

View File

@ -8,3 +8,11 @@ postgres_hba_entries:
backup_dir: "/var/backups/postgresql"
postgres_user: "postgres"
postgres_db: "mydb"
postgres_max_connections: 100
postgres_shared_buffers: '128MB'
postgres_effective_cache_size: '4GB'
postgres_maintenance_work_mem: '64MB'
postgres_checkpoint_completion_target: 0.7
postgres_wal_buffers: '16MB'
postgres_default_statistics_target: 100