1

对于核心模块 junos_config 的 Ansible 2.3,我们会收到错误“无法打开 shell”。

我的剧本

25      tasks:
26        - name:          Build configuration
27          template:      src={{ playbook_dir }}/bgp.j2 dest={{ build }}/{{ inventory_hostname }}.conf
28          notify:
29            -            Pushing config ... please wait
30      handlers:
31        - name:          Pushing config ... please wait
32          junos_config:
33            host:        "{{ inventory_hostname }}"
34            provider:    "{{ credentials }}"
35            src:         "{{ build }}/{{ inventory_hostname }}.conf"
36            src_format:  set
37            comment:     "config by Ansible junos_config"

输出:

seanw@seanw-mbp:~/bgp$ ansible-playbook pb2.bgp.yml

 PLAY [Create config/build directory] 
 *******************************************

 TASK [Remove build directory] 
 **************************************************
 changed: [localhost]


 RUNNING HANDLER [Pushing config ... please wait] 
******************************************************
fatal: [vsrx1]: FAILED! => {"changed": false, "failed": true, "msg": "unable to open shell. Please see: 
https://docs.ansible.com/ansible/network_debug_troubleshooting.html#unable-to-open-shell", "rc": 255}
fatal: [vsrx2]: FAILED! => {"changed": false, "failed": true, "msg": "unable to open shell. Please see: 
https://docs.ansible.com/ansible/network_debug_troubleshooting.html#unable-to-open-shell", "rc": 255}

这适用于 Ansible 2.2

4

1 回答 1

2

在 Ansible-2.3 中,默认检查 SSH 主机密钥。由于此检查,您可能会遇到此错误。您可能想尝试在 ansible.cfg 中暂时禁用此设置

更多细节在这里: http ://docs.ansible.com/ansible/intro_configuration.html#host-key-checking

于 2017-06-15T08:36:36.347 回答