Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I run the example "ansibleplaybook-walk-through-json-output" #114

Closed
Yang-yyf opened this issue Nov 18, 2022 · 6 comments
Closed

Comments

@Yang-yyf
Copy link

When I run the example ansibleplaybook-walk-through-json-output.go, I met this err:
ERROR! Invalid callback for stdout specified: json
Error during command execution: ansible-playbook error: general error

What should I do?

@apenella
Copy link
Owner

HI @Yang-yyf
Thanks for your message.

I executed the example as it comes in the repository, and it works for me

❯ go run ansibleplaybook-walk-through-json-output.go
[127.0.0.1] that is just an example
[127.0.0.1] that is another example

I think that I would need more details, in order to help you.
Could you provide me a snippet from the output? Are you running the example as it is?

I tested it using the go-ansible's master branch, the ansible-core's version that I am using is 2.13.6 and the ansible version is 6.6.0.

❯ ansible --version
ansible [core 2.13.6]
  config file = ***
  configured module search path = ***
  ansible python module location = ***
  ansible collection location = ***
  executable location = ***
  python version = 3.10.6 (main, Nov  2 2022, 18:53:38) [GCC 11.3.0]
  jinja version = 3.1.2
  libyaml = True

@Yang-yyf
Copy link
Author

HI @Yang-yyf Thanks for your message.

I executed the example as it comes in the repository, and it works for me

❯ go run ansibleplaybook-walk-through-json-output.go
[127.0.0.1] that is just an example
[127.0.0.1] that is another example

I think that I would need more details, in order to help you. Could you provide me a snippet from the output? Are you running the example as it is?

I tested it using the go-ansible's master branch, the ansible-core's version that I am using is 2.13.6 and the ansible version is 6.6.0.

❯ ansible --version
ansible [core 2.13.6]
  config file = ***
  configured module search path = ***
  ansible python module location = ***
  ansible collection location = ***
  executable location = ***
  python version = 3.10.6 (main, Nov  2 2022, 18:53:38) [GCC 11.3.0]
  jinja version = 3.1.2
  libyaml = True

I do run the command like go run ansibleplaybook-walk-through-json-output.go, and I got this :
ERROR! Invalid callback for stdout specified: json
Error during command execution: ansible-playbook error: general error

I check the version of my ansible,It seems like this:
ansible [core 2.15.0.dev0]
config file = None
configured module search path = ['/Users/admin/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /opt/homebrew/lib/python3.10/site-packages/ansible_core-2.15.0.dev0-py3.10.egg/ansible
ansible collection location = /Users/admin/.ansible/collections:/usr/share/ansible/collections
executable location = /opt/homebrew/bin/ansible
python version = 3.10.7 (main, Sep 14 2022, 22:38:23) [Clang 14.0.0 (clang-1400.0.29.102)] (/opt/homebrew/opt/python@3.10/bin/python3.10)
jinja version = 3.1.2
libyaml = True

@apenella
Copy link
Owner

apenella commented Nov 19, 2022

Hi!
Since go-ansible is just an ansible wrapper to execute it through Golang, would you mind executing it directly with Ansible?

❯ ANSIBLE_STDOUT_CALLBACK=json ansible-playbook -i 127.0.0.1, -c local site1.yml site2.yml

I saw that you are using ansible-core 2.15.0.dev0, which is not a stable release and I don't know how it could influence the results you received.

@Yang-yyf
Copy link
Author

Hi, Thanks for your help.
It seems that my ansible-core was not a stable release version, because when I run the command directly, ansible returns me the same error. I will change ansible's version.
Thank you!

@apenella
Copy link
Owner

Good to know that we figured out why it does not work!
Thank you!
I am going to close the issue!

@prakasa1904
Copy link

prakasa1904 commented Jan 6, 2023

Hi, sorry to add issue here. I have some problem here but it only happen in docker Ubuntu 22.04 somehow. With detail ansible below:

ansible [core 2.13.6]
  config file = ***
  configured module search path = ['***', '***']
  ansible python module location = /root/.local/lib/python3.10/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /root/.local/bin/ansible
  python version = 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0]
  jinja version = 3.1.2
  libyaml = True

But it works when I running it in the docker host MacOS with ansible detail below. Can you give me advice about this issue @apenella . Thanks!

ansible [core 2.13.6]
  config file = ***
  configured module search path = ['***', '***']
  ansible python module location = /opt/homebrew/Cellar/ansible/6.6.0/libexec/lib/python3.11/site-packages/ansible
  ansible collection location = ***
  executable location = /opt/homebrew/bin/ansible
  python version = 3.11.0 (main, Oct 25 2022, 13:57:33) [Clang 14.0.0 (clang-1400.0.29.202)]
  jinja version = 3.1.2
  libyaml = True

SOLVED - Forget it, if you guys found same issue please install missing dependency when using docker as ansible executor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants