Oracle library cache


Connection timed out during banner exchange

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# inventory.yml
10.238.4.45 ansible_ssh_common_args='-o ProxyCommand="ssh -W %h:%p -q ansible@10.238.81.239"'
10.246.3.11 ansible_ssh_common_args='-o ProxyCommand="ssh -W %h:%p -q ansible@10.246.81.162"'

# pb.yml
---
- hosts: all
become: true
become_user: root
gather_facts: True

tasks:
- name: pwd
shell: pwd
register: location
- name: debug out
debug:
msg: "{{ location }}"
1
2
3
4
5
6
7
8
9
10
# output  1
10.238.4.45 UNREACHABLE! => {"changed": false, "msg": "Authentication or permission failure. In some cases, you may have been able to authenticate and did not have permissions on the target directory. Consider changing the remote tmp path in ansible.cfg to a path rooted in \"/tmp\". Failed command was: ( umask 77 && mkdir -p \"` echo ~/.ansible/tmp/ansible-tmp-1637588359.02-24546627978751 `\" && echo ansible-tmp-1637588359.02-24546627978751=\"` echo ~/.ansible/tmp/ansible-tmp-1637588359.02-24546627978751 `\" ), exited with result 1", "unreachable": true}

# output 2
[ansible@master tmp]$ ansible -i inventory.yml all -m ping
10.238.4.45 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: Connection timed out during banner exchange",
"unreachable": true
}

ssh_exchange_identification: Connection closed by remote host

1
10.204.91.34 ansible_ssh_common_args='-o ProxyCommand="ssh -W %h:%p -q ansible@10.204.91.239"'
1
2
3
4
5
6
7
8
9
10
11
12
# output 1
fatal: [10.204.91.34]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: ssh_exchange_identification: Connection closed by remote host"

#
[ansible@master tmp]$ ansible -i inventory.yml all -m ping
10.204.91.34 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": false,
"ping": "pong"
}

setup module failed

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# inventory.yml


# pb.yml
---
- hosts: all
become: true
become_user: root
gather_facts: True

tasks:
- name: pwd
shell: pwd
register: location
- name: debug out
debug:
msg: "{{ location }}"
1
2
3
4
5
6
7
8
9
10
11
# output
fatal: [10.231.213.42]: FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python"}, "changed": false, "module_stderr": "Shared connection to 10.231.213.42 closed.\r\n", "module_stdout": "sudo: a password is required\r\n", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

# succeed outpu
10.231.213.42 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": false,
"ping": "pong"
}

ansible playbook在执行过程中卡住

这种情况下,并不知道ansibe 当前执行到的主机是哪一台,无法进行下去。

1
2
3
10.232.17.69 ansible_ssh_common_args='-o ProxyCommand="ssh -W %h:%p -q ansible@10.232.81.239"'
10.232.17.82 ansible_ssh_common_args='-o ProxyCommand="ssh -W %h:%p -q ansible@10.232.81.239"'
10.232.17.80 ansible_ssh_common_args='-o ProxyCommand="ssh -W %h:%p -q ansible@10.232.81.239"'
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
[ansible@master tmp]$ ansible -i inventory.yml  all -m ping
10.232.17.80 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": false,
"ping": "pong"
}
10.232.17.82 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": false,
"ping": "pong"
}


...卡住不动了
10.232.17.69 ansible_ssh_common_args='-o ProxyCommand="ssh -W %h:%p -q ansible@10.232.81.239"'
然而,10.232.17.69上有代理用户ansible并且跟10.232.81.239代理是联通的。

^C [ERROR]: User interrupted execution

```