Files
fedora-infra_ansible/roles/abrt/faf-pre/tasks/setup_db.yml
Michal Konecny 2ec055db6f Use first uppercase letter for all handlers
This will unify all the handlers to use first uppercase letter for
ansible-lint to stop complaining.

I went through all `notify:` occurrences and fixed them by running
```
set TEXT "text_to_replace"; set REPLACEMENT "replacement_text"; git grep
-rlz "$TEXT" . | xargs -0 sed -i "s/$TEXT/$REPLACEMENT/g"
```

Then I went through all the changes and removed the ones that wasn't
expected to be changed.

Fixes https://pagure.io/fedora-infrastructure/issue/12391

Signed-off-by: Michal Konecny <mkonecny@redhat.com>
2025-02-10 20:31:49 +00:00

102 lines
2.5 KiB
YAML

---
- name: Ensure PostgreSQL database is initialized.
ansible.builtin.command: "postgresql-setup --initdb --unit postgresql"
args:
creates: "/var/lib/pgsql/data/PG_VERSION"
- name: Set max_connections for PostgreSQL
lineinfile:
path: /var/lib/pgsql/data/postgresql.conf
regexp: '^max_connections ='
line: 'max_connections = 150'
notify: Restart postgresql
- name: Set shared_buffers for PostgreSQL
lineinfile:
path: /var/lib/pgsql/data/postgresql.conf
regexp: '^shared_buffers ='
line: 'shared_buffers = 25536MB'
notify: Restart postgresql
- name: Set effective_cache_size for PostgreSQL
lineinfile:
path: /var/lib/pgsql/data/postgresql.conf
regexp: '^effective_cache_size ='
line: 'effective_cache_size = 50608MB'
notify: Restart postgresql
- name: Set work_mem for PostgreSQL
lineinfile:
path: /var/lib/pgsql/data/postgresql.conf
regexp: '^work_mem ='
line: 'work_mem = 6MB'
notify: Restart postgresql
- name: Set maintenance_work_mem for PostgreSQL
lineinfile:
path: /var/lib/pgsql/data/postgresql.conf
regexp: '^maintenance_work_mem ='
line: 'maintenance_work_mem = 2GB'
notify: Restart postgresql
- name: Set checkpoint_completion_target for PostgreSQL
lineinfile:
path: /var/lib/pgsql/data/postgresql.conf
regexp: '^checkpoint_completion_target ='
line: 'checkpoint_completion_target = 0.9'
notify: Restart postgresql
- name: Set wal_buffers for PostgreSQL
lineinfile:
path: /var/lib/pgsql/data/postgresql.conf
regexp: '^wal_buffers ='
line: 'wal_buffers = -1'
notify: Restart postgresql
- name: Set default_statistics_target for PostgreSQL
lineinfile:
path: /var/lib/pgsql/data/postgresql.conf
regexp: '^default_statistics_target ='
line: 'default_statistics_target = 100'
notify: Restart postgresql
- name: Drop faf database
postgresql_db:
name: faf
owner: postgres
state: absent
when: faf_recreate_database|bool
- name: Start service postgresql
service:
name: postgresql
state: started
enabled: yes
become: true
- name: Pgsql create db faf
postgresql_db:
name: faf
owner: postgres
state: present
become: true
become_user: postgres
- name: Pgsql create user faf
postgresql_user:
db: faf
name: faf
priv: ALL
role_attr_flags: SUPERUSER
state: present
become: true
become_user: postgres
- name: Create extension for faf
postgresql_ext:
name: semver
db: faf
state: present
become: true
become_user: postgres