You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
546 B
23 lines
546 B
2 years ago
|
- name: get info about all databases
|
||
|
community.postgresql.postgresql_info:
|
||
|
filter:
|
||
|
- databases
|
||
|
register: pg_databases
|
||
|
|
||
|
|
||
|
- block:
|
||
|
- name: vacuum and analyze database
|
||
|
community.postgresql.postgresql_query:
|
||
|
db: "{{ item.database_name }}"
|
||
|
query: VACUUM FULL ANALYZE;
|
||
|
changed_when: no
|
||
|
|
||
|
|
||
|
- name: reindex database
|
||
|
community.postgresql.postgresql_query:
|
||
|
db: "{{ item.database_name }}"
|
||
|
query: 'REINDEX DATABASE "{{ item.database_name }}";'
|
||
|
changed_when: no
|
||
|
|
||
|
loop: "{{ pg_databases.databases }}"
|