Hello!
Im new to ansible, and have a problem which i just cannot solve:
I use some very simple playbooks to do simple tasks in clasroom management on linux clients (ubuntu).
I.e. i use a playbook for shutting them down. Everything works fine except for one single host.
Whenever I try to use a playbok on a list ho hosts wicht contain this host, I get an error message
for the host about wrong UTF-8 encoding while ansible-playbook is "GATHERING INFORMATION".
Regular ansible commands are working fine on the host, I can shut it down by executing
ansible -i hosts r110-ws16 -a "shutdown -h now"but not with
ansible-playbook -i hosts -l r110-ws16 shutdown.yml which shuts down all other hosts just fine.
I also use a playbook which runs locally (wakeonlan from the server). When this client is powered off,
everything is fine, the host starts up like all the other hosts.
So i figure the problem ist something that is returned from the host while gathering information.
But I have no idea how I can debug this further, any hint would be highly appreciated.
Thank you,
Frank
--
The host not working is r110-ws16
Ansible-playbook gives me this:
ansible-playbook -i hosts -l r110-ws16 shutdown.yml
PLAY [all] ********************************************************************
GATHERING FACTS ***************************************************************
failed to parse json: chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib/python2.7/json/encoder.py", line 264, in iterencode
return _iterencode(o, 0)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xe7 in position 0: invalid continuation byte
fatal: [r110-ws16] => Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/ansible/runner/__init__.py", line 394, in _executor
exec_rc = self._executor_internal(host, new_stdin)
File "/usr/lib/python2.7/dist-packages/ansible/runner/__init__.py", line 485, in _executor_internal
return self._executor_internal_inner(host, self.module_name, self.module_args, inject, port, complex_args=complex_args)
File "/usr/lib/python2.7/dist-packages/ansible/runner/__init__.py", line 685, in _executor_internal_inner
result = handler.run(conn, tmp, module_name, module_args, inject, complex_args)
File "/usr/lib/python2.7/dist-packages/ansible/runner/action_plugins/normal.py", line 54, in run
return self.runner._execute_module(conn, tmp, module_name, module_args, inject=inject, complex_args=complex_args)
File "/usr/lib/python2.7/dist-packages/ansible/runner/__init__.py", line 369, in _execute_module
data = utils.parse_json(res['stdout'])
File "/usr/lib/python2.7/dist-packages/ansible/utils/__init__.py", line 306, in parse_json
tokens = shlex.split(data)
File "/usr/lib/python2.7/shlex.py", line 279, in split
return list(lex)
File "/usr/lib/python2.7/shlex.py", line 269, in next
token = self.get_token()
File "/usr/lib/python2.7/shlex.py", line 96, in get_token
raw = self.read_token()
File "/usr/lib/python2.7/shlex.py", line 172, in read_token
raise ValueError, "No closing quotation"
ValueError: No closing quotation
PLAY RECAP ********************************************************************
to retry, use: --limit @/root/shutdown.retry
r110-ws16 : ok=0 changed=0 unreachable=1 failed=0 The host file looks like follows:
[raum107]
r107-ws[01:15]
[raum110]
r110-ws[01:16]
[raum114]
r114-ws01
[computerraeume:children]
raum107
raum110
[auto-onoff:children]
raum110
raum107
raum114The playbook is this (but the problem is the same with all other playbooks, as soon the client is powered on)
---
- hosts: all
serial: 5
tasks:
- name: Shutting down remote workstations
shell: /sbin/shutdown -h now