candy 发表于 2018-7-29 09:28:13

Ansible问题汇总

  1、yum模块安装RPM包时报错
  报错信息:

  \ndebug2: fd 3 setting TCP_NODELAY\r\ndebug2: callback done\r\ndebug2: channel 0: open confirm rwindow 0 rmax 32768\r\ndebug3: Wrote 752 bytes for a total of 2797\r\ndebug2: channel_input_status_confirm: type 99>  "module_stdout": "Traceback (most recent call last):\r\nFile \"/tmp/ansible_K19Zjg/ansible_module_yum.py\", line 25, in <module>\r\n    import yum\r\nImportError: No module named yum\r\n",
  "msg": "MODULE FAILURE"
  报错原因,远程主机上默认的python版本为python2.7,在playbook中加入以下配置
vars:  
    ansible_python_interpreter: /usr/bin/python2.6
  修改后的playbook如下:
- hosts: '{{ HOST }}'  
vars:
  
    ansible_python_interpreter: /usr/bin/python2.6
  
gather_facts: False
  
become: True
  
become_user: root
  
roles:
  
    - { role: linux/wf_install_jdk }
页: [1]
查看完整版本: Ansible问题汇总