2017-05-10 85 views
-1

確實Ansible默認配置與其他供應商一起工作嗎?例如華爲?默認安全模板返回錯誤

如果我跑了一些測試命令,如:

須藤ansible -m殼-a '顯示版本' 服務器

10.46.1.1 | UNREACHABLE! => { 
    "changed": false, 
    "msg": "Failed to connect to the host via ssh: \r\n**********************************************************************\r\n* Jus esate prisijunge prie privacios irangos. Visi veiksmai,vykdomi *\r\n* su sia iranga, yra fiksuojami. Tam, kad prieiti prie sios irangos *\r\n* ir (ar) atlikti irangos konfiguracija ar kitus veiksmus, jus turite*\r\n* tureti atitinkama leidima.           *\r\n* Uz neteiseta prisijungima bei neteisetus veiksmus su iranga taikoma*\r\n* istatymuose numatyta atsakomybe,iskaitant ir baudziamaja atsakomybe*\r\n* Prasome atsijungti.Jeigu jus esate autorizuotas vartotojas, *\r\n* prisijungdamas, jus atsakote uz teisingai atlikta konfiguracija ir *\r\n* kitus savo vardu atliktus veiksmus.        *\r\n**********************************************************************\r\n* You are connected to private equipment. All the actions performed *\r\n* with the equipment are recorded. In order to access this equipment *\r\n* and (or) perform its configuration or other actions, you must have*\r\n* an appropriate permission. Illegal connection and illegal actions *\r\n* with the equipment.            *\r\n* Will be subject to liability, including criminal liability, as  *\r\n* provided for in the laws of the Republic of Lithuania. Please  *\r\n* disconnect immediately. If you are an authorized user, by   *\r\n* connecting to the equipment, you assume liability for performing *\r\n* correct configuration and other actions under your behalf.   *\r\n**********************************************************************\r\nUser Authentication\r\npacket_write_wait: Connection to 10.46.1.1 port 22: Broken pipe\r\n", 
    "unreachable": true 
} 

osboxes @ osboxes:〜$ sudo ansible -m ping servers

10.46.1.1 | UNREACHABLE! => { 
    "changed": false, 
    "msg": "Failed to connect to the host via ssh: \r\n**********************************************************************\r\n* Jus esate prisijunge prie privacios irangos. Visi veiksmai,vykdomi *\r\n* su sia iranga, yra fiksuojami. Tam, kad prieiti prie sios irangos *\r\n* ir (ar) atlikti irangos konfiguracija ar kitus veiksmus, jus turite*\r\n* tureti atitinkama leidima.           *\r\n* Uz neteiseta prisijungima bei neteisetus veiksmus su iranga taikoma*\r\n* istatymuose numatyta atsakomybe,iskaitant ir baudziamaja atsakomybe*\r\n* Prasome atsijungti.Jeigu jus esate autorizuotas vartotojas, *\r\n* prisijungdamas, jus atsakote uz teisingai atlikta konfiguracija ir *\r\n* kitus savo vardu atliktus veiksmus.        *\r\n**********************************************************************\r\n* You are connected to private equipment. All the actions performed *\r\n* with the equipment are recorded. In order to access this equipment *\r\n* and (or) perform its configuration or other actions, you must have*\r\n* an appropriate permission. Illegal connection and illegal actions *\r\n* with the equipment.            *\r\n* Will be subject to liability, including criminal liability, as  *\r\n* provided for in the laws of the Republic of Lithuania. Please  *\r\n* disconnect immediately. If you are an authorized user, by   *\r\n* connecting to the equipment, you assume liability for performing *\r\n* correct configuration and other actions under your behalf.   *\r\n**********************************************************************\r\nUser Authentication\r\nchannel_by_id: 2: bad id: channel free\r\nDisconnecting: Received data for nonexistent channel 2.\r\n", 
    "unreachable": true 
} 

它只是連接並立即斷開連接而不輸入任何命令,如「顯示版本」。難道是因爲我不是在思科設備上運行它,而是在其他供應商上運行它?也許需要一些特殊模塊?

謝謝

回答

0

您是否確認可以通過ssh正常連接到這些機器?您是否在您嘗試連接的計算機上創建了一個完整的帳戶? 這聽起來像是試圖在主機上運行ansible的用戶帳戶,可能在主機上沒有ssh密鑰。你試過

ssh-copy-id [email protected] 

,並確認您可以登錄到該主機

ssh [email protected] 

用鑰匙?

+0

的用戶是比「ansible」等。所以ssh user @ host工作。我編輯了etc/ansible/hosts文件這一行:[servers] 10.46.1.1 ansible_ssh_user = user ansible_ssh_pass = pasword ansible_ssh_common_arg =「 - o HostKeyAlgorithms = ssh-rsa -o KexAlgorithms = diffie-hellman-group1-sha1 -o Ciphers = aes256-cbc,3des-cbc -o MACs = hmac-md5,hmac-sha2-512「也編輯了/ etc/ansible/group_vars/servers文件這個輸入:ansible_ssh_user:user。那麼,什麼可能是不夠的?謝謝 – Edvinas

0

您可以使用與'shell'不同的其他模塊來訪問華爲設備。如果你看看here,你會看到一些雲引擎模塊。 Shell模塊用於服務器,不用於交換機。

所以,我會寫這樣的事:ansible -m ce_command -a「顯示版本」服務器