mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
New module postgresql_facts: Gathers facts about PostgreSQL servers. (#51164)
* New module postgresql_facts: Gathers facts about remote PostgreSQL instances * New module postgresql_facts: fix default values of function * New module postgresql_facts: add extension support * New module postgresql_facts: fixed typo * New module postgresql_facts: added integration test * New module postgresql_facts: fix test error * New module postgresql_facts: add info about min server version * New module postgresql_facts: fix * New module postgresql_facts: fix * New module postgresql_facts: added repl stat tables checks * New module postgresql_facts: fix * New module postgresql_facts: fix * New module postgresql_facts: fix * New module postgresql_facts: fix * New module postgresql_facts: fix * New module postgresql_facts: fix * New module postgresql_facts: fix * New module postgresql_facts: ansible_facts -> postgresql_facts * New module postgresql_facts: fix ci New module postgresql_facts: revision for review New module postgresql_facts: revision for review, fix * fix doc * New module postgresql_facts: add data types to param dict * New module postgresql_facts: code refactoring * # This is a combination of 3 commits. # The first commit's message is: New module postgresql_facts: incl_subset => filter # This is the 2nd commit message: New module postgresql_facts: fix a typo # This is the 3rd commit message: New module postgresql_facts: fixes * New module postgresql_facts: incl_subset => filter New module postgresql_facts: fix a typo New module postgresql_facts: fixes Various cosmetic and doc changes * New module postgresql_facts: fix filter type * New module postgresql_facts: fix sanity * New module postgresql_facts: change ansible_facts to postgresql_facts * New module postgresql_facts: fix tests * New module postgresql_facts: fixes * New module postgresql_facts: fixes * New module postgresql_facts: fixes * New module postgresql_facts: doc fixes * New module postgresql_facts: added pretty_val * New module postgresql_facts: added pending restart * New module postgresql_facts: fix documentation * New module postgresql_facts: fix documentation * New module postgresql_facts: fixes by KN * New module postgresql_facts: fixed sanity * New module postgresql_facts: fixed tests
This commit is contained in:
parent
866f934044
commit
db17e88fd2
3 changed files with 1127 additions and 0 deletions
1016
lib/ansible/modules/database/postgresql/postgresql_facts.py
Normal file
1016
lib/ansible/modules/database/postgresql/postgresql_facts.py
Normal file
File diff suppressed because it is too large
Load diff
|
@ -780,6 +780,9 @@
|
|||
# Test postgresql_privs
|
||||
- include: postgresql_privs.yml
|
||||
|
||||
# Test postgresql_facts module:
|
||||
- include: postgresql_facts.yml
|
||||
|
||||
# dump/restore tests per format
|
||||
# ============================================================
|
||||
- include: state_dump_restore.yml test_fixture=user file=dbdata.sql
|
||||
|
|
108
test/integration/targets/postgresql/tasks/postgresql_facts.yml
Normal file
108
test/integration/targets/postgresql/tasks/postgresql_facts.yml
Normal file
|
@ -0,0 +1,108 @@
|
|||
# Test code for the postgresql_facts module
|
||||
# Copyright: (c) 2019, Andrew Klychkov (@Andersson007) <aaklychkov@mail.ru>
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
- name: postgresql_facts - create role to check session_role
|
||||
become_user: "{{ pg_user }}"
|
||||
become: yes
|
||||
postgresql_user:
|
||||
db: "{{ db_default }}"
|
||||
login_user: "{{ pg_user }}"
|
||||
name: session_superuser
|
||||
role_attr_flags: SUPERUSER
|
||||
|
||||
- name: postgresql_facts - test return values and session_role param
|
||||
become_user: "{{ pg_user }}"
|
||||
become: yes
|
||||
postgresql_facts:
|
||||
db: "{{ db_default }}"
|
||||
login_user: "{{ pg_user }}"
|
||||
session_role: session_superuser
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result.version != {}
|
||||
- result.databases.{{ db_default }}.collate
|
||||
- result.databases.{{ db_default }}.languages
|
||||
- result.databases.{{ db_default }}.namespaces
|
||||
- result.databases.{{ db_default }}.extensions
|
||||
- result.settings
|
||||
- result.tablespaces
|
||||
- result.roles
|
||||
|
||||
- name: postgresql_facts - check filter param passed by list
|
||||
become_user: "{{ pg_user }}"
|
||||
become: yes
|
||||
postgresql_facts:
|
||||
db: "{{ db_default }}"
|
||||
login_user: "{{ pg_user }}"
|
||||
filter:
|
||||
- ver*
|
||||
- rol*
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result.version != {}
|
||||
- result.roles
|
||||
- result.databases == {}
|
||||
- result.repl_slots == {}
|
||||
- result.replications == {}
|
||||
- result.settings == {}
|
||||
- result.tablespaces == {}
|
||||
|
||||
- name: postgresql_facts - check filter param passed by string
|
||||
become_user: "{{ pg_user }}"
|
||||
become: yes
|
||||
postgresql_facts:
|
||||
db: "{{ db_default }}"
|
||||
filter: ver*,role*
|
||||
login_user: "{{ pg_user }}"
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result.version != {}
|
||||
- result.roles
|
||||
- result.databases == {}
|
||||
- result.repl_slots == {}
|
||||
- result.replications == {}
|
||||
- result.settings == {}
|
||||
- result.tablespaces == {}
|
||||
|
||||
- name: postgresql_facts - check filter param passed by string
|
||||
become_user: "{{ pg_user }}"
|
||||
become: yes
|
||||
postgresql_facts:
|
||||
db: "{{ db_default }}"
|
||||
filter: ver*
|
||||
login_user: "{{ pg_user }}"
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result.version
|
||||
- result.roles == {}
|
||||
|
||||
- name: postgresql_facts - check excluding filter param passed by list
|
||||
become_user: "{{ pg_user }}"
|
||||
become: yes
|
||||
postgresql_facts:
|
||||
db: "{{ db_default }}"
|
||||
filter:
|
||||
- "!ver*"
|
||||
- "!rol*"
|
||||
login_user: "{{ pg_user }}"
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result.version == {}
|
||||
- result.roles == {}
|
||||
- result.databases
|
Loading…
Reference in a new issue