Hello Experts,

Can someone reply.

On Tue, Jun 15, 2021 at 7:54 PM subrat mangaraj <subrat.manga...@gmail.com>
wrote:

> Hello Experts
> Can someone guide here.
> Br//
> Subrat
>
> On Mon, 14 Jun 2021, 21:53 subrat mangaraj, <subrat.manga...@gmail.com>
> wrote:
>
>> Hello Reg,
>> Can you share your inputs.
>> I am trying to fetch show output from ASR Cisco devices using Mac PC via
>> jump host to managed host.It should run all cli command from playbook and
>> login all modes using jump host and save different files into destination
>> path.
>> But for me it’s looks like issue in python version   With ansible
>> installed using brew.
>> I am not able to connect to managed hosts.
>> Br//
>> Subrat
>>
>> On Thu, 10 Jun 2021 at 7:51 PM, subrat mangaraj <
>> subrat.manga...@gmail.com> wrote:
>>
>>> Thanks Reg for your reply. Yes i can able to ping and able to do ssh to
>>> the server.
>>>
>>> In simpler way from MaC terminal i can directly login to the server via
>>> jump server. There is no issue looks like in .ssh configuration.
>>>
>>> Is there any issue in python version with brew ansible.
>>>
>>>
>>> Ansible.cfg config
>>>
>>> [defaults]:
>>> inventory = /etc/ansible/hosts
>>> ansible_python_interpreter=/usr/bin/python3
>>> host_key_checking = no
>>> look_for_keys = False
>>>
>>>
>>> .ssh config
>>> sh-3.2# cat /Users/veda/.ssh/config
>>> Host tot
>>>   Hostname x.x.x.x
>>>   User veda1
>>>   IdentityFile /Users/veda/.ssh/id_rsa
>>>   IdentitiesOnly yes
>>>
>>>
>>> [epc]
>>> y.y.y.y
>>>
>>> Hosts file
>>> [test:vars]
>>> ansible_connection=network_cli
>>> use_persistent_connections=yes
>>> ansible_port=22
>>> ansible_ssh_port=22
>>> ansible_network_os=ios
>>> ansible_user=ravi
>>> #ansible_ssh_user=ravi
>>> #ansible_ssh_password=xxxx
>>> ansible_password=xxxx
>>>
>>> Getting this error
>>>  "msg": "[Errno None] Unable to connect to port 22 on y.y.y.y" Looks
>>> like playbook trying to run root user
>>>
>>>
>>> If i am changing this in ansible.cfg getting this error.
>>>
>>>
>>> defaults]:
>>> inventory = /etc/ansible/hosts
>>> ansible_python_interpreter=/usr/bin/python3
>>> host_key_checking = no
>>> look_for_keys = False
>>> sh-3.2# cat ansible.cfg
>>> [defaults]:
>>> inventory = /etc/ansible/epchosts
>>> ansible_python_interpreter=/usr/bin/python3
>>> host_key_checking = no
>>> look_for_keys = False
>>> [paramiko_connection]
>>> proxy_command = "ssh -6 -W \[%h\]:%p veda@x.x.x.x"
>>>
>>> TASK [prepare SSD]
>>> ***********************************************************************************************************************************************
>>> task path: /private/etc/ansible/test3.yaml:6
>>> redirecting (type: connection) ansible.builtin.network_cli to
>>> ansible.netcommon.network_cli
>>> redirecting (type: terminal) ansible.builtin.ios to cisco.ios.ios
>>> redirecting (type: cliconf) ansible.builtin.ios to cisco.ios.ios
>>> <y.y.y.y> attempting to start connection
>>> <y.y.y.y> using connection plugin ansible.netcommon.network_cli
>>> Found ansible-connection at path /usr/local/bin/ansible-connection
>>> <y.y.y.y> local domain socket does not exist, starting it
>>> <y.y.y.y> control socket path is /private/var/root/.ansible/pc/d7c20f3db8
>>> <y.y.y.y> redirecting (type: connection) ansible.builtin.network_cli to
>>> ansible.netcommon.network_cli
>>> <y.y.y.y> Loading collection ansible.netcommon from
>>> /var/root/.ansible/collections/ansible_collections/ansible/netcommon
>>> <y.y.y.y> redirecting (type: terminal) ansible.builtin.ios to
>>> cisco.ios.ios
>>> <y.y.y.y> Loading collection cisco.ios from
>>> /usr/local/Cellar/ansible/3.4.0/libexec/lib/python3.9/site-packages/ansible_collections/cisco/ios
>>> <y.y.y.y> redirecting (type: cliconf) ansible.builtin.ios to
>>> cisco.ios.ios
>>> <y.y.y.y> local domain socket listeners started successfully
>>> <y.y.y.y> loaded cliconf plugin
>>> ansible_collections.cisco.ios.plugins.cliconf.ios from path
>>> /usr/local/Cellar/ansible/3.4.0/libexec/lib/python3.9/site-packages/ansible_collections/cisco/ios/plugins/cliconf/ios.py
>>> for network_os ios
>>> <y.y.y.y>
>>> <y.y.y.y> local domain socket path is
>>> /private/var/root/.ansible/pc/d7c20f3db8
>>> redirecting (type: action) cisco.ios.ios_command to cisco.ios.ios
>>> redirecting (type: action) cisco.ios.ios_command to cisco.ios.ios
>>> <y.y.y.y> ANSIBLE_NETWORK_IMPORT_MODULES: disabled
>>> <y.y.y.y> ANSIBLE_NETWORK_IMPORT_MODULES: module execution time may be
>>> extended
>>> <y.y.y.y> ESTABLISH LOCAL CONNECTION FOR USER: root
>>> <y.y.y.y> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo
>>> /var/root/.ansible/tmp/ansible-local-3053t1ampmv5 `"&& mkdir "` echo
>>> /var/root/.ansible/tmp/ansible-local-3053t1ampmv5/ansible-tmp-1623334715.304031-3056-261623273235832
>>> `" && echo ansible-tmp-1623334715.304031-3056-261623273235832="` echo
>>> /var/root/.ansible/tmp/ansible-local-3053t1ampmv5/ansible-tmp-1623334715.304031-3056-261623273235832
>>> `" ) && sleep 0'
>>> Including module_utils file ansible/__init__.py
>>> Including module_utils file ansible/module_utils/__init__.py
>>> Including module_utils file ansible/module_utils/_text.py
>>> Including module_utils file ansible/module_utils/basic.py
>>> Including module_utils file
>>> ansible/module_utils/common/_collections_compat.py
>>> Including module_utils file ansible/module_utils/common/__init__.py
>>> Including module_utils file ansible/module_utils/common/_json_compat.py
>>> Including module_utils file ansible/module_utils/common/_utils.py
>>> Including module_utils file ansible/module_utils/common/file.py
>>> Including module_utils file ansible/module_utils/common/parameters.py
>>> Including module_utils file ansible/module_utils/common/collections.py
>>> Including module_utils file ansible/module_utils/common/process.py
>>> Including module_utils file ansible/module_utils/common/sys_info.py
>>> Including module_utils file
>>> ansible/module_utils/common/text/converters.py
>>> Including module_utils file ansible/module_utils/common/text/__init__.py
>>> Including module_utils file
>>> ansible/module_utils/common/text/formatters.py
>>> Including module_utils file ansible/module_utils/common/validation.py
>>> Including module_utils file ansible/module_utils/common/warnings.py
>>> Including module_utils file ansible/module_utils/compat/selectors.py
>>> Including module_utils file ansible/module_utils/compat/__init__.py
>>> Including module_utils file ansible/module_utils/compat/_selectors2.py
>>> Including module_utils file ansible/module_utils/distro/__init__.py
>>> Including module_utils file ansible/module_utils/distro/_distro.py
>>> Including module_utils file ansible/module_utils/parsing/convert_bool.py
>>> Including module_utils file ansible/module_utils/parsing/__init__.py
>>> Including module_utils file ansible/module_utils/pycompat24.py
>>> Including module_utils file ansible/module_utils/six/__init__.py
>>> Including module_utils file
>>> ansible_collections/ansible/netcommon/plugins/module_utils/network/common/parsing.py
>>> Including module_utils file ansible_collections/__init__.py
>>> Including module_utils file ansible_collections/ansible/__init__.py
>>> Including module_utils file
>>> ansible_collections/ansible/netcommon/__init__.py
>>> Including module_utils file
>>> ansible_collections/ansible/netcommon/plugins/__init__.py
>>> Including module_utils file
>>> ansible_collections/ansible/netcommon/plugins/module_utils/__init__.py
>>> Including module_utils file
>>> ansible_collections/ansible/netcommon/plugins/module_utils/network/__init__.py
>>> Including module_utils file
>>> ansible_collections/ansible/netcommon/plugins/module_utils/network/common/__init__.py
>>> Including module_utils file
>>> ansible_collections/ansible/netcommon/plugins/module_utils/network/common/utils.py
>>> Including module_utils file ansible/module_utils/common/network.py
>>> Including module_utils file
>>> ansible_collections/cisco/ios/plugins/module_utils/network/ios/ios.py
>>> Including module_utils file ansible/module_utils/connection.py
>>> Including module_utils file ansible/module_utils/common/json.py
>>> Including module_utils file ansible_collections/cisco/__init__.py
>>> Including module_utils file ansible_collections/cisco/ios/__init__.py
>>> Including module_utils file
>>> ansible_collections/cisco/ios/plugins/__init__.py
>>> Including module_utils file
>>> ansible_collections/cisco/ios/plugins/module_utils/__init__.py
>>> Including module_utils file
>>> ansible_collections/cisco/ios/plugins/module_utils/network/__init__.py
>>> Including module_utils file
>>> ansible_collections/cisco/ios/plugins/module_utils/network/ios/__init__.py
>>> 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
>>> <y.y.y.y> PUT
>>> /private/var/root/.ansible/tmp/ansible-local-3053t1ampmv5/tmpnjsvn1oo TO
>>> /private/var/root/.ansible/tmp/ansible-local-3053t1ampmv5/ansible-tmp-1623334715.304031-3056-261623273235832/AnsiballZ_ios_command.py
>>> <y.y.y.y> EXEC /bin/sh -c 'chmod u+x
>>> /var/root/.ansible/tmp/ansible-local-3053t1ampmv5/ansible-tmp-1623334715.304031-3056-261623273235832/
>>> /var/root/.ansible/tmp/ansible-local-3053t1ampmv5/ansible-tmp-1623334715.304031-3056-261623273235832/AnsiballZ_ios_command.py
>>> && sleep 0'
>>> <y.y.y.y> EXEC /bin/sh -c '/usr/bin/python2
>>> /var/root/.ansible/tmp/ansible-local-3053t1ampmv5/ansible-tmp-1623334715.304031-3056-261623273235832/AnsiballZ_ios_command.py
>>> && sleep 0'
>>> <y.y.y.y> EXEC /bin/sh -c 'rm -f -r
>>> /var/root/.ansible/tmp/ansible-local-3053t1ampmv5/ansible-tmp-1623334715.304031-3056-261623273235832/
>>> > /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_TLabVW/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_TLabVW/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)
>>> fatal: [y.y.y.y]: FAILED! => {
>>>     "changed": false,
>>>     "invocation": {
>>>         "module_args": {
>>>             "commands": [
>>>                 "show version"
>>>             ],
>>>             "interval": 1,
>>>             "match": "all",
>>>             "provider": null,
>>>             "retries": 10,
>>>             "wait_for": null
>>>
>>>
>>> *     }    },    "msg": "Error reading SSH protocol banner"*
>>>
>>>
>>>
>>> *Br//*
>>> *Subrat*
>>>
>>> *9535633166*
>>>
>>>
>>> On Thu, Jun 10, 2021 at 7:25 PM reg...@gmail.com <regl...@gmail.com>
>>> wrote:
>>>
>>>> *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
>>>> <https://groups.google.com/d/msgid/ansible-project/d266d028-6522-4399-872a-3193af553f13n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>
>>>
>>> --
>>> Thanks & Regards
>>> Subrat Kumar Mangaraj
>>> 09937391632
>>>
>> --
>> Thanks & Regards
>> Subrat Kumar Mangaraj
>> 09937391632
>>
>

-- 
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/CAH%2BWMWxR1N%3D9S1Fo-c%2BSoLyvEpQ7csPY7Uvg%3D9boGvrg8y-WpQ%40mail.gmail.com.

Reply via email to