operator-framework / ansible-operator-plugins

Experimental extraction/refactoring of the Operator SDK's ansible operator plugin
Apache License 2.0
7 stars 17 forks source link

Ansible ANSIBLE_STDOUT_CALLBACK = json failed #53

Open vitalyu opened 5 months ago

vitalyu commented 5 months ago

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

openshift-ci[bot] commented 5 months ago

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

In response to [this](https://github.com/operator-framework/ansible-operator-plugins/issues/53): >## 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](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.