【问题标题】:zcat failing in ansible-playbookzcat 在 ansible-playbook 中失败
【发布时间】:2017-09-29 00:08:00
【问题描述】:

我正在尝试导入失败的架构,请建议我解决此错误

- 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 zabbix zcat


    【解决方案1】:

    Ansible 的 command 模块不支持 shell | 管道或类似的东西,只支持简单的命令和参数。您需要使用shell module 甚至更好,copy 将 create.sql.gz 文件传输到主机,然后使用具有state: import 功能的mysql_db module

    【讨论】:

      猜你喜欢
      • 2020-03-28
      • 1970-01-01
      • 1970-01-01
      • 2022-01-12
      • 2020-05-27
      • 2023-04-02
      • 1970-01-01
      • 2017-05-29
      • 1970-01-01
      相关资源
      最近更新 更多