Skip to content

Ansible ANSIBLE_STDOUT_CALLBACK = json failed #53

@vitalyu

Description

@vitalyu

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions