ping is not working with ansible in max os

171 views
Skip to first unread message

ahmal...@gmail.com

unread,
Sep 22, 2017, 1:23:46 PM9/22/17
to Ansible Project
Hi, 
I have mac OS and already installed ansible, this is my first time to try it. I started it by using a simple ping to the local host, but it is not working please check below the output 


AHMALI-M-K035:~ ahmali$ ansible localhost -m ping

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 0: ordinal not in range(128)

localhost | FAILED! => {

    "failed": true, 

    "msg": "Unexpected failure during module execution.", 

    "stdout": ""

}

AHMALI-M-K035:~ ahmali$ ansible localhost -m ping -vvv

ansible 2.4.0.0

  config file = None

  configured module search path = [u'/Users/ahmali/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']

  ansible python module location = /Users/ahmali/anaconda/lib/python2.7/site-packages/ansible

  executable location = /Users/ahmali/anaconda/bin/ansible

  python version = 2.7.12 |Anaconda 4.2.0 (x86_64)| (default, Jul  2 2016, 17:43:17) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)]

No config file found; using defaults

Parsed /etc/ansible/hosts inventory source with ini plugin

META: ran handlers

The full traceback is:

Traceback (most recent call last):

  File "/Users/ahmali/anaconda/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 88, in run

    items = self._get_loop_items()

  File "/Users/ahmali/anaconda/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 181, in _get_loop_items

    self._play_context.update_vars(play_context_vars)

  File "/Users/ahmali/anaconda/lib/python2.7/site-packages/ansible/playbook/play_context.py", line 667, in update_vars

    var_val = getattr(self, prop)

  File "/Users/ahmali/anaconda/lib/python2.7/site-packages/ansible/playbook/base.py", line 58, in _generic_g_method

    return getattr(self, method)()

  File "/Users/ahmali/anaconda/lib/python2.7/site-packages/ansible/playbook/play_context.py", line 686, in _get_attr_connection

    if not check_for_controlpersist(self.ssh_executable):

  File "/Users/ahmali/anaconda/lib/python2.7/site-packages/ansible/utils/ssh_functions.py", line 38, in check_for_controlpersist

    cmd = subprocess.Popen([ssh_executable, '-o', 'ControlPersist'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)

  File "/Users/ahmali/anaconda/lib/python2.7/subprocess.py", line 711, in __init__

    errread, errwrite)

  File "/Users/ahmali/anaconda/lib/python2.7/subprocess.py", line 1343, in _execute_child

    raise child_exception

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 0: ordinal not in range(128)


localhost | FAILED! => {

    "failed": true, 

    "msg": "Unexpected failure during module execution.", 

    "stdout": ""

}

AHMALI-M-K035:~ ahmali$ 

Toshio Kuratomi

unread,
Sep 22, 2017, 4:39:43 PM9/22/17
to ansible...@googlegroups.com
Do you have nonascii characters in your path to the ssh binary? If
so, that would do it. I can put in a fix for that for 2.4.1.
> --
> 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 post to this group, send email to ansible...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/de08ea00-7978-4da6-9b6d-d3e54bda80bf%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Toshio Kuratomi

unread,
Sep 22, 2017, 4:45:57 PM9/22/17
to ansible...@googlegroups.com
Please give this PR a try to see if it solves the issue for you:
https://github.com/ansible/ansible/pull/30779

Ahmed Ali

unread,
Sep 22, 2017, 6:37:58 PM9/22/17
to ansible...@googlegroups.com
it works fine, 
really appreciate the fast reply 

AHMALI-M-K035:ansible ahmali$ ansible localhost -m ping

localhost | SUCCESS => {

    "changed": false, 

    "failed": false, 

    "ping": "pong"

}

AHMALI-M-K035:ansible ahmali$ 



> email to ansible-project+unsubscribe@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/inZcQamnqkk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAPrnkaQmonNr5shZgiqg8XNQMxL7d31Q2kzYm2UHDEGOuvkp7A%40mail.gmail.com.

Nuwan Vithanage

unread,
Sep 27, 2017, 1:32:34 AM9/27/17
to Ansible Project
Hi Mate 

try to ping with ansible localhost -m ping -u <system user> -k 
Reply all
Reply to author
Forward
0 new messages