ansible-collections / community.general

Ansible Community General Collection
https://galaxy.ansible.com/ui/repo/published/community/general/
GNU General Public License v3.0
814 stars 1.49k forks source link

community.general.selective formatting error in stats #8797

Open leegarrett opened 2 weeks ago

leegarrett commented 2 weeks ago

Summary

When using the community.general.selective callback plugin, the formatting of the stats at the end of a playbook run is formatted in a way that makes reading it difficult, as whitespace is not used uniformly.

There's a variable amount of spaces between the node name and the :, and tabs are being used between the other fields, contributing to different offsets there.

Issue Type

Bug Report

Component Name

community.general.selective

Ansible Version

$ ansible --version
ansible [core 2.17.3]
  config file = /home/randall/Coding/gits-playbook/ansible.cfg
  configured module search path = ['/home/randall/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /home/randall/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.11.2 (main, May  2 2024, 11:59:08) [GCC 12.2.0] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = True

Community.general Version

$ ansible-galaxy collection list community.general

# /usr/lib/python3/dist-packages/ansible_collections
Collection        Version
----------------- -------
community.general 9.1.0  

Configuration

$ ansible-config dump --only-changed
ANSIBLE_FORCE_COLOR(/home/randall/Coding/gits-playbook/ansible.cfg) = True
ANSIBLE_NOCOWS(/home/randall/Coding/gits-playbook/ansible.cfg) = True
CACHE_PLUGIN(/home/randall/Coding/gits-playbook/ansible.cfg) = jsonfile
CACHE_PLUGIN_CONNECTION(/home/randall/Coding/gits-playbook/ansible.cfg) = fact_cache
CACHE_PLUGIN_TIMEOUT(/home/randall/Coding/gits-playbook/ansible.cfg) = 1209600
CONFIG_FILE() = /home/randall/Coding/gits-playbook/ansible.cfg
DEFAULT_BECOME_METHOD(/home/randall/Coding/gits-playbook/ansible.cfg) = su
DEFAULT_FORCE_HANDLERS(/home/randall/Coding/gits-playbook/ansible.cfg) = True
DEFAULT_FORKS(/home/randall/Coding/gits-playbook/ansible.cfg) = 100
DEFAULT_GATHERING(/home/randall/Coding/gits-playbook/ansible.cfg) = smart
DEFAULT_HASH_BEHAVIOUR(/home/randall/Coding/gits-playbook/ansible.cfg) = merge
DEFAULT_HOST_LIST(/home/randall/Coding/gits-playbook/ansible.cfg) = ['/home/randall/Coding/gits-playbook/inventory']
DEFAULT_LOAD_CALLBACK_PLUGINS(/home/randall/Coding/gits-playbook/ansible.cfg) = True
DEFAULT_MANAGED_STR(/home/randall/Coding/gits-playbook/ansible.cfg) = Ansible managed: Any changes will be overwritten!
DEFAULT_ROLES_PATH(/home/randall/Coding/gits-playbook/ansible.cfg) = ['/home/randall/Coding/gits-playbook/roles/apt_repos', '/home/randall/Coding/gits-playbook/roles/daemons', '/home/randall/Coding/gits-playbook/roles/databases', '/home/randall/Coding/gits-playbook/roles/desktop', '/home/randall/Coding/gits-playbook/roles/games', '/home/randall/Coding/gits-playbook/roles/mail', '/home/randall/Coding/gits-playbook/roles/net', '/home/randall/Coding/gits-playbook/roles/other', '/home/randall/Coding/gits-playbook/roles/phy', '/home/randall/Coding/gits-playbook/roles/sec', '/home/randall/Coding/gits-playbook/roles/stacks', '/home/randall/Coding/gits-playbook/roles/virt', '/home/randall/Coding/gits-playbook/roles/webapps', '/home/randall/Coding/gits-playbook/roles/windows', '/home/randall/consulting/freexian/ftf/roles']
DEFAULT_STDOUT_CALLBACK(/home/randall/Coding/gits-playbook/ansible.cfg) = community.general.selective
DEFAULT_VAULT_PASSWORD_FILE(/home/randall/Coding/gits-playbook/ansible.cfg) = /home/randall/Coding/gits-playbook/vault_pass
DIFF_ALWAYS(/home/randall/Coding/gits-playbook/ansible.cfg) = True
EDITOR(env: EDITOR) = /usr/bin/vim
PAGER(env: PAGER) = less
RETRY_FILES_ENABLED(/home/randall/Coding/gits-playbook/ansible.cfg) = False

OS / Environment

Debian 12 (bookworm)

Steps to Reproduce

# Run a playbook with a bunch of hosts in it, some failing, some unreachable
$ ansible-playbook upgrade.yml

Expected Results

# STATS ****************************************************************************************************************
Kali                : ok=0  changed=0   failed=1    unreachable=0   rescued=0   ignored=0
bookworm            : ok=0  changed=0   failed=1    unreachable=0   rescued=0   ignored=0
bullseye            : ok=0  changed=0   failed=1    unreachable=0   rescued=0   ignored=0
bullseye-virtiofs   : ok=0  changed=0   failed=1    unreachable=0   rescued=0   ignored=0
buster              : ok=0  changed=0   failed=1    unreachable=0   rescued=0   ignored=0
comms               : ok=3  changed=0   failed=0    unreachable=0   rescued=0   ignored=0
deb12-wohnungsbot   : ok=0  changed=0   failed=1    unreachable=0   rescued=0   ignored=0
games               : ok=3  changed=0   failed=0    unreachable=0   rescued=0   ignored=0
haproxy             : ok=3  changed=0   failed=0    unreachable=0   rescued=0   ignored=0
homie               : ok=0  changed=0   failed=0    unreachable=1   rescued=0   ignored=0
homie2              : ok=0  changed=0   failed=0    unreachable=1   rescued=0   ignored=0
hopper              : ok=3  changed=0   failed=0    unreachable=0   rescued=0   ignored=0
kusanagi            : ok=0  changed=0   failed=0    unreachable=1   rescued=0   ignored=0
maven               : ok=3  changed=0   failed=0    unreachable=0   rescued=0   ignored=0
maven--old          : ok=0  changed=0   failed=1    unreachable=0   rescued=0   ignored=0
mediawiki           : ok=3  changed=0   failed=0    unreachable=0   rescued=0   ignored=0
motoko              : ok=0  changed=0   failed=0    unreachable=1   rescued=0   ignored=0
nextcloud           : ok=3  changed=0   failed=0    unreachable=0   rescued=0   ignored=0
packages            : ok=3  changed=0   failed=0    unreachable=0   rescued=0   ignored=0
sid                 : ok=3  changed=0   failed=0    unreachable=0   rescued=0   ignored=0
tails_custom        : ok=0  changed=0   failed=1    unreachable=0   rescued=0   ignored=0
tor                 : ok=3  changed=0   failed=0    unreachable=0   rescued=0   ignored=0
trixie              : ok=0  changed=0   failed=1    unreachable=0   rescued=0   ignored=0

### Actual Results

```console (paste below)
[...]
# STATS ****************************************************************************************************************
Kali    : ok=0  changed=0   failed=1    unreachable=0   rescued=0   ignored=0
bookworm    : ok=0  changed=0   failed=1    unreachable=0   rescued=0   ignored=0
bullseye    : ok=0  changed=0   failed=1    unreachable=0   rescued=0   ignored=0
bullseye-virtiofs    : ok=0 changed=0   failed=1    unreachable=0   rescued=0   ignored=0
buster    : ok=0    changed=0   failed=1    unreachable=0   rescued=0   ignored=0
comms    : ok=3 changed=0   failed=0    unreachable=0   rescued=0   ignored=0
deb12-wohnungsbot    : ok=0 changed=0   failed=1    unreachable=0   rescued=0   ignored=0
games    : ok=3 changed=0   failed=0    unreachable=0   rescued=0   ignored=0
haproxy    : ok=3   changed=0   failed=0    unreachable=0   rescued=0   ignored=0
homie    : ok=0 changed=0   failed=0    unreachable=1   rescued=0   ignored=0
homie2    : ok=0    changed=0   failed=0    unreachable=1   rescued=0   ignored=0
hopper    : ok=3    changed=0   failed=0    unreachable=0   rescued=0   ignored=0
kusanagi    : ok=0  changed=0   failed=0    unreachable=1   rescued=0   ignored=0
maven    : ok=3 changed=0   failed=0    unreachable=0   rescued=0   ignored=0
maven--old    : ok=0    changed=0   failed=1    unreachable=0   rescued=0   ignored=0
mediawiki    : ok=3 changed=0   failed=0    unreachable=0   rescued=0   ignored=0
motoko    : ok=0    changed=0   failed=0    unreachable=1   rescued=0   ignored=0
nextcloud    : ok=3 changed=0   failed=0    unreachable=0   rescued=0   ignored=0
packages    : ok=3  changed=0   failed=0    unreachable=0   rescued=0   ignored=0
sid    : ok=3   changed=0   failed=0    unreachable=0   rescued=0   ignored=0
tails_custom    : ok=0  changed=0   failed=1    unreachable=0   rescued=0   ignored=0
tor    : ok=3   changed=0   failed=0    unreachable=0   rescued=0   ignored=0
trixie    : ok=0    changed=0   failed=1    unreachable=0   rescued=0   ignored=0

Code of Conduct

ansibullbot commented 2 weeks ago

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help