Confused about "statically included" playbooks in version "2.1.2.0"

I have just started seeing output on my playbook runs, similar to the following:

statically included: /home/ansible/git/ansible/roles/base/tasks/mail.rc.yml
statically included: /home/ansible/git/ansible/roles/base/tasks/firewall_base.yml
statically included: /home/ansible/git/ansible/roles/base/tasks/repositories_arch.yml
statically included: /home/ansible/git/ansible/roles/base/tasks/repositories_debian.yml
statically included: /home/ansible/git/ansible/roles/base/tasks/repositories_fedora.yml
statically included: /home/ansible/git/ansible/roles/base/tasks/repositories_ubuntu.yml

However, this seems like a bug to me. For example, /home/ansible/git/ansible/roles/base/tasks/repositories_arch.yml shouldn’t be included on this host, because the machine is Debian and I have the following restriction set for including this playbook:

  • include: repositories_arch.yml
    when: ansible_distribution in [‘Archlinux’, ‘Manjaro Linux’]

So by my logic, that playbook should NOT have been included. I checked the documentation, and I saw that I could add the following to my ansible.cfg:

task_includes_static = False

Regardless of whether I set that to be true or false, it makes no difference. I added it to the [defaults] section, see:

https://github.com/jlacroix82/ansible/blob/master/ansible.cfg

The documentation doesn’t seem to make it clear as far as why I’m seeing “statically included” in my Playbook runs, nor why it’s including playbooks it shouldn’t be including based on the restrictions I set.

Is this a bug?

We have updated ansible to not be that verbose, you should only see that output now if -vv or higher verbosity is required.

As for the when: it will not prevent the inclusion of a static include, it will be applied as an additional condition to all the included tasks, this has always been the case. Only dynamic TASK includes can be conditionally avoided.

Play includes are never dynamic.

The config should have worked, try this as an alternative to making all includes dynamic:

  • include: repositories_arch.yml
    static: no
    when: ansible_distribution in [‘Archlinux’, ‘Manjaro Linux’]