*Also i can see it is trying connection with user root although i have 
defined new user to login to the managed hosts.*

First, I would check if the user can login to that server normally. If not, 
Ansible won't be able to connect either. :)

When you run the playbook are you running it logged in as that user? If 
not, it's not a huge deal specify the user with --user (two dashes there)

Like.. ansible-playbook ./testplaybook.yml --user subu

Add --ask-pass if you want it to prompt for the user's password. 






On Thursday, June 10, 2021 at 9:37:16 AM UTC-4 subrat....@gmail.com wrote:

> Hello Experts,
>
> Can someone suggest.
>
> On Mon, Jun 7, 2021 at 4:35 PM subrat mangaraj <subrat....@gmail.com> 
> wrote:
>
>> Hello Experts,
>> Any lead.
>>
>> On Sunday, June 6, 2021 at 1:01:41 PM UTC+5:30 subrat mangaraj wrote:
>>
>>> Hello Experts,
>>>
>>> I have installed ansible using homebrew.
>>>
>>> While trying  to run few IOS command from my mac PC via jump server I am 
>>> getting below errors.
>>>
>>> *<x.x.x.x1> ESTABLISH LOCAL CONNECTION FOR USER: root*
>>> <x.x.x.x1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo 
>>> /var/root/.ansible/tmp/ansible-local-13708nory1o1s `"&& mkdir "` echo 
>>> /var/root/.ansible/tmp/ansible-local-13708nory1o1s/ansible-tmp-1622963425.282479-13711-84468633356984
>>>  
>>> `" && echo ansible-tmp-1622963425.282479-13711-84468633356984="` echo 
>>> /var/root/.ansible/tmp/ansible-local-13708nory1o1s/ansible-tmp-1622963425.282479-13711-84468633356984
>>>  
>>> `" ) && sleep 0'
>>> <x.x.x.x1> Attempting python interpreter discovery
>>> <x.x.x.x1> EXEC /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'
>>> <x.x.x.x1> Python interpreter discovery fallback (unsupported platform 
>>> for extended discovery: darwin)
>>> Using module file 
>>> /usr/local/Cellar/ansible/3.4.0/libexec/lib/python3.9/site-packages/ansible_collections/cisco/ios/plugins/modules/ios_command.py
>>> <x.x.x.x1> PUT 
>>> /private/var/root/.ansible/tmp/ansible-local-13708nory1o1s/tmp0d1cl3d7 TO 
>>> /private/var/root/.ansible/tmp/ansible-local-13708nory1o1s/ansible-tmp-1622963425.282479-13711-84468633356984/AnsiballZ_ios_command.py
>>> <x.x.x.x1> EXEC /bin/sh -c 'chmod u+x 
>>> /var/root/.ansible/tmp/ansible-local-13708nory1o1s/ansible-tmp-1622963425.282479-13711-84468633356984/
>>>  
>>> /var/root/.ansible/tmp/ansible-local-13708nory1o1s/ansible-tmp-1622963425.282479-13711-84468633356984/AnsiballZ_ios_command.py
>>>  
>>> && sleep 0'
>>> <x.x.x.x1> EXEC /bin/sh -c '/usr/bin/python 
>>> /var/root/.ansible/tmp/ansible-local-13708nory1o1s/ansible-tmp-1622963425.282479-13711-84468633356984/AnsiballZ_ios_command.py
>>>  
>>> && sleep 0'
>>> <x.x.x.x1> EXEC /bin/sh -c 'rm -f -r 
>>> /var/root/.ansible/tmp/ansible-local-13708nory1o1s/ansible-tmp-1622963425.282479-13711-84468633356984/
>>>  
>>> > /dev/null 2>&1 && sleep 0'
>>> The full traceback is:
>>> WARNING: The below traceback may *not* be related to the actual failure.
>>>   File 
>>> "/tmp/ansible_cisco.ios.ios_command_payload_LjBijq/ansible_cisco.ios.ios_command_payload.zip/ansible_collections/cisco/ios/plugins/module_utils/network/ios/ios.py",
>>>  
>>> line 94, in get_capabilities
>>>     capabilities = Connection(module._socket_path).get_capabilities()
>>>   File 
>>> "/tmp/ansible_cisco.ios.ios_command_payload_LjBijq/ansible_cisco.ios.ios_command_payload.zip/ansible/module_utils/connection.py",
>>>  
>>> line 195, in __rpc__
>>>     raise ConnectionError(to_text(msg, errors='surrogate_then_replace'), 
>>> code=code)
>>> [WARNING]: Platform darwin on host x.x.x.x1 is using the discovered 
>>> Python interpreter at /usr/bin/python, but future installation
>>> of another Python interpreter could change the meaning of that path. See
>>>
>>> https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html
>>>  
>>> for more information.
>>> fatal: [x.x.x.x1]: FAILED! => {
>>>     "ansible_facts": {
>>>         "discovered_interpreter_python": "/usr/bin/python"
>>>     },
>>>     "changed": false,
>>>     "invocation": {
>>>         "module_args": {
>>>             "commands": [
>>>                 "show version"
>>>             ],
>>>             "interval": 1,
>>>             "match": "all",
>>>             "provider": null,
>>>             "retries": 10,
>>>             "wait_for": null
>>>         }
>>>     },
>>>     "msg": "[Errno None] Unable to connect to port 22 on x.x.x.x1"
>>>
>>>
>>> ansible 2.10.9
>>>   config file = /private/etc/ansible/ansible.cfg
>>>   configured module search path = ['/var/root/.ansible/plugins/modules', 
>>> '/usr/share/ansible/plugins/modules']
>>>   ansible python module location = 
>>> /usr/local/Cellar/ansible/3.4.0/libexec/lib/python3.9/site-packages/ansible
>>>   executable location = /usr/local/bin/ansible
>>>   python version = 3.9.5 (default, May  4 2021, 03:36:27) [Clang 12.0.0 
>>> (clang-1200.0.32.29)]
>>>
>>> Also i can see it is trying connection with user root although i have 
>>> defined new user to login to the managed hosts.
>>>
>>> Host test1
>>>   Hostname x.x.x.x
>>>   User subu
>>>   IdentityFile ~/.ssh/id_rsa
>>> Host test2
>>>    Hostname *
>>>    User subu
>>>    ProxyJump test1
>>>    ForwardAgent yes
>>>
>>>
>>> host file configuration
>>>
>>> bbb  
>>> ansible_connection=network_cli
>>> use_persistent_connections=yes
>>> ansible_port=22
>>> ansible_ssh_port=22
>>> ansible_network_os=ios
>>> ansible_user=admin
>>> ansible_ssh_user=admin
>>> ansible_ssh_password=xxx
>>> ansible_password=yyy
>>>
>>> ansible.cfg
>>> [defaults]:
>>> inventory = /etc/ansible/bbb
>>> #ask_pass = true
>>> ansible_python_interpreter=/usr/bin/python3
>>> ansible_connection=ssh
>>> ansible_port=22
>>> ansible_ssh_port=22
>>> host_key_checking = no 
>>>
>>> Br//
>>> Subrat
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to ansible-proje...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/8bf84ba1-fcda-4864-842f-9a20005c53cfn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/8bf84ba1-fcda-4864-842f-9a20005c53cfn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> -- 
> Thanks & Regards
> Subrat Kumar Mangaraj
> 09937391632
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/d266d028-6522-4399-872a-3193af553f13n%40googlegroups.com.

Reply via email to