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

Playbook log output of different plays are intermixed #63314

Open
fbruetting opened this issue Oct 10, 2019 · 3 comments
Open

Playbook log output of different plays are intermixed #63314

fbruetting opened this issue Oct 10, 2019 · 3 comments
Labels
affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. P3 Priority 3 - Approved, No Time Limitation python3 support:core This issue/PR relates to code supported by the Ansible Engineering Team.

Comments

@fbruetting
Copy link

fbruetting commented Oct 10, 2019

SUMMARY

When I run a playbook with several plays, the CLI output subdivides the log into all plays by these PLAY [<HOSTS>] ************************ dividing lines. Somehow, however, warnings about not matched host patterns are sorted in the play logs section of the preceeding play.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

ansible-playbook

ANSIBLE VERSION
ansible 2.8.5
  config file = /var/home/frank/Projekte/Ansible/ansible.cfg
  configured module search path = ['/var/home/frank/Projekte/Ansible/library']
  ansible python module location = /usr/lib/python3.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.7.4 (default, Aug 12 2019, 14:45:07) [GCC 9.1.1 20190605 (Red Hat 9.1.1-2)]
CONFIGURATION
DEFAULT_HOST_LIST(/var/home/frank/Projekte/Ansible/ansible.cfg) = ['/var/home/frank/Projekte/Ansible/inventory/hosts']
DEFAULT_MODULE_PATH(/var/home/frank/Projekte/Ansible/ansible.cfg) = ['/var/home/frank/Projekte/Ansible/library']
OS / ENVIRONMENT
  • Fedora Silverblue 31 beta
STEPS TO REPRODUCE

Just run this playbook below via ansible-playbook <FILE>.

---
- hosts: host1
  gather_facts: no
  tasks:
    - name: Task 1
      local_action: command ping -c 3 localhost

- hosts: host2
  gather_facts: no
  tasks:
    - name: Task 2
      command: command ping -c 3 localhost
EXPECTED RESULTS

I expect all output of each play to be contained within its corresponding section.

ACTUAL RESULTS

As you can see below, the warnings are grouped above the corresponding section, instead of inside if it. So the output that host2 of the second play cannot be matched, is already printed before the second play starts. Would be cool if this could be fixed, as this aids error search, especially we as beginners would faster understand what’s going up.

> ansible-playbook test.yaml
 [WARNING]: Could not match supplied host pattern, ignoring: host1


PLAY [host1] *************************************************************************
skipping: no hosts matched
 [WARNING]: Could not match supplied host pattern, ignoring: host2


PLAY [host2] *************************************************************************
skipping: no hosts matched

PLAY RECAP ***************************************************************************

Instead, I would expect something like this:

> ansible-playbook test.yaml

PLAY [host1] *************************************************************************
 [WARNING]: Could not match supplied host pattern, ignoring: host1
skipping: no hosts matched


PLAY [host2] *************************************************************************
 [WARNING]: Could not match supplied host pattern, ignoring: host2
skipping: no hosts matched

PLAY RECAP ***************************************************************************
@ansibot
Copy link
Contributor

ansibot commented Oct 10, 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

@ansibot ansibot added affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. needs_triage Needs a first human triage before being processed. python3 support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Oct 10, 2019
@sivel sivel added P3 Priority 3 - Approved, No Time Limitation and removed needs_triage Needs a first human triage before being processed. labels Oct 15, 2019
@sivel
Copy link
Member

sivel commented Oct 15, 2019

The log messages are not intermixed, it is that the warning prints before the play header.

We may be able to move the warning after the play header, but it is possible that we can not move the warning that late, or the play header that early.

@fbruetting
Copy link
Author

Ok, I understand your view, but the markup with the horizontal bars totally change that and cause a misleading perception – which is bad when people then take wrong paths at error-search. Maybe you may halt all play-related warnings and flush them after the play header if that is really necessary. Would really improve UX! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. P3 Priority 3 - Approved, No Time Limitation python3 support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

No branches or pull requests

3 participants