conditionals in meta includes

I have a role which is just a meta playbook for installing many packages.
I only want these to run once during an ansible run since interacting with the package manager is slow.
I thought I’d register a variable and check it, however I’m getting an error.

TASK: [feature/zypper | remove non-seas repos] ********************************

fatal: [tr808.seas.upenn.edu] => error while evaluating conditional: ( common_has_executed == ‘false’)

Here the relevant files:

common/tasks/main.yml

I’ve discovered two things I’ll post here:

  1. For the time being you can toggle failing on undefined variables in the ansible config

  2. It is better to use ‘is defined’ or ‘is not defined’ rather than comparison in this use case.

The correct pattern would be:

when: foo is defined and foo

Good. And since I’m suppressing additional runs of this playbook, is there a way to suppress the output as well (that is the many lines of skipped stuff).

The best way to avoid skipped messages is to use things like “group_by” when relevant, so you don’t run RedHat specific tasks on Debian systems and have to watch the skipped.

When that is not practical, there is the following setting:

http://docs.ansible.com/intro_configuration.html#display-skipped-hosts