我曾尝试从Postgres数据库中备份和还原单个模式,但得到以下错误,使用下面的yml文件我也使用了postgresql_db模块,但得到错误。
fatal: [192.168.1.18]: FAILED! => {"changed": false, "msg": "Unsupported parameters for (postgresql_schema) module: target Supported parameters include: ca_cert, cascade_drop, database, login_host, login_password, login_unix_socket, login_user, owner, port, schema, session_role, ssl_mode, state"}
---
- hosts: dbserver
become: true
gather_facts: yes
vars:
dbname: dbname
dbuser: dbuser
password: dbpassword
tasks:
- name: Schema backup
postgresql_schema:
name: dbname
schema: schema1
state: dump
target: /tmp/schema.sql.gz
login_user: "{{ dbuser }}"
login_password: "{{ password }}"
我已经使用postgresql_db模块进行单模式备份,工作正常,public是模式名。
- name: Dump a single schema for an existing database
postgresql_db:
name: acme
state: dump
target: /tmp/acme.sql
target_opts: "-n public"