Closed aohan0503 closed 3 years ago
Hi @aohan0503
When you use DefaultExecutor
already shows the errors
I forced an ansible parser error on signals-and-cancellation-ansibleplaybook
example and that is the result:
go-ansible/examples/signals-and-cancellation-ansibleplaybook❯ go run signals-and-cancellation-ansibleplaybook.go
ERROR! We were unable to read either as JSON nor YAML, these are the errors we got from each:
JSON: Expecting value: line 1 column 1 (char 0)
Syntax Error while loading YAML.
did not find expected '-' indicator
The error appears to be in '/home/aleix/projects/aleix.penella/go-ansible/examples/signals-and-cancellation-ansibleplaybook/site.yml': line 7, column 6, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: signals-and-cancellation-ansibleplaybook
debug:
^ here
Error during command execution: ansible-playbook error: parser error
Command executed: /home/aleix/.local/bin/ansible-playbook --inventory 127.0.0.1, --connection local --user aleix site.yml
Could you share some code snippets If you need more help?
Thanks!
hi @aohan0503! There is any update about your issue?
Thanks!
hi @apenella I want to get the stderr when ansible is executed ,errors like parsing errors。 Get stderr through go-ansible
Use execute.WithWriteError() method to get
Thanks!
Hi @aohan0503! I understand that you figured out how to solve it. Do you need anything else? Would you mind If I am closing that issue?
@apenella This issue can now be clos
like this