We would like to execute a package comparer to compare Chocolatey packages from the local repository with the public repository. Now when we execute the playbook, the copy of the script goes well but the execution of the script goes good too but then fails for some reason. Maybe one of you could help me with this?
tasks:
- name: Copy powershell file to Chocolatey server
win_copy:
src: ../powershell/package_comparer.ps1
dest: C:\Temp\
- name: Executing Powershell script
win_shell: C:\Temp\package_comparer.ps1
changed_when: false
register: result
- name: parse .json file
set_fact:
packages_result: "{{(result.stdout | from_json)}}"
- debug:
msg: "{{ packages_results }}"
That we can execute this without error.. As I get now this error:
[WARNING]: Failure using method (v2_runner_on_failed) in callback plugin (<ansible.plugins.callback.yaml.CallbackModule object at 0x7fecd4ee8910>): value must be a string
Callback Exception:
File "/usr/lib/python2.7/site-packages/ansible/executor/task_queue_manager.py", line 333, in send_callback
method(*new_args, **kwargs)
File "/usr/lib/python2.7/site-packages/ansible/plugins/callback/default.py", line 93, in v2_runner_on_failed
self._display.display("fatal: [%s]: FAILED! => %s" % (result._host.get_name(), self._dump_results(result._result)),
File "/usr/lib/python2.7/site-packages/ansible/plugins/callback/yaml.py", line 123, in _dump_results
dumped += to_text(yaml.dump(abridged_result, allow_unicode=True, width=1000, Dumper=AnsibleDumper, default_flow_style=False))
File "/usr/lib64/python2.7/site-packages/yaml/__init__.py", line 293, in dump
return dump_all([data], stream, Dumper=Dumper, **kwds)
File "/usr/lib64/python2.7/site-packages/yaml/__init__.py", line 281, in dump_all
dumper.represent(data)
File "/usr/lib64/python2.7/site-packages/yaml/representer.py", line 30, in represent
self.serialize(node)
File "_yaml.pyx", line 1348, in _yaml.CEmitter.serialize (ext/_yaml.c:15963)
File "_yaml.pyx", line 1510, in _yaml.CEmitter._serialize_node (ext/_yaml.c:18037)
File "_yaml.pyx", line 1431, in _yaml.CEmitter._serialize_node (ext/_yaml.c:17021)
PLAY RECAP **********************************************************************************************************************************************************************************************
host_machine : ok=1 changed=1 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0