Code Monkey home page Code Monkey logo

ansible-human_log's People

Contributors

aspiers avatar df7cb avatar lerentis avatar n0ts avatar thomassteinbach avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ansible-human_log's Issues

How to implement it?

I put python script to /home/frankja2/ansible/callback/human_log.py

made change to /etc/ansible/ansible.cfg with:

callback_plugins = /home/frankja2/ansible/callback/

and when I run my playbook I get standard ansible output. What am I doing wrong?

No output and warning when dealing with UTF-8 characters

When trying to execute a playbook which outputs UTF-8 characters the following warning will be displayed:

[WARNING]: Error when using >: 'ascii' codec can't encode character u'\u03bc'
in position 696: ordinal not in range(128)

Also no output will be generated.

I managed to change the encoding so that it will work but it seems rather like a hack than a correct solution.

Any ideas?

[WARNING]: Failure using method (v2_runner_on_ok) in callback plugin (<ansible.plugins.callback.ansible_human_log.CallbackModule object at 0x7f521466c250>): name 'unicode' is not defined

Encountering this error when running playbooks and the callback directory specified in ansible.cfg. I'm not sure what info to include so below are some logical choices:

root@ansible01:/usr/share/ansible/plugins/callback# ansible --version
ansible 2.9.6
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.8.10 (default, Sep 28 2021, 16:10:42) [GCC 9.3.0]
root@ansible01:/usr/share/ansible/plugins/callback#
root@ansible01:/usr/share/ansible/plugins/callback# ansible-config dump --only-changed
DEFAULT_CALLBACK_PLUGIN_PATH(/etc/ansible/ansible.cfg) = ['/usr/share/ansible/plugins/callback']
DEFAULT_HOST_LIST(/etc/ansible/ansible.cfg) = ['/etc/ansible/inventory']
DEFAULT_LOG_PATH(/etc/ansible/ansible.cfg) = /var/log/ansible/ansible.log
DEFAULT_MANAGED_STR(/etc/ansible/ansible.cfg) = Ansible managed by {host}
SYSTEM_WARNINGS(/etc/ansible/ansible.cfg) = True
root@ansible01:/usr/share/ansible/plugins/callback#
root@ansible01:/usr/share/ansible/plugins/callback# ll /usr/share/ansible/plugins/callback/
total 16
drwxr-xr-x 2 root            root            4096 Dec 14 12:21 ./
drwxr-xr-x 3 root            root            4096 Dec 10 09:55 ../
-rwxr-x--- 1 svc-ansiblemgmt svc-ansiblemgmt 6920 Dec  6 11:18 ansible_human_log.py*
root@ansible01:/usr/share/ansible/plugins/callback# cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.3 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.3 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

[WARNING]: Failure using method (v2_runner_on_ok) in callback plugin human_log.py name 'unicode' is not defined

Warning message:

TASK [Start puppet agent without tags] **********************************************************
changed: [localhost]
 [WARNING]: Failure using method (v2_runner_on_ok) in callback plugin
(<ansible.plugins.callback./Users/user/.ansible/plugins/callback/human_log.CallbackModule
object at 0x102e098d0>): name 'unicode' is not defined


TASK [debug] ************************************************************************************
ok: [localhost] => {
    "puppet_agent_result.stdout_lines": [
        "\u001b[0;32mInfo: Using configured environment 'production'\u001b[0m",
        "\u001b[0;32mInfo: Retrieving pluginfacts\u001b[0m",
        "\u001b[0;32mInfo: Retrieving plugin\u001b[0m",
        "\u001b[0;32mInfo: Loading facts\u001b[0m",

Software version:

> python --version
Python 2.7.10
> python3 --version
Python 3.7.3
> ansible --version
ansible 2.7.10

Double output with ignore_errors: yes

If you run a command in ansible with "ignore_errors: yes", in case of an error, the non-formated ouput is printed, and then the formated ouput follows...

I am copy pasting part of my output in order for you to better understand the second problem.

/tdpvmware/fcm/fmcima -l /home/tdpvmware/tdpvmware/config -N DEVICE_CLASS:FCBACKUP_SLM.0 -f backup' returned with code 0.", "#CHILD lunid:6005076801828070F800000000000211", "#PARENT lunname:V-slmesx01_lun0002", "#WARNING FMM1554W The agent 'acsgen V. 4.1.4.0' terminated with exit code 1.", "#INFO FMM0020I End of program at: Fri Mar 11 16:23:03 2016.", "#INFO FMM0021I Elapsed time: 01 min 38 sec.", "#INFO FMM0024I Return code is: 1.", "#PARAM STATUS=warning", "#END RUN 636 20160311162303884", "#END TASK 114", "#INFO FMM16014I The return code is 1.", "#END"], "warnings": []}
...ignoring
[after that part the ouput is displayed again but now formated]
cmd: /opt/tivoli/tsm/tdpvmware/common/scripts/vmcli -f backup -T 114 --runnow
start: 2016-03-11 16:21:24.221963
end: 2016-03-11 16:23:05.543694
delta: 0:01:41.321731
stdout: #TASK 114 backup 20131008162736229

Add "failed & reason" to FIELDS

At least for ansible 2.0.1.0 I had to add failed & reason key to FIELDS variable to make it work.

FIELDS = ['cmd', 'command', 'start', 'end', 'delta', 'msg', 'stdout',
          'stderr', 'results', 'failed', 'reason']

But the plugin displays the verbose output too. Could we avoid this?

PLAY ***************************************************************************

TASK [install : include] *******************************************************
fatal: [192.168.33.10]: FAILED! => {"failed": true, "reason": "Syntax Error while loading YAML.\n\n\nThe error appears to have been in '/Users/dacodekid/dev/ansible-roles/roles/install/tasks/git.yml': line 3, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: add git ppa\n      ^ here\n"}

failed: True

reason: Syntax Error while loading YAML.


The error appears to have been in '/Users/dacodekid/dev/ansible-roles/roles/install/tasks/git.yml': line 3, column 7, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


- name: add git ppa
      ^ here


NO MORE HOSTS LEFT *************************************************************
    to retry, use: --limit @site.retry

PLAY RECAP *********************************************************************
192.168.33.10              : ok=0    changed=0    unreachable=0    failed=1

Is this repository abandoned?

I am wondering if there are any plans on getting some basic maintenance on this repository as it seems that it listed at least one PR which was ignored for few good months.

If there is no interest in keeping this code maintained we could know and fork it, letting others know that is it maintained in a different place. Thanks.

Ansible 2.6.2 complains about not supporting setting 'options'

[DEPRECATION WARNING]: human_log callback, does not support setting 'options', 
it will work for now,  but this will be required in the future and should be 
updated,  see the 2.4 porting guide for details.. This feature will be removed 
in version 2.9. Deprecation warnings can be disabled by setting 
deprecation_warnings=False in ansible.cfg.

README.md is very misleading about debug module

There seems to be some major confusion about the use of the debug callback. As explained in #6 (comment), newer versions of Ansible (I think it is 2.2 onwards or so) offer a badly-named debug plugin for stdout_callback which offers human-readable output. This is not related to this human_log callback in any way, however it seems that this was misunderstood, resulting in #13 which made the README suggest that it's necessary to change the stdout_callback configuration parameter (or the equivalent environment variable to debug) in order to active human_log. But AFAICS that is completely wrong.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.