問題以下:
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