ansible/test/integration/targets/postgresql_info/tasks/setup_publication.yml
Andrew Klychkov 0dc08f6b97
postgresql_info: add subscription info (#67464)
* postgresql_info: add subscription info

* add changelog
2020-02-20 09:59:45 +01:00

61 lines
1.7 KiB
YAML

# 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)
# Preparation for further tests of postgresql_subscription module.
- vars:
task_parameters: &task_parameters
become_user: '{{ pg_user }}'
become: yes
register: result
pg_parameters: &pg_parameters
login_user: '{{ pg_user }}'
login_db: '{{ test_db }}'
block:
- name: Create test db
<<: *task_parameters
postgresql_db:
login_user: '{{ pg_user }}'
login_port: '{{ master_port }}'
maintenance_db: '{{ db_default }}'
name: '{{ test_db }}'
- name: Create test role
<<: *task_parameters
postgresql_user:
<<: *pg_parameters
login_port: '{{ master_port }}'
name: '{{ replication_role }}'
password: '{{ replication_pass }}'
role_attr_flags: LOGIN,REPLICATION
- name: Create test table
<<: *task_parameters
postgresql_table:
<<: *pg_parameters
login_port: '{{ master_port }}'
name: '{{ test_table1 }}'
columns:
- id int
- name: Master - dump schema
<<: *task_parameters
shell: pg_dumpall -p '{{ master_port }}' -s > /tmp/schema.sql
- name: Replicat restore schema
<<: *task_parameters
shell: psql -p '{{ replica_port }}' -f /tmp/schema.sql
- name: Create publication
<<: *task_parameters
postgresql_publication:
<<: *pg_parameters
login_port: '{{ master_port }}'
name: '{{ test_pub }}'
- name: Create publication
<<: *task_parameters
postgresql_publication:
<<: *pg_parameters
login_port: '{{ master_port }}'
name: '{{ test_pub2 }}'