callback plugin log_plays double output in logs

Ansible log_plays plugin is logging double output in logs

Jan 06 2018 10:20:29 - OK - omitted

  Jan 06 2018 10:20:29 - OK - omitted

  Jan 06 2018 10:20:29 - OK - {"msg": "hello", "changed": false, "_ansible_verbose_always": true, "_ansible_no_log": false}

  Jan 06 2018 10:20:29 - OK - {"msg": "hello", "changed": false, "_ansible_verbose

Playbook I'm running 
 
  - hosts: localhost
    connection: local

    tasks:
      - debug:
          msg: hello

I can't confirm this behavior with Ansible 2.4.2.0.

I’m using ansible verison

ansible --version
ansible 2.5.0

log_plays : https://github.com/ansible/ansible/blob/devel/lib/ansible/plugins/callback/log_plays.py

Tried latest, but I don't get double logging

$ ansible --version
ansible 2.5.0 (devel 2db9878c76) last updated 2018/01/07 18:17:41 (GMT +200)

$ cat /var/log/ansible/hosts/localhost
Jan 07 2018 19:02:53 - OK - omitted

Jan 07 2018 19:02:53 - OK - {"msg": "hello", "attempts": 1, "changed": false, "_ansible_no_log": false, "_ansible_verbose_always": true}

If you copied that callback plugin into your own callback_plugins directory, it is likely that you are affected by https://github.com/ansible/ansible/issues/33484 which was recently resolved in the devel branch for the 2.5 release.

So I defined it under /usr/share/ansible/plugins/callback ansible one. Tested on ansible 2.4.2.0, same result:

Jan 10 2018 02:25:17 - OK - omitted

Jan 10 2018 02:25:17 - OK - omitted

Jan 10 2018 02:25:17 - OK - {“msg”: “hello”, “changed”: false, “_ansible_verbose_always”: true, “_ansible_no_log”: false}

Jan 10 2018 02:25:17 - OK - {“msg”: “hello”, “changed”: false, “_ansible_verbose_always”: true, “_ansible_no_log”: false}

ansible 2.4.2.0

What do you mean with defined?

log_plays is bundled with Ansible 2.4 so you only need to set "stdout_callback = log_plays" in ansible.cfg or set the environment variable ANSIBLE_STDOUT_CALLBACK=log_plays

Is it also work if I use custom ansible.cfg file … how to call callback plugins in custom ansible.cfg