Ansible Данные не могут быть отправлены на удаленный хост. Убедитесь, что этот хост доступен по ssh - PullRequest
0 голосов
/ 25 мая 2020

Я могу s sh успешно от источника ansible сервера source_user@10.0.0.110 (linux) до места назначения dest_user@10.0.0.111 (aix)

Однако то же самое не работает для моего ansible playbook.

Вот мой playbook:

---
  - hosts: localhost
    gather_facts: false
    tasks:

      - add_host: name={{ Dest_IP }}
                  groups=dest_nodes
                  ansible_user={{ User }}

  - hosts: dest_nodes
    gather_facts: false
    vars:
      ansible_ssh_extra_args: -o StrictHostKeyChecking=no
      ansible_ssh_private_key_file: /app/mykeys/axm_id_rsa

    tasks:

      - name: Start APP service
        include_tasks: "{{ playbook_dir }}/inner.yml"

Вот ошибка вывода моего прогона:

ansible-playbook test.yml -e Dest_IP=10.0.0.111 -e User=dest_user

TASK [Start service] ***************************************************************************************************************************************************
task path: /app/axmw/Ansible/playbook/finacle_start_stop/inner.yml:1
<10.0.0.111> Attempting python interpreter discovery
<10.0.0.111> ESTABLISH SSH CONNECTION FOR USER: dest_user
<10.0.0.111> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o 'IdentityFile="/app/mykeys/axm_id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="dest_user"' -o ConnectTimeout=10 -o StrictHostKeyChecking=no -o ControlPath=/home/source_user/.ansible/cp/8245e98279 10.0.0.111 '/bin/sh -c '"'"'echo PLATFORM; uname; echo FOUND; command -v '"'"'"'"'"'"'"'"'/usr/bin/python'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.7'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.6'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.5'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python2.7'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python2.6'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'/usr/libexec/platform-python'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'/usr/bin/python3'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python'"'"'"'"'"'"'"'"'; echo ENDFOUND && sleep 0'"'"''
<10.0.0.111> (0, 'PLATFORM\nAIX\nFOUND\n/usr/bin/python3.7\n/usr/bin/python3\nENDFOUND\n', 'This system is for the use of authorized users only. Individuals using this computer system without authority, or in excess of their authority, are subject to having all of their activities on this system monitored and recorded by system personnel. In the course of monitoring individuals improperly using this system, or in the course of system maintenance, the activities of authorized users may also be monitored. Anyone using this system expressly consents to such monitoring and is advised that if such such monitoring reveals possible evidence of criminal activity, system personnel may provide the evidence of such monitoring to the law enforcement officials\n')
<10.0.0.111> Python interpreter discovery fallback (unsupported platform for extended discovery: aix)
Using module file /usr/lib/python2.7/site-packages/ansible/modules/commands/command.py
Pipelining is enabled.
<10.0.0.111> ESTABLISH SSH CONNECTION FOR USER: dest_user
<10.0.0.111> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o 'IdentityFile="/app/mykeys/axm_id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="dest_user"' -o ConnectTimeout=10 -o StrictHostKeyChecking=no -o ControlPath=/home/source_user/.ansible/cp/8245e98279 10.0.0.111 '/bin/sh -c '"'"'/usr/bin/python3.7 && sleep 0'"'"''
fatal: [10.0.0.111]: UNREACHABLE! => {
    "changed": false,
    "msg": "Data could not be sent to remote host \"10.0.0.111\". Make sure this host can be reached over ssh: ",
    "unreachable": true
}

PLAY RECAP *************************************************************************************************************************************************************
10.0.0.111                 : ok=1    changed=0    unreachable=1    failed=0    skipped=0    rescued=0    ignored=0
localhost                  : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

Если я попробую команду s sh, сгенерированную ansible выше, она тоже будет работать !!

ssh -C -o ControlMaster=auto -o ControlPersist=60s -o 'IdentityFile="/app/mykeys/axm_id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="dest_user"' -o ConnectTimeout=10 -o StrictHostKeyChecking=no -o ControlPath=/home/source_user/.ansible/cp/8245e98279 10.0.0.111

Вот мой ansible .cfg, где я упомянул pipelining = True, поскольку это необходимо несколькими проектами.

[source_user@sourcehost ~]$ cat /etc/ansible/ansible.cfg | grep -v '#'


[defaults]
[inventory]
[privilege_escalation]
[paramiko_connection]

[ssh_connection]
pipelining = True
transfer_method = smart

[persistent_connection]
[accelerate]
[selinux]
[colors]
[diff]

Не могли бы вы подсказать, что можно сделать, чтобы решить эту проблему?

...