zcat 在 ansible-playbook 中失败
zcat failing in ansible-playbook
我正在尝试导入失败的架构,请建议我解决此错误
- name: Import the initial schema
command: zcat /usr/share/doc/zabbix-server-mysql-3.2.5/create.sql.gz | mysql -uzabbix -p zabbix
TASK: [zabbix-server | Import the initial schema] *****************************
failed: [10.100.140.120] => {"changed": true, "cmd": ["zcat", "/usr/share/doc/zabbix-server-mysql-3.2.5/create.sql.gz", "|", "mysql", "-u", "zabbix", "-p", "zabbix", "zabbix"], "delta": "0:00:00.003563", "end": "2017-05-01 11:03:46.004996", "rc": 1, "start": "2017-05-01 11:03:46.001433", "warnings": []}
stderr: gzip: invalid option -- 'u'
Try `gzip --help' for more information.
我的日志显示zabbix.users不存在
3862:20170501:112105.959 using configuration file: /etc/zabbix/zabbix_server.conf
3862:20170501:112105.962 [Z3005] query failed: [1146] Table 'zabbix.users' doesn't exist [select userid from users limit 1]
3862:20170501:112105.962 cannot use database "zabbix": database is not a Zabbix database
3913:20170501:112116.213 Starting Zabbix Server. Zabbix 3.2.5 (revision 67445).
Ansible 的 command
模块不支持 shell |
管道或类似的东西,只支持简单的命令和参数。您需要使用具有 state: import
.
功能的 shell module or even better, copy the create.sql.gz file over to the host then use the mysql_db module
我正在尝试导入失败的架构,请建议我解决此错误
- name: Import the initial schema
command: zcat /usr/share/doc/zabbix-server-mysql-3.2.5/create.sql.gz | mysql -uzabbix -p zabbix
TASK: [zabbix-server | Import the initial schema] *****************************
failed: [10.100.140.120] => {"changed": true, "cmd": ["zcat", "/usr/share/doc/zabbix-server-mysql-3.2.5/create.sql.gz", "|", "mysql", "-u", "zabbix", "-p", "zabbix", "zabbix"], "delta": "0:00:00.003563", "end": "2017-05-01 11:03:46.004996", "rc": 1, "start": "2017-05-01 11:03:46.001433", "warnings": []}
stderr: gzip: invalid option -- 'u'
Try `gzip --help' for more information.
我的日志显示zabbix.users不存在
3862:20170501:112105.959 using configuration file: /etc/zabbix/zabbix_server.conf
3862:20170501:112105.962 [Z3005] query failed: [1146] Table 'zabbix.users' doesn't exist [select userid from users limit 1]
3862:20170501:112105.962 cannot use database "zabbix": database is not a Zabbix database
3913:20170501:112116.213 Starting Zabbix Server. Zabbix 3.2.5 (revision 67445).
Ansible 的 command
模块不支持 shell |
管道或类似的东西,只支持简单的命令和参数。您需要使用具有 state: import
.