使用mysql_user模块的ansible-playbook zlib数据压缩错误

时间:2019-01-30 09:00:24

标签: mysql ansible zlib

我正在尝试使用MySQL mysql_user模块在​​ansible数据库中创建一个演示用户。我的ansible-playbook是:

---
- hosts: db01
  tasks:
  - name: install dependencies tool
    yum: name={{item}} state=latest update_cache=yes
    with_items:
    - MySQL-python
    - mysql-devel
    - python-devel

  - name: install mysql-server
    yum: name=mysql-server state=installed update_cache=yes

  - name: ensure mysql started
    service: name=mysql state=started enabled=yes

  - name: ensure mysql listening on all ports
    lineinfile: dest=/etc/my.cnf regexp=^bind-address line="bind-address = 0.0.0.0"
    notify: restart mysql

  - name: create demo database
    mysql_db: name=demo state=present

  - name: create demo user
    mysql_user: name=demo password=demo priv=demo.*:ALL host='%' state=present

  handlers:
  - name: restart mysql
    service: name=mysql state=restarted

不幸的是,ansible-playbook在创建用户时被炸了:

TASK ... *********************************************************************************************************************
ok: [db01] => ...

TASK [create demo user] **************************************************************************************************************
fatal: [db01]: FAILED! => {
    "changed": false, 
    "module_stderr": "Shared connection to db01 closed.\r\n",
    "module_stdout": "Traceback (most recent call last):\r\n  File \"/tmp/ansible_d7y4gT/ansible_module_mysql_user.py\", line 218, in <module>\r\n    from ansible.module_utils.basic import AnsibleModule\r\nzlib.error: Error -2 while preparing to decompress data: inconsistent stream state\r\n",
    "msg": "MODULE FAILURE",
    "rc": 0
}

任何人都可以帮助解决错误zlib.error: Error -2 while preparing to decompress data: inconsistent stream state吗?还有其他人遇到此错误吗?

1 个答案:

答案 0 :(得分:0)

参考https://github.com/ansible/ansible/issues/47927,这可能是与您的{{1}版本的ansible依赖项不直接相关的已知错误 }。