1609
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
-o StrictHostKeyChecking=no
|
||||
-o UserKnownHostsFile=/dev/null
|
||||
-o NumberOfPasswordPrompts=1
|
||||
-o ConnectTimeout=30
|
||||
-o ConnectTimeout=15
|
||||
|
||||
rmq_host: "{{ lookup('env','RMQ_HOST') | default('10.210.12.2', true) }}"
|
||||
rmq_port: "{{ lookup('env','RMQ_PORT') | default('15672', true) }}"
|
||||
@@ -602,18 +602,33 @@
|
||||
when: tunnel_ok|default(false)
|
||||
delegate_to: localhost
|
||||
shell: |
|
||||
for f in basicpass basicpass2; do
|
||||
PORT="{{ _local_port }}"
|
||||
if sshpass -f "$f" ssh -o StrictHostKeyChecking=no -o PubkeyAuthentication=no \
|
||||
-p "$PORT" root@127.0.0.1 "echo ok" >/dev/null 2>&1; then
|
||||
echo "$f"; exit 0
|
||||
# First try: basicpass
|
||||
if timeout {{ ssh_timeout }}s sshpass -f basicpass ssh {{ ssh_opts_common }} \
|
||||
-o ConnectionAttempts=1 -o ConnectTimeout={{ ssh_timeout }} \
|
||||
-p "$PORT" "{{ dev2_ssh_user }}@127.0.0.1" "echo ok" >/dev/null 2>&1; then
|
||||
echo basicpass
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
|
||||
# Second try: basicpass2
|
||||
if timeout {{ ssh_timeout }}s sshpass -f basicpass2 ssh {{ ssh_opts_common }} \
|
||||
-o ConnectionAttempts=1 -o ConnectTimeout={{ ssh_timeout }} \
|
||||
-p "$PORT" "{{ dev2_ssh_user }}@127.0.0.1" "echo ok" >/dev/null 2>&1; then
|
||||
echo basicpass2
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Both failed
|
||||
echo NONE
|
||||
exit 1
|
||||
args:
|
||||
executable: /bin/bash
|
||||
register: dev2_auth
|
||||
failed_when: false
|
||||
ignore_errors: true
|
||||
|
||||
|
||||
- name: Set dev2_passfile_used
|
||||
delegate_to: localhost
|
||||
set_fact:
|
||||
|
||||
Reference in New Issue
Block a user