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

counter_enabled callback plugin doesn't work with roles #53907

Open
jacobsalmela opened this issue Mar 16, 2019 · 4 comments

Comments

@jacobsalmela
Copy link

commented Mar 16, 2019

SUMMARY

The counter_enabled callback plugin doesn't seem to work with roles. There's no mention of if roles in #40769, and I can't find any other mentions of this plugin.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

counter_enabled.py

ANSIBLE VERSION
ansible 2.7.9
  config file = /Users/jacobsalmela/git/ansible/ansible.cfg
  configured module search path = [u'/Users/jacobsalmela/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /Library/Python/2.7/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 2.7.10 (default, Aug 17 2018, 19:45:58) [GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.0.42)]
CONFIGURATION
ANSIBLE_PIPELINING(/Users/jacobsalmela/git/ansible/ansible.cfg) = True
DEFAULT_CALLBACK_WHITELIST(/Users/jacobsalmela/git/ansible/ansible.cfg) = [u'counter_enabled']
DEFAULT_HOST_LIST(/Users/jacobsalmela/git/ansible/ansible.cfg) = [u'/Users/jacobsalmela/git/ansible/inventories/hosts']
DEFAULT_SCP_IF_SSH(/Users/jacobsalmela/git/ansible/ansible.cfg) = True
DEFAULT_STDOUT_CALLBACK(/Users/jacobsalmela/git/ansible/ansible.cfg) = counter_enabled
RETRY_FILES_ENABLED(/Users/jacobsalmela/git/ansible/ansible.cfg) = False
OS / ENVIRONMENT

Control machine: macOS 10.14.3
Targets: Ubuntu 16.04, Centos 7.6, RHEL 7.6

STEPS TO REPRODUCE
  1. Enable the counter_enabled callback plugin
  2. Run a playbook that calls a role such as:
---
- hosts: all

  roles:
  - { role: motd, become: yes, become_user: root, become_method: su }
ansible-playbook -i "ubuntu-nyc1," motd.yml
EXPECTED RESULTS

I would expect the counter_enabled plugin to count all the tasks within a role.

PLAY [all] ******************************************************************************************************************************************

TASK 1/2 [Gathering Facts] **************************************************************************************************************************
ok: 1/1 [ubuntu-nyc1]

TASK 2/2 [motd : configure  motd banner] *******************************************************************************************************************
ok: 1/1 [ubuntu-nyc1]

TASK 3/2 [motd : configure ssh message] ********************************************************************************************************************
changed: 1/1 [ubuntu-nyc1]

PLAY RECAP ******************************************************************************************************************************************
ubuntu-nyc1           : ok=3    changed=1    unreachable=0    failed=0
ACTUAL RESULTS

Instead of counting all the tasks in the role or roles, it reports an index out of range and the total number of tasks is 0.

PLAY [all] ******************************************************************************************************************************************
 [WARNING]: Failure using method (v2_playbook_on_play_start) in callback plugin (<ansible.plugins.callback.counter_enabled.CallbackModule object at
0x10e4fc250>): list index out of range


TASK 1/0 [Gathering Facts] **************************************************************************************************************************
ok: 1/1 [ubuntu-nyc1]

TASK 2/0 [motd : configure default motd banner] *****************************************************************************************************
ok: 1/1 [ubuntu-nyc1]

TASK 3/0 [motd : configure ssh message] *************************************************************************************************************
changed: 1/1 [ubuntu-nyc1]

PLAY RECAP ******************************************************************************************************************************************
ubuntu-nyc1           : ok=3    changed=1    unreachable=0    failed=0

If you run a playbook with only tasks in it, it seems to work just fine.

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Mar 16, 2019

Files identified in the description:

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

click here for bot help

@theytaz

This comment has been minimized.

Copy link

commented May 7, 2019

Same issue when using import_playbook:

@k4ch0

This comment has been minimized.

Copy link

commented May 10, 2019

Same issue here on Ansible 2.7.0

@m-equinox

This comment has been minimized.

Copy link

commented Jun 1, 2019

Same issue here on Ansible 2.8.0 too :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.