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

Task IDs should be logged #6

Closed
pgporada opened this issue Feb 20, 2017 · 5 comments
Closed

Task IDs should be logged #6

pgporada opened this issue Feb 20, 2017 · 5 comments

Comments

@pgporada
Copy link
Contributor

Currently we get the following data

{
        "ansible_type" => "task",
               "level" => "INFO",
      "ansible_result" => "{\"changed\": false, \"msg\": \"\", \"rc\": 0, \"results\": [\"All packages providing epel-release are up to date\", \"\"]}",
             "session" => "87c7bf9e-f731-11e6-845a-2477032230c8",
     "ansible_changed" => false,
             "message" => "{\"changed\": false, \"msg\": \"\", \"rc\": 0, \"results\": [\"All packages providing epel-release are up to date\", \"\"]}",
                "type" => "ansible",
    "ansible_playbook" => "/tmp/kitchen/default.yml",
        "ansible_task" => "TASK: pgporada.repo-epel : Second pass to ensure EPEL is the latest version",
                "tags" => [],
                "path" => "/tmp/kitchen/callback_plugins/logstash.py",
        "ansible_host" => "localhost",
          "@timestamp" => 2017-02-20T06:01:12.269Z,
                "port" => 43622,
                "host" => "laptappy",
            "@version" => "1",
         "logger_name" => "python-logstash-logger",
}

In the ansible output for this task, here is all the information available

{
                    "hosts": {
                        "localhost": {
                            "_ansible_no_log": false, 
                            "_ansible_parsed": true, 
                            "changed": false, 
                            "invocation": {
                                "module_args": {
                                    "conf_file": null, 
                                    "disable_gpg_check": false, 
                                    "disablerepo": null, 
                                    "enablerepo": null, 
                                    "exclude": null, 
                                    "install_repoquery": true, 
                                    "list": null, 
                                    "name": [
                                        "epel-release"
                                    ], 
                                    "state": "latest", 
                                    "update_cache": false, 
                                    "validate_certs": true
                                }
                            }, 
                            "msg": "", 
                            "rc": 0, 
                            "results": [
                                "All packages providing epel-release are up to date", 
                                ""
                            ]
                        }
                    }, 
                    "task": {
                        "id": "edf38f61-6d47-40b0-b00e-cb3e1f172c71",               <======================
                        "name": "Second pass to ensure EPEL is the latest version"
                    }
                }
@ujenmr
Copy link
Owner

ujenmr commented Feb 20, 2017

Please tell me, how you got output like this?

In the ansible output for this task, here is all the information available

@pgporada
Copy link
Contributor Author

pgporada commented Feb 20, 2017

I got that information from test-kitchen using the json stdout_callback.

Here's my ansible.cfg

[defaults]
inventory=hosts
host_key_checking=false
nocows=1
fact_caching=jsonfile
fact_caching_connection=facts/
scp_if_ssh=true
timeout=20
stdout_callback = json
callback_plugins = callback_plugins/
callback_whitelist = logstash
roles_path=roles

[ssh_connection]
ssh_args = -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s

@ujenmr
Copy link
Owner

ujenmr commented Feb 20, 2017

try the new version

@pgporada
Copy link
Contributor Author

pgporada commented Feb 20, 2017 via email

@pgporada
Copy link
Contributor Author

It's working well! Awesome!

@ujenmr ujenmr closed this as completed Feb 22, 2017
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

2 participants