ansible-playbook pywinrm 模块问题

大爷来玩呀你懂得

问题如下:

PLAY [install node windows service] ********************************************************************************************************************************************************************************************************  
META: ran handlers

TASK [check uat sk_service_data_convert build result] **************************************************************************************************************************************************************************************  
task path: /data/ansible/playbook/win/install_node_service.yml:8  
fatal: [192.168.0.42]: FAILED! => {  
    "msg": "winrm or requests is not installed: No module named winrm"  
}  
...ignoring

TASK [uat build no pass break] *************************************************************************************************************************************************************************************************************  
task path: /data/ansible/playbook/win/install_node_service.yml:14  
fatal: [192.168.0.42]: FAILED! => {  
    "msg": "The conditional check 'checkbuild_uat.stdout.find(\"200\") == -1  and (Jenvironment == \"pro\" or Jenvironment == \"std\")' failed. The error was: error while evaluating conditional (checkbuild_uat.stdout.find(\"200\") == -1  and (Jenvironment == \"pro\" or Jenvironment == \"std\")): 'dict object' has no attribute 'stdout'\n\nThe error appears to be in '/data/ansible/playbook/win/install_node_service.yml': line 14, column 11, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n        #- name: uat {{sourcepath}} build no pass break\n        - name: uat build no pass break\n          ^ here\n"  
}

NO MORE HOSTS LEFT *************************************************************************************************************************************************************************************************************************

NO MORE HOSTS LEFT *************************************************************************************************************************************************************************************************************************

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

问题 解析与处理

问题从报错信息上看是winrm模块没有和playbook文件的语法问题
  • 'dict object' has no attribute 'stdout'nnThe error appears to be in '/data/ansible/playbook/win/install_node_service.yml': line 14, column 11, but maynbe elsewhere in the file depending on the exact syntax problem.nnThe offending line appears to be:nn
  • 实际查看playbook文件没有语法缩进等问题,在其他机器上运行无问题,初步判断是没有安装python下的winrm模块

解决方法

yum install python-pip pip -y

pip install pywinrm
阅读 641

这个人很懒,没有什么说的。

66 声望
6 粉丝
0 条评论
你知道吗?

这个人很懒,没有什么说的。

66 声望
6 粉丝
宣传栏