1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

postgresql modules: fix examples to use FQCN (#643)

This commit is contained in:
Andrew Klychkov 2020-07-13 12:54:34 +03:00 committed by GitHub
parent a424ee71e3
commit f62b8027e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 138 additions and 138 deletions

View file

@ -100,12 +100,12 @@ extends_documentation_fragment:
EXAMPLES = r'''
- name: Copy text TAB-separated data from file /tmp/data.txt to acme table
postgresql_copy:
community.general.postgresql_copy:
copy_from: /tmp/data.txt
dst: acme
- name: Copy CSV (comma-separated) data from file /tmp/data.csv to columns id, name of table acme
postgresql_copy:
community.general.postgresql_copy:
copy_from: /tmp/data.csv
dst: acme
columns: id,name
@ -115,7 +115,7 @@ EXAMPLES = r'''
- name: >
Copy text vertical-bar-separated data from file /tmp/data.txt to bar table.
The NULL values are specified as N
postgresql_copy:
community.general.postgresql_copy:
copy_from: /tmp/data.csv
dst: bar
options:
@ -123,19 +123,19 @@ EXAMPLES = r'''
null: 'N'
- name: Copy data from acme table to file /tmp/data.txt in text format, TAB-separated
postgresql_copy:
community.general.postgresql_copy:
src: acme
copy_to: /tmp/data.txt
- name: Copy data from SELECT query to/tmp/data.csv in CSV format
postgresql_copy:
community.general.postgresql_copy:
src: 'SELECT * FROM acme'
copy_to: /tmp/data.csv
options:
format: csv
- name: Copy CSV data from my_table to gzip
postgresql_copy:
community.general.postgresql_copy:
src: my_table
copy_to: 'gzip > /tmp/data.csv.gz'
program: yes
@ -145,7 +145,7 @@ EXAMPLES = r'''
- name: >
Copy data from columns id, name of table bar to /tmp/data.txt.
Output format is text, vertical-bar-separated, NULL as N
postgresql_copy:
community.general.postgresql_copy:
src: bar
columns:
- id

View file

@ -137,12 +137,12 @@ extends_documentation_fragment:
EXAMPLES = r'''
- name: Create a new database with name "acme"
postgresql_db:
community.general.postgresql_db:
name: acme
# Note: If a template different from "template0" is specified, encoding and locale settings must match those of the template.
- name: Create a new database with name "acme" and specific encoding and locale # settings.
postgresql_db:
community.general.postgresql_db:
name: acme
encoding: UTF-8
lc_collate: de_DE.UTF-8
@ -151,38 +151,38 @@ EXAMPLES = r'''
# Note: Default limit for the number of concurrent connections to a specific database is "-1", which means "unlimited"
- name: Create a new database with name "acme" which has a limit of 100 concurrent connections
postgresql_db:
community.general.postgresql_db:
name: acme
conn_limit: "100"
- name: Dump an existing database to a file
postgresql_db:
community.general.postgresql_db:
name: acme
state: dump
target: /tmp/acme.sql
- name: Dump an existing database to a file excluding the test table
postgresql_db:
community.general.postgresql_db:
name: acme
state: dump
target: /tmp/acme.sql
dump_extra_args: --exclude-table=test
- name: Dump an existing database to a file (with compression)
postgresql_db:
community.general.postgresql_db:
name: acme
state: dump
target: /tmp/acme.sql.gz
- name: Dump a single schema for an existing database
postgresql_db:
community.general.postgresql_db:
name: acme
state: dump
target: /tmp/acme.sql
target_opts: "-n public"
- name: Dump only table1 and table2 from the acme database
postgresql_db:
community.general.postgresql_db:
name: acme
state: dump
target: /tmp/table1_table2.sql
@ -192,7 +192,7 @@ EXAMPLES = r'''
# the tablespace will be changed to foo. Access to the database will be locked
# until the copying of database files is finished.
- name: Create a new database called foo in tablespace bar
postgresql_db:
community.general.postgresql_db:
name: foo
tablespace: bar
'''

View file

@ -119,19 +119,19 @@ extends_documentation_fragment:
EXAMPLES = r'''
- name: Adds postgis extension to the database acme in the schema foo
postgresql_ext:
community.general.postgresql_ext:
name: postgis
db: acme
schema: foo
- name: Removes postgis extension to the database acme
postgresql_ext:
community.general.postgresql_ext:
name: postgis
db: acme
state: absent
- name: Adds earthdistance extension to the database template1 cascade
postgresql_ext:
community.general.postgresql_ext:
name: earthdistance
db: template1
cascade: true
@ -139,20 +139,20 @@ EXAMPLES = r'''
# In the example below, if earthdistance extension is installed,
# it will be removed too because it depends on cube:
- name: Removes cube extension from the database acme cascade
postgresql_ext:
community.general.postgresql_ext:
name: cube
db: acme
cascade: yes
state: absent
- name: Create extension foo of version 1.2 or update it if it's already created
postgresql_ext:
community.general.postgresql_ext:
db: acme
name: foo
version: 1.2
- name: Assuming extension foo is created, update it to the latest version
postgresql_ext:
community.general.postgresql_ext:
db: acme
name: foo
version: latest

View file

@ -150,14 +150,14 @@ extends_documentation_fragment:
EXAMPLES = r'''
- name: Create btree index if not exists test_idx concurrently covering columns id and name of table products
postgresql_idx:
community.general.postgresql_idx:
db: acme
table: products
columns: id,name
name: test_idx
- name: Create btree index test_idx concurrently with tablespace called ssd and storage parameter
postgresql_idx:
community.general.postgresql_idx:
db: acme
table: products
columns:
@ -169,7 +169,7 @@ EXAMPLES = r'''
- fillfactor=90
- name: Create gist index test_gist_idx concurrently on column geo_data of table map
postgresql_idx:
community.general.postgresql_idx:
db: somedb
table: map
idxtype: gist
@ -178,7 +178,7 @@ EXAMPLES = r'''
# Note: for the example below pg_trgm extension must be installed for gin_trgm_ops
- name: Create gin index gin0_idx not concurrently on column comment of table test
postgresql_idx:
community.general.postgresql_idx:
idxname: gin0_idx
table: test
columns: comment gin_trgm_ops
@ -186,13 +186,13 @@ EXAMPLES = r'''
idxtype: gin
- name: Drop btree test_idx concurrently
postgresql_idx:
community.general.postgresql_idx:
db: mydb
idxname: test_idx
state: absent
- name: Drop test_idx cascade
postgresql_idx:
community.general.postgresql_idx:
db: mydb
idxname: test_idx
state: absent
@ -200,7 +200,7 @@ EXAMPLES = r'''
concurrent: no
- name: Create btree index test_idx concurrently on columns id,comment where column id > 1
postgresql_idx:
community.general.postgresql_idx:
db: mydb
table: test
columns: id,comment
@ -208,7 +208,7 @@ EXAMPLES = r'''
cond: id > 1
- name: Create unique btree index if not exists test_unique_idx on column name of table products
postgresql_idx:
community.general.postgresql_idx:
db: acme
table: products
columns: name

View file

@ -72,13 +72,13 @@ EXAMPLES = r'''
- name: Collect PostgreSQL version and extensions
become: yes
become_user: postgres
postgresql_info:
community.general.postgresql_info:
filter: ver*,ext*
- name: Collect all info except settings and roles
become: yes
become_user: postgres
postgresql_info:
community.general.postgresql_info:
filter: "!settings,!roles"
# On FreeBSD with PostgreSQL 9.5 version and lower use pgsql user to become
@ -86,7 +86,7 @@ EXAMPLES = r'''
- name: Collect tablespaces and repl_slots info
become: yes
become_user: pgsql
postgresql_info:
community.general.postgresql_info:
db: postgres
filter:
- tablesp*
@ -95,7 +95,7 @@ EXAMPLES = r'''
- name: Collect all info except databases
become: yes
become_user: postgres
postgresql_info:
community.general.postgresql_info:
filter:
- "!databases"
'''

View file

@ -133,13 +133,13 @@ extends_documentation_fragment:
EXAMPLES = r'''
- name: Add language pltclu to database testdb if it doesn't exist
postgresql_lang: db=testdb lang=pltclu state=present
community.general.postgresql_lang: db=testdb lang=pltclu state=present
# Add language pltclu to database testdb if it doesn't exist and mark it as trusted.
# Marks the language as trusted if it exists but isn't trusted yet.
# force_trust makes sure that the language will be marked as trusted
- name: Add language pltclu to database testdb if it doesn't exist and mark it as trusted
postgresql_lang:
community.general.postgresql_lang:
db: testdb
lang: pltclu
state: present
@ -147,27 +147,27 @@ EXAMPLES = r'''
force_trust: yes
- name: Remove language pltclu from database testdb
postgresql_lang:
community.general.postgresql_lang:
db: testdb
lang: pltclu
state: absent
- name: Remove language pltclu from database testdb and remove all dependencies
postgresql_lang:
community.general.postgresql_lang:
db: testdb
lang: pltclu
state: absent
cascade: yes
- name: Remove language c from database testdb but ignore errors if something prevents the removal
postgresql_lang:
community.general.postgresql_lang:
db: testdb
lang: pltclu
state: absent
fail_on_drop: no
- name: In testdb change owner of mylang to alice
postgresql_lang:
community.general.postgresql_lang:
db: testdb
lang: mylang
owner: alice

View file

@ -93,7 +93,7 @@ extends_documentation_fragment:
EXAMPLES = r'''
- name: Grant role read_only to alice and bob
postgresql_membership:
community.general.postgresql_membership:
group: read_only
target_roles:
- alice
@ -103,7 +103,7 @@ EXAMPLES = r'''
# you can also use target_roles: alice,bob,etc to pass the role list
- name: Revoke role read_only and exec_func from bob. Ignore if roles don't exist
postgresql_membership:
community.general.postgresql_membership:
groups:
- read_only
- exec_func

View file

@ -91,41 +91,41 @@ EXAMPLES = r'''
# ansible -m postgresql_owner -a "db=bar new_owner=alice obj_name=myfunc obj_type=function"
- name: The same as above by playbook
postgresql_owner:
community.general.postgresql_owner:
db: bar
new_owner: alice
obj_name: myfunc
obj_type: function
- name: Set owner as bob for table acme in database bar
postgresql_owner:
community.general.postgresql_owner:
db: bar
new_owner: bob
obj_name: acme
obj_type: table
- name: Set owner as alice for view test_view in database bar
postgresql_owner:
community.general.postgresql_owner:
db: bar
new_owner: alice
obj_name: test_view
obj_type: view
- name: Set owner as bob for tablespace ssd in database foo
postgresql_owner:
community.general.postgresql_owner:
db: foo
new_owner: bob
obj_name: ssd
obj_type: tablespace
- name: Reassign all object in database bar owned by bob to alice
postgresql_owner:
community.general.postgresql_owner:
db: bar
new_owner: alice
reassign_owned_by: bob
- name: Reassign all object in database bar owned by bob and bill to alice
postgresql_owner:
community.general.postgresql_owner:
db: bar
new_owner: alice
reassign_owned_by:

View file

@ -123,7 +123,7 @@ author: Sebastiaan Mannem (@sebasmannem)
EXAMPLES = '''
- name: Grant users joe and simon access to databases sales and logistics from ipv6 localhost ::1/128 using peer authentication.
postgresql_pg_hba:
community.general.postgresql_pg_hba:
dest: /var/lib/postgres/data/pg_hba.conf
contype: host
users: joe,simon
@ -133,7 +133,7 @@ EXAMPLES = '''
create: true
- name: Grant user replication from network 192.168.0.100/24 access for replication with client cert authentication.
postgresql_pg_hba:
community.general.postgresql_pg_hba:
dest: /var/lib/postgres/data/pg_hba.conf
contype: host
users: replication
@ -142,7 +142,7 @@ EXAMPLES = '''
method: cert
- name: Revoke access from local user mary on database mydb.
postgresql_pg_hba:
community.general.postgresql_pg_hba:
dest: /var/lib/postgres/data/pg_hba.conf
contype: local
users: mary

View file

@ -51,7 +51,7 @@ EXAMPLES = r'''
# In the example below you need to generate certificates previously.
# See https://www.postgresql.org/docs/current/libpq-ssl.html for more information.
- name: PostgreSQL ping dbsrv server using not default credentials and ssl
postgresql_ping:
community.general.postgresql_ping:
db: protected_db
login_host: dbsrv
login_user: secret

View file

@ -202,7 +202,7 @@ EXAMPLES = r'''
# GRANT SELECT, INSERT, UPDATE ON TABLE public.books, public.authors
# TO librarian, reader WITH GRANT OPTION
- name: Grant privs to librarian and reader on database library
postgresql_privs:
community.general.postgresql_privs:
database: library
state: present
privs: SELECT,INSERT,UPDATE
@ -213,7 +213,7 @@ EXAMPLES = r'''
grant_option: yes
- name: Same as above leveraging default values
postgresql_privs:
community.general.postgresql_privs:
db: library
privs: SELECT,INSERT,UPDATE
objs: books,authors
@ -224,7 +224,7 @@ EXAMPLES = r'''
# Note that role "reader" will be *granted* INSERT privilege itself if this
# isn't already the case (since state: present).
- name: Revoke privs from reader
postgresql_privs:
community.general.postgresql_privs:
db: library
state: present
priv: INSERT
@ -234,7 +234,7 @@ EXAMPLES = r'''
# "public" is the default schema. This also works for PostgreSQL 8.x.
- name: REVOKE INSERT, UPDATE ON ALL TABLES IN SCHEMA public FROM reader
postgresql_privs:
community.general.postgresql_privs:
db: library
state: absent
privs: INSERT,UPDATE
@ -242,7 +242,7 @@ EXAMPLES = r'''
role: reader
- name: GRANT ALL PRIVILEGES ON SCHEMA public, math TO librarian
postgresql_privs:
community.general.postgresql_privs:
db: library
privs: ALL
type: schema
@ -251,7 +251,7 @@ EXAMPLES = r'''
# Note the separation of arguments with colons.
- name: GRANT ALL PRIVILEGES ON FUNCTION math.add(int, int) TO librarian, reader
postgresql_privs:
community.general.postgresql_privs:
db: library
privs: ALL
type: function
@ -262,7 +262,7 @@ EXAMPLES = r'''
# Note that group role memberships apply cluster-wide and therefore are not
# restricted to database "library" here.
- name: GRANT librarian, reader TO alice, bob WITH ADMIN OPTION
postgresql_privs:
community.general.postgresql_privs:
db: library
type: group
objs: librarian,reader
@ -272,7 +272,7 @@ EXAMPLES = r'''
# Note that here "db: postgres" specifies the database to connect to, not the
# database to grant privileges on (which is specified via the "objs" param)
- name: GRANT ALL PRIVILEGES ON DATABASE library TO librarian
postgresql_privs:
community.general.postgresql_privs:
db: postgres
privs: ALL
type: database
@ -282,7 +282,7 @@ EXAMPLES = r'''
# If objs is omitted for type "database", it defaults to the database
# to which the connection is established
- name: GRANT ALL PRIVILEGES ON DATABASE library TO librarian
postgresql_privs:
community.general.postgresql_privs:
db: library
privs: ALL
type: database
@ -293,7 +293,7 @@ EXAMPLES = r'''
# ALL_DEFAULT works only with privs=ALL
# For specific
- name: ALTER DEFAULT PRIVILEGES ON DATABASE library TO librarian
postgresql_privs:
community.general.postgresql_privs:
db: library
objs: ALL_DEFAULT
privs: ALL
@ -306,7 +306,7 @@ EXAMPLES = r'''
# ALL_DEFAULT works only with privs=ALL
# For specific
- name: ALTER DEFAULT PRIVILEGES ON DATABASE library TO reader, step 1
postgresql_privs:
community.general.postgresql_privs:
db: library
objs: TABLES,SEQUENCES
privs: SELECT
@ -314,7 +314,7 @@ EXAMPLES = r'''
role: reader
- name: ALTER DEFAULT PRIVILEGES ON DATABASE library TO reader, step 2
postgresql_privs:
community.general.postgresql_privs:
db: library
objs: TYPES
privs: USAGE
@ -323,7 +323,7 @@ EXAMPLES = r'''
# Available since version 2.8
- name: GRANT ALL PRIVILEGES ON FOREIGN DATA WRAPPER fdw TO reader
postgresql_privs:
community.general.postgresql_privs:
db: test
objs: fdw
privs: ALL
@ -332,7 +332,7 @@ EXAMPLES = r'''
# Available since community.general 0.2.0
- name: GRANT ALL PRIVILEGES ON TYPE customtype TO reader
postgresql_privs:
community.general.postgresql_privs:
db: test
objs: customtype
privs: ALL
@ -341,7 +341,7 @@ EXAMPLES = r'''
# Available since version 2.8
- name: GRANT ALL PRIVILEGES ON FOREIGN SERVER fdw_server TO reader
postgresql_privs:
community.general.postgresql_privs:
db: test
objs: fdw_server
privs: ALL
@ -351,7 +351,7 @@ EXAMPLES = r'''
# Available since version 2.8
# Grant 'execute' permissions on all functions in schema 'common' to role 'caller'
- name: GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA common TO caller
postgresql_privs:
community.general.postgresql_privs:
type: function
state: present
privs: EXECUTE
@ -365,7 +365,7 @@ EXAMPLES = r'''
# default to the role reader.
# For specific
- name: ALTER privs
postgresql_privs:
community.general.postgresql_privs:
db: library
schema: library
objs: TABLES
@ -380,7 +380,7 @@ EXAMPLES = r'''
# default from the role reader.
# For specific
- name: ALTER privs
postgresql_privs:
community.general.postgresql_privs:
db: library
state: absent
schema: library
@ -392,7 +392,7 @@ EXAMPLES = r'''
# Available since community.general 0.2.0
- name: Grant type privileges for pg_catalog.numeric type to alice
postgresql_privs:
community.general.postgresql_privs:
type: type
roles: alice
privs: ALL

View file

@ -95,12 +95,12 @@ extends_documentation_fragment:
EXAMPLES = r'''
- name: Create a new publication with name "acme" targeting all tables in database "test".
postgresql_publication:
community.general.postgresql_publication:
db: test
name: acme
- name: Create publication "acme" publishing only prices and vehicles tables.
postgresql_publication:
community.general.postgresql_publication:
name: acme
tables:
- prices
@ -109,7 +109,7 @@ EXAMPLES = r'''
- name: >
Create publication "acme", set user alice as an owner, targeting all tables.
Allowable DML operations are INSERT and UPDATE only
postgresql_publication:
community.general.postgresql_publication:
name: acme
owner: alice
parameters:
@ -118,7 +118,7 @@ EXAMPLES = r'''
- name: >
Assuming publication "acme" exists and there are targeted
tables "prices" and "vehicles", add table "stores" to the publication.
postgresql_publication:
community.general.postgresql_publication:
name: acme
tables:
- prices
@ -126,7 +126,7 @@ EXAMPLES = r'''
- stores
- name: Remove publication "acme" if exists in database "test".
postgresql_publication:
community.general.postgresql_publication:
db: test
name: acme
state: absent

View file

@ -88,12 +88,12 @@ extends_documentation_fragment:
EXAMPLES = r'''
- name: Simple select query to acme db
postgresql_query:
community.general.postgresql_query:
db: acme
query: SELECT version()
- name: Select query to db acme with positional arguments and non-default credentials
postgresql_query:
community.general.postgresql_query:
db: acme
login_user: django
login_password: mysecretpass
@ -103,7 +103,7 @@ EXAMPLES = r'''
- test
- name: Select query to test_db with named_args
postgresql_query:
community.general.postgresql_query:
db: test_db
query: SELECT * FROM test WHERE id = %(id_val)s AND story = %(story_val)s
named_args:
@ -111,12 +111,12 @@ EXAMPLES = r'''
story_val: test
- name: Insert query to test_table in db test_db
postgresql_query:
community.general.postgresql_query:
db: test_db
query: INSERT INTO test_table (id, story) VALUES (2, 'my_long_story')
- name: Run queries from SQL script using UTF-8 client encoding for session
postgresql_query:
community.general.postgresql_query:
db: test_db
path_to_script: /var/lib/pgsql/test.sql
positional_args:
@ -124,7 +124,7 @@ EXAMPLES = r'''
encoding: UTF-8
- name: Example of using autocommit parameter
postgresql_query:
community.general.postgresql_query:
db: test_db
query: VACUUM
autocommit: yes
@ -132,7 +132,7 @@ EXAMPLES = r'''
- name: >
Insert data to the column of array type using positional_args.
Note that we use quotes here, the same as for passing JSON, etc.
postgresql_query:
community.general.postgresql_query:
query: INSERT INTO test_table (array_column) VALUES (%s)
positional_args:
- '{1,2,3}'
@ -147,7 +147,7 @@ EXAMPLES = r'''
my_arr: '{1, 2, 3}'
- name: Select from test table by passing positional_args as arrays
postgresql_query:
community.general.postgresql_query:
query: SELECT * FROM test_array_table WHERE arr_col1 = %s AND arr_col2 = %s
positional_args:
- '{{ my_list }}'

View file

@ -95,17 +95,17 @@ extends_documentation_fragment:
EXAMPLES = r'''
- name: Create a new schema with name acme in test database
postgresql_schema:
community.general.postgresql_schema:
db: test
name: acme
- name: Create a new schema acme with a user bob who will own it
postgresql_schema:
community.general.postgresql_schema:
name: acme
owner: bob
- name: Drop schema "acme" with cascade
postgresql_schema:
community.general.postgresql_schema:
name: acme
state: absent
cascade_drop: yes

View file

@ -165,25 +165,25 @@ extends_documentation_fragment:
EXAMPLES = r'''
- name: Create an ascending bigint sequence called foobar in the default
database
postgresql_sequence:
community.general.postgresql_sequence:
name: foobar
- name: Create an ascending integer sequence called foobar, starting at 101
postgresql_sequence:
community.general.postgresql_sequence:
name: foobar
data_type: integer
start: 101
- name: Create an descending sequence called foobar, starting at 101 and
preallocated 10 sequence numbers in cache
postgresql_sequence:
community.general.postgresql_sequence:
name: foobar
increment: -1
cache: 10
start: 101
- name: Create an ascending sequence called foobar, which cycle between 1 to 10
postgresql_sequence:
community.general.postgresql_sequence:
name: foobar
cycle: yes
min: 1
@ -191,32 +191,32 @@ EXAMPLES = r'''
- name: Create an ascending bigint sequence called foobar in the default
database with owner foobar
postgresql_sequence:
community.general.postgresql_sequence:
name: foobar
owner: foobar
- name: Rename an existing sequence named foo to bar
postgresql_sequence:
community.general.postgresql_sequence:
name: foo
rename_to: bar
- name: Change the schema of an existing sequence to foobar
postgresql_sequence:
community.general.postgresql_sequence:
name: foobar
newschema: foobar
- name: Change the owner of an existing sequence to foobar
postgresql_sequence:
community.general.postgresql_sequence:
name: foobar
owner: foobar
- name: Drop a sequence called foobar
postgresql_sequence:
community.general.postgresql_sequence:
name: foobar
state: absent
- name: Drop a sequence called foobar with cascade
postgresql_sequence:
community.general.postgresql_sequence:
name: foobar
cascade: yes
state: absent

View file

@ -90,14 +90,14 @@ extends_documentation_fragment:
EXAMPLES = r'''
- name: Restore wal_keep_segments parameter to initial state
postgresql_set:
community.general.postgresql_set:
name: wal_keep_segments
reset: yes
# Set work_mem parameter to 32MB and show what's been changed and restart is required or not
# (output example: "msg": "work_mem 4MB >> 64MB restart_req: False")
- name: Set work mem parameter
postgresql_set:
community.general.postgresql_set:
name: work_mem
value: 32mb
register: set
@ -110,12 +110,12 @@ EXAMPLES = r'''
# (If you passed the value that was different from the current server setting).
- name: Set log_min_duration_statement parameter to 1 second
postgresql_set:
community.general.postgresql_set:
name: log_min_duration_statement
value: 1s
- name: Set wal_log_hints parameter to default value (remove parameter from postgresql.auto.conf)
postgresql_set:
community.general.postgresql_set:
name: wal_log_hints
value: default
'''

View file

@ -101,19 +101,19 @@ extends_documentation_fragment:
EXAMPLES = r'''
- name: Create physical_one physical slot if doesn't exist
become_user: postgres
postgresql_slot:
community.general.postgresql_slot:
slot_name: physical_one
db: ansible
- name: Remove physical_one slot if exists
become_user: postgres
postgresql_slot:
community.general.postgresql_slot:
slot_name: physical_one
db: ansible
state: absent
- name: Create logical_one logical slot to the database acme if doesn't exist
postgresql_slot:
community.general.postgresql_slot:
name: logical_slot_one
slot_type: logical
state: present
@ -121,7 +121,7 @@ EXAMPLES = r'''
db: "acme"
- name: Remove logical_one slot if exists from the cluster running on another host and non-standard port
postgresql_slot:
community.general.postgresql_slot:
name: logical_one
login_host: mydatabase.example.org
port: 5433

View file

@ -122,7 +122,7 @@ EXAMPLES = r'''
Create acme subscription in mydb database using acme_publication and
the following connection parameters to connect to the publisher.
Set the subscription owner as alice.
postgresql_subscription:
community.general.postgresql_subscription:
db: mydb
name: acme
state: present
@ -136,7 +136,7 @@ EXAMPLES = r'''
dbname: mydb
- name: Assuming that acme subscription exists, try to change conn parameters
postgresql_subscription:
community.general.postgresql_subscription:
db: mydb
name: acme
connparams:
@ -147,20 +147,20 @@ EXAMPLES = r'''
connect_timeout: 100
- name: Refresh acme publication
postgresql_subscription:
community.general.postgresql_subscription:
db: mydb
name: acme
state: refresh
- name: Drop acme subscription from mydb with dependencies (cascade=yes)
postgresql_subscription:
community.general.postgresql_subscription:
db: mydb
name: acme
state: absent
cascade: yes
- name: Assuming that acme subscription exists and enabled, disable the subscription
postgresql_subscription:
community.general.postgresql_subscription:
db: mydb
name: acme
state: present

View file

@ -134,14 +134,14 @@ extends_documentation_fragment:
EXAMPLES = r'''
- name: Create tbl2 in the acme database with the DDL like tbl1 with testuser as an owner
postgresql_table:
community.general.postgresql_table:
db: acme
name: tbl2
like: tbl1
owner: testuser
- name: Create tbl2 in the acme database and tablespace ssd with the DDL like tbl1 including comments and indexes
postgresql_table:
community.general.postgresql_table:
db: acme
table: tbl2
like: tbl1
@ -149,7 +149,7 @@ EXAMPLES = r'''
tablespace: ssd
- name: Create test_table with several columns in ssd tablespace with fillfactor=10 and autovacuum_analyze_threshold=1
postgresql_table:
community.general.postgresql_table:
name: test_table
columns:
- id bigserial primary key
@ -161,44 +161,44 @@ EXAMPLES = r'''
- autovacuum_analyze_threshold=1
- name: Create an unlogged table in schema acme
postgresql_table:
community.general.postgresql_table:
name: acme.useless_data
columns: waste_id int
unlogged: true
- name: Rename table foo to bar
postgresql_table:
community.general.postgresql_table:
table: foo
rename: bar
- name: Rename table foo from schema acme to bar
postgresql_table:
community.general.postgresql_table:
name: acme.foo
rename: bar
- name: Set owner to someuser
postgresql_table:
community.general.postgresql_table:
name: foo
owner: someuser
- name: Change tablespace of foo table to new_tablespace and set owner to new_user
postgresql_table:
community.general.postgresql_table:
name: foo
tablespace: new_tablespace
owner: new_user
- name: Truncate table foo
postgresql_table:
community.general.postgresql_table:
name: foo
truncate: yes
- name: Drop table foo from schema acme
postgresql_table:
community.general.postgresql_table:
name: acme.foo
state: absent
- name: Drop table bar cascade
postgresql_table:
community.general.postgresql_table:
name: bar
state: absent
cascade: yes

View file

@ -109,31 +109,31 @@ extends_documentation_fragment:
EXAMPLES = r'''
- name: Create a new tablespace called acme and set bob as an its owner
postgresql_tablespace:
community.general.postgresql_tablespace:
name: acme
owner: bob
location: /data/foo
- name: Create a new tablespace called bar with tablespace options
postgresql_tablespace:
community.general.postgresql_tablespace:
name: bar
set:
random_page_cost: 1
seq_page_cost: 1
- name: Reset random_page_cost option
postgresql_tablespace:
community.general.postgresql_tablespace:
name: bar
set:
random_page_cost: reset
- name: Rename the tablespace from bar to pcie_ssd
postgresql_tablespace:
community.general.postgresql_tablespace:
name: bar
rename_to: pcie_ssd
- name: Drop tablespace called bloat
postgresql_tablespace:
community.general.postgresql_tablespace:
name: bloat
state: absent
'''

View file

@ -176,7 +176,7 @@ extends_documentation_fragment:
EXAMPLES = r'''
- name: Connect to acme database, create django user, and grant access to database and products table
postgresql_user:
community.general.postgresql_user:
db: acme
name: django
password: ceec4eif7ya
@ -184,7 +184,7 @@ EXAMPLES = r'''
expires: "Jan 31 2020"
- name: Add a comment on django user
postgresql_user:
community.general.postgresql_user:
db: acme
name: django
comment: This is a test user
@ -192,13 +192,13 @@ EXAMPLES = r'''
# Connect to default database, create rails user, set its password (MD5-hashed),
# and grant privilege to create other databases and demote rails from super user status if user exists
- name: Create rails user, set MD5-hashed password, grant privs
postgresql_user:
community.general.postgresql_user:
name: rails
password: md59543f1d82624df2b31672ec0f7050460
role_attr_flags: CREATEDB,NOSUPERUSER
- name: Connect to acme database and remove test user privileges from there
postgresql_user:
community.general.postgresql_user:
db: acme
name: test
priv: "ALL/products:ALL"
@ -206,14 +206,14 @@ EXAMPLES = r'''
fail_on_user: no
- name: Connect to test database, remove test user from cluster
postgresql_user:
community.general.postgresql_user:
db: test
name: test
priv: ALL
state: absent
- name: Connect to acme database and set user's password with no expire date
postgresql_user:
community.general.postgresql_user:
db: acme
name: django
password: mysupersecretword
@ -224,13 +224,13 @@ EXAMPLES = r'''
# INSERT,UPDATE/table:SELECT/anothertable:ALL
- name: Connect to test database and remove an existing user's password
postgresql_user:
community.general.postgresql_user:
db: test
user: test
password: ""
- name: Create user test and grant group user_ro and user_rw to it
postgresql_user:
community.general.postgresql_user:
name: test
groups:
- user_ro
@ -239,7 +239,7 @@ EXAMPLES = r'''
# Create user with a cleartext password if it does not exist or update its password.
# The password will be encrypted with SCRAM algorithm (available since PostgreSQL 10)
- name: Create appclient user with SCRAM-hashed password
postgresql_user:
community.general.postgresql_user:
name: appclient
password: "secret123"
environment:

View file

@ -68,16 +68,16 @@ extends_documentation_fragment:
EXAMPLES = r'''
- name: Collect information about all supported user objects of the acme database
postgresql_user_obj_stat_info:
community.general.postgresql_user_obj_stat_info:
db: acme
- name: Collect information about all supported user objects in the custom schema of the acme database
postgresql_user_obj_stat_info:
community.general.postgresql_user_obj_stat_info:
db: acme
schema: custom
- name: Collect information about user tables and indexes in the acme database
postgresql_user_obj_stat_info:
community.general.postgresql_user_obj_stat_info:
db: acme
filter: tables, indexes
'''