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 names on wrong tasks when strategy=free #76782

Closed
1 task done
bluikko opened this issue Jan 18, 2022 · 3 comments · Fixed by #76787
Closed
1 task done

Task names on wrong tasks when strategy=free #76782

bluikko opened this issue Jan 18, 2022 · 3 comments · Fixed by #76787
Assignees
Labels
affects_2.11 bug This issue/PR relates to a bug. has_pr This issue has an associated PR. module This issue/PR relates to a module. needs_info This issue requires further information. Please answer any outstanding questions. P3 Priority 3 - Approved, No Time Limitation support:core This issue/PR relates to code supported by the Ansible Engineering Team. verified This issue has been verified/reproduced by maintainer

Comments

@bluikko
Copy link
Contributor

bluikko commented Jan 18, 2022

Summary

In 2.11.7 when using strategy=free, the task names that are printed for each task are often names from different tasks and not the task that is being executed.

The task names are mixed up between hosts, between lines within a role, and even between roles (task files).

Also TASK lines are printed without any other output, not even name of the host where the supposed task is running.

Issue Type

Bug Report

Component Name

pip

Ansible Version

$ ansible --version
ansible [core 2.11.7]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/x/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/venv/lib64/python3.6/site-packages/ansible
  ansible collection location = /home/x/.ansible/collections:/usr/share/ansible/collections
  executable location = /opt/venv/bin/ansible
  python version = 3.6.8 (default, Nov 16 2020, 16:55:22) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
  jinja version = 3.0.2
  libyaml = True

Configuration

$ ansible-config dump --only-changed
CALLBACKS_ENABLED(/etc/ansible/ansible.cfg) = ['ansible.posix.timer']
CONTROLLER_PYTHON_WARNING(/etc/ansible/ansible.cfg) = False
DEFAULT_FORKS(/etc/ansible/ansible.cfg) = 10
DEFAULT_STDOUT_CALLBACK(/etc/ansible/ansible.cfg) = community.general.yaml
DEFAULT_STRATEGY(/etc/ansible/ansible.cfg) = ansible.builtin.free
DEFAULT_TIMEOUT(/etc/ansible/ansible.cfg) = 30
DEFAULT_VAULT_ID_MATCH(/etc/ansible/ansible.cfg) = True
INJECT_FACTS_AS_VARS(/etc/ansible/ansible.cfg) = False

OS / Environment

EL7

Steps to Reproduce

Expected Results

As in 2.9 Ansible should not print useless "TASK" lines and should print the right task name to go with each task output.

Actual Results

Example:

TASK [rolename : Install xinetd with yum] *************************************************************************************************************************************
task path: /home/x/roles/rolename/tasks/main.yml:190

TASK [rolename : Install xinetd with yum] *************************************************************************************************************************************
task path: /home/x/roles/rolename/tasks/main.yml:184
ok: [hostb.example.com] => changed=false
  backup: ''
  msg: ''

TASK [rolename : Install xinetd with yum] *************************************************************************************************************************************
task path: /home/x/roles/rolename/tasks/main.yml:190

TASK [rolename : Install xinetd with yum] *************************************************************************************************************************************
task path: /home/x/roles/rolename/tasks/main.yml:184
ok: [hostc.example.com] => changed=false
  backup: ''
  msg: ''

TASK [rolename : Install xinetd with yum] *************************************************************************************************************************************
task path: /home/x/roles/rolename/tasks/main.yml:190
ok: [hosta.example.com] => changed=false
  msg: ''
  rc: 0
  results:
  - 2:xinetd-2.3.15-14.el7.x86_64 providing xinetd is already installed

TASK [rolename : Change line in configuration file] ***************************************************************************************************************
task path: /home/x/roles/rolename/tasks/main.yml:196

TASK [rolename : Change line in configuration file] ***************************************************************************************************************
task path: /home/x/roles/rolename/tasks/main.yml:190
ok: [hostb.example.com] => changed=false
  msg: ''
  rc: 0
  results:
  - 2:xinetd-2.3.15-14.el7.x86_64 providing xinetd is already installed

TASK [rolename : Change line in configuration file] ***************************************************************************************************************
task path: /home/x/roles/rolename/tasks/main.yml:196

TASK [rolename : Change line in configuration file] ***************************************************************************************************************
task path: /home/x/roles/rolename/tasks/main.yml:190
ok: [hostc.example.com] => changed=false
  msg: ''
  rc: 0
  results:
  - 2:xinetd-2.3.15-14.el7.x86_64 providing xinetd is already installed

TASK [rolename : Change line in configuration file] ***************************************************************************************************************
task path: /home/x/roles/rolename/tasks/main.yml:196
ok: [hosta.example.com] => changed=false
  backup: ''
  msg: ''

TASK [rolename : Change another line in file] **************************************************************************************************************
task path: /home/x/roles/rolename/tasks/main.yml:204

TASK [rolename : Change another line in file] **************************************************************************************************************
task path: /home/x/roles/rolename/tasks/main.yml:196
ok: [hostb.example.com] => changed=false
  backup: ''
  msg: ''

TASK [rolename : Change another line in file] **************************************************************************************************************
task path: /home/x/roles/rolename/tasks/main.yml:204

TASK [rolename : Change another line in file] **************************************************************************************************************
task path: /home/x/roles/rolename/tasks/main.yml:196
ok: [hostc.example.com] => changed=false
  backup: ''
  msg: ''

The above log consists of 14 "TASK" lines. Most of those are wrong:
1. Correct task name for line number 190. But no hostname and no output from task, seems this line is useless.
2. Incorrect task name for line number 184, as seen from command output it is a "lineinfile" task, named "Add line in file". It is not a "yum" task.
3. Repeating #1.
4. Same as #2 but different host.
5. Finally a correct task name, this is a "yum" task output.
6. Correct task name for line number 196. But no hostname and no output from task, seems this line is useless.
7. Incorrect task name for line number 190, this time it is indeed a "yum" task but the TASK name printed is for a "lineinfile" task.
8. Correct task name for line number 196. But no hostname and no output from task, seems this line is useless.
9. Same as #7.
10. Finally a correct task name, this is a "lineinfile" task output.
11. Correct task name for line number 204. But no hostname and no output from task, seems this line is useless.
12. Incorrect task name for line number 196.
13. Correct task name for line number 204. But no hostname and no output from task, seems this line is useless.
14. Incorrect task name for line number 196.

Out of 14 (!!!) "TASK" lines and all the other lines that go with them, only:
- 3 occurrences had right task name for the line number and had some useful information (host name, task output).
- 6 lines (and the following role file + line number, empty line) seemed useless.

This makes Ansible output hugely long with all the useless 3 line combinations of TASK+file/linenumber+empty line.

Not to mention I have to manually decode each file + line number because the task name printed is often wrong.

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibot
Copy link
Contributor

ansibot commented Jan 18, 2022

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

@ansibot ansibot added affects_2.11 bug This issue/PR relates to a bug. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Jan 18, 2022
@mkrizek mkrizek added needs_verified This issue needs to be verified/reproduced by maintainer P3 Priority 3 - Approved, No Time Limitation and removed needs_triage Needs a first human triage before being processed. labels Jan 18, 2022
@mkrizek
Copy link
Contributor

mkrizek commented Jan 18, 2022

Can you provide a simple reproducer that we can run?

needs_info

@ansibot ansibot added the needs_info This issue requires further information. Please answer any outstanding questions. label Jan 18, 2022
@sivel sivel self-assigned this Jan 18, 2022
@sivel sivel added verified This issue has been verified/reproduced by maintainer and removed needs_verified This issue needs to be verified/reproduced by maintainer labels Jan 18, 2022
sivel added a commit to sivel/ansible that referenced this issue Jan 18, 2022
@ansibot ansibot added the has_pr This issue has an associated PR. label Jan 18, 2022
sivel added a commit to sivel/ansible that referenced this issue Jan 18, 2022
ansible#76787)

(cherry picked from commit 29bdb8b)

Co-authored-by: Matt Martz <matt@sivel.net>
nitzmahone pushed a commit that referenced this issue Jan 19, 2022
…) (#76791)

(cherry picked from commit 29bdb8b)

Co-authored-by: Matt Martz <matt@sivel.net>
sivel added a commit to sivel/ansible that referenced this issue Jan 19, 2022
ansible#76787)

(cherry picked from commit 29bdb8b)

Co-authored-by: Matt Martz <matt@sivel.net>
@sivel
Copy link
Member

sivel commented Jan 19, 2022

FYI, the most simple work around is to not use ansible.builtin in the config for the strategy. Simply use free instead of ansible.builtin.free for now.

sivel added a commit that referenced this issue Jan 19, 2022
…) (#76797)

(cherry picked from commit 29bdb8b)

Co-authored-by: Matt Martz <matt@sivel.net>
@ansible ansible locked and limited conversation to collaborators Feb 1, 2022
briantist pushed a commit to briantist/ansible that referenced this issue Feb 1, 2022
konstruktoid pushed a commit to konstruktoid/ansible-upstream that referenced this issue Feb 2, 2022
bcoca pushed a commit to bcoca/ansible that referenced this issue Feb 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.11 bug This issue/PR relates to a bug. has_pr This issue has an associated PR. module This issue/PR relates to a module. needs_info This issue requires further information. Please answer any outstanding questions. P3 Priority 3 - Approved, No Time Limitation support:core This issue/PR relates to code supported by the Ansible Engineering Team. verified This issue has been verified/reproduced by maintainer
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants