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

Ansible ANSIBLE_STDOUT_CALLBACK = json failed #53

Open
vitalyu opened this issue Jan 21, 2024 · 1 comment
Open

Ansible ANSIBLE_STDOUT_CALLBACK = json failed #53

vitalyu opened this issue Jan 21, 2024 · 1 comment

Comments

@vitalyu
Copy link

vitalyu commented Jan 21, 2024

Bug Report

Want to outputs ansible tasks in json representation, but operator fails to run roles

What did you do?

env (following ansible docs for 2.9)

 ANSIBLE_STDOUT_CALLBACK=json
 ANSIBLE_LOAD_CALLBACK_PLUGINS=1

What did you expect to see?

ansible logs within ansible-operator output in json format

What did you see instead? Under which circumstances?

...
{
  "level": "error",
  "ts": "2024-01-21T18:00:32Z",
  "logger": "runner",
  "msg": "ansible-playbook [core 2.15.2]
    config file = /etc/ansible/ansible.cfg
    configured module search path = ['/usr/share/ansible/openshift']
    ansible python module location = /usr/local/lib/python3.9/site-packages/ansible
    ansible collection location = /opt/ansible/.ansible/collections:/usr/share/ansible/collections
    executable location = /usr/local/bin/ansible-playbook
    python version = 3.9.16 (main, May 31 2023, 12:33:09) [GCC 8.5.0 20210514 (Red Hat 8.5.0-18)] (/usr/bin/python3)
    jinja version = 3.1.2
    libyaml = True
  Using /etc/ansible/ansible.cfg as config file\u001b[0m\r\n\u001b[0;31mERROR! Unexpected Exception, this is probably a bug: type 'NoneType' is not an acceptable base type\u001b[0m\nto see the full traceback, use -vvv\n",
  "job": "8089726286244470998",
  "name": "test-app",
  "namespace": "test-ns",
  "error": "exit status 250",
  "stacktrace": "github.com/operator-framework/operator-sdk/internal/ansible/runner.(*runner).Run.func1\n\tinternal/ansible/runner/runner.go:269"
}
...

Environment

ansible-operator version: "v1.31.0", commit: "e67da35ef4fff3e471a208904b2a142b27ae32b1", kubernetes version: "v1.26.0", go version: "go1.19.11", GOOS: "linux", GOARCH: "arm64"

/language ansible

Kubernetes cluster type:

aks, kind

$ operator-sdk version

operator-sdk version: "v1.31.0", commit: "e67da35ef4fff3e471a208904b2a142b27ae32b1", kubernetes version: "1.26.0", go version: "go1.19.11", GOOS: "linux", GOARCH: "arm64"

Possible Solution

add flags to ansible-operator or using by ansible json output by default for production, because ansible default logs format is to expensive and unusable in logging system

Copy link

openshift-ci bot commented Jan 21, 2024

@vitalyu: The label(s) language/ansible cannot be applied, because the repository doesn't have them.

In response to this:

Bug Report

Want to outputs ansible tasks in json representation, but operator fails to run roles

What did you do?

env (following ansible docs for 2.9)

ANSIBLE_STDOUT_CALLBACK=json
ANSIBLE_LOAD_CALLBACK_PLUGINS=1

What did you expect to see?

ansible logs within ansible-operator output in json format

What did you see instead? Under which circumstances?

...
{
 "level": "error",
 "ts": "2024-01-21T18:00:32Z",
 "logger": "runner",
 "msg": "ansible-playbook [core 2.15.2]
   config file = /etc/ansible/ansible.cfg
   configured module search path = ['/usr/share/ansible/openshift']
   ansible python module location = /usr/local/lib/python3.9/site-packages/ansible
   ansible collection location = /opt/ansible/.ansible/collections:/usr/share/ansible/collections
   executable location = /usr/local/bin/ansible-playbook
   python version = 3.9.16 (main, May 31 2023, 12:33:09) [GCC 8.5.0 20210514 (Red Hat 8.5.0-18)] (/usr/bin/python3)
   jinja version = 3.1.2
   libyaml = True
 Using /etc/ansible/ansible.cfg as config file\u001b[0m\r\n\u001b[0;31mERROR! Unexpected Exception, this is probably a bug: type 'NoneType' is not an acceptable base type\u001b[0m\nto see the full traceback, use -vvv\n",
 "job": "8089726286244470998",
 "name": "test-app",
 "namespace": "test-ns",
 "error": "exit status 250",
 "stacktrace": "github.com/operator-framework/operator-sdk/internal/ansible/runner.(*runner).Run.func1\n\tinternal/ansible/runner/runner.go:269"
}
...

Environment

ansible-operator version: "v1.31.0", commit: "e67da35ef4fff3e471a208904b2a142b27ae32b1", kubernetes version: "v1.26.0", go version: "go1.19.11", GOOS: "linux", GOARCH: "arm64"

/language ansible

Kubernetes cluster type:

aks, kind

$ operator-sdk version

operator-sdk version: "v1.31.0", commit: "e67da35ef4fff3e471a208904b2a142b27ae32b1", kubernetes version: "1.26.0", go version: "go1.19.11", GOOS: "linux", GOARCH: "arm64"

Possible Solution

add flags to ansible-operator or using by ansible json output by default for production, because ansible default logs format is to expensive and unusable in logging system

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

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

1 participant