给我一个错误的代码部分是:
- name: import database jira64_20180626.dump.tar.gz
postgresql_db:
name: jira64_20180626.dump.gz
login_user: jira
login_password: jira_pwd
state: restore
target: /var/lib/pgsql/jira64_20180626.dump.tar.gz
错误是:
致命:[node-1]:失败! => {“ changed”:false,“ cmd”:“ cmd:****”,“ msg”:“ \ ngzip:stdout:断管\ n”,“ rc”:1,“ stdout”:“” ,“ stdout_lines”:[]}
答案 0 :(得分:0)
名称似乎不正确,正确的代码应为:
- name: import database jira64_20180626.dump.tar.gz
postgresql_db:
name: name of the db which you want to restore
login_user: jira
login_password: jira_pwd
state: restore
target: /TheDUMPfilepath/jira64_20180626.dump.tar.gz
如果这不起作用,则Ansible Doc click here表示恢复格式如下:
将根据目标名称检测备份的格式。 支持的转储和还原压缩格式包括.bz2,.gz和.xz 支持的转储和还原格式包括.sql和.tar
例如如下:
- name: Dump existing database
postgresql_db:
name: acme
state: dump
target: /tmp/acme.sql