TiDB-ansible 安装 - ansible-playbook local_prepare.yml 命令失败

TiDB-ansible installation - ansible-playbook local_prepare.yml command failure

我正在尝试使用 tidb ansible 在单个节点上安装 tidb。我已经在 inventory.ini 文件中为 PD、TiDB 和 TiKV 服务器设置了正确的 IP 地址。我正在按照 https://pingcap.com/docs/v1.0/op-guide/ansible-deployment/ 中的说明进行操作。但是我在使用命令时遇到以下错误:ansible-playbook local_prepare.yml。 ansible 抱怨旧版本,尽管它是最新的 ansible 版本。如果有人能帮我安装 TiDB 就太好了

    [root@fm42cephnode005 tidb-ansible-master]# ansible --version
    ansible 2.9.1
      config file = /home/tidb-ansible-master/ansible.cfg
      configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
      ansible python module location = /usr/lib/python2.7/site-packages/ansible
      executable location = /usr/bin/ansible
      python version = 2.7.5 (default, Aug  7 2019, 00:51:29) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]


    [root@fm42cephnode005 tidb-ansible-master]# ansible-playbook local_prepare.yml

    PLAY [do local preparation] ********************************************************************************************************************************************************************************

    TASK [local : Stop if ansible version is too low, make sure that the Ansible version is Ansible 2.4.2 or later, otherwise a compatibility issue occurs.] ***************************************************
    fatal: [localhost]: FAILED! =>
      msg: 'The conditional check ''ansible_version.full|version_compare(''2.4.2'', ''>='')'' failed. The error was: template error while templating string: no filter named ''version_compare''. String: {% if ansible_version.full|version_compare(''2.4.2'', ''>='') %} True {% else %} False {% endif %}'
    Traceback (most recent call last):
      File "/usr/lib64/python2.7/logging/__init__.py", line 851, in emit
        msg = self.format(record)
      File "/usr/lib64/python2.7/logging/__init__.py", line 724, in format
        return fmt.format(record)
      File "/usr/lib64/python2.7/logging/__init__.py", line 467, in format
        s = self._fmt % record.__dict__
    KeyError: 'user'
    Logged from file help.py, line 111

    PLAY RECAP *************************************************************************************************************************************************************************************************
    localhost                  : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0


    ERROR MESSAGE SUMMARY **************************************************************************************************************************************************************************************
    [localhost]: Ansible Failed! ==>

      msg: 'The conditional check ''ansible_version.full|version_compare(''2.4.2'', ''>='')'' failed. The error was: template error while templating string: no filter named ''version_compare''. String: {% if ansible_version.full|version_compare(''2.4.2'', ''>='') %} True {% else %} False {% endif %}'
  • 这是ansible版本不兼容,请使用pip install -r ./requirements.txt安装,requirements.txt文件在tidb-ansible目录下

    注意:安装前需要卸载已有的ansible

  • ansible_version.full|version_compare('2.4.2', '>=') 当 ansible 有较新的版本但不兼容时,也许应该优化。