Feature Idea: Use role meta data to explicitly fail on an unsupported platform

Instead of having to write a “check task” for each role like

`

  • name: Check for unsupported platform
    fail: msg=“The operating system {{ ansible_distribution }} / {{ ansible_os_family }}) is not currently supported.”
    when: "ansible_os_family not in [‘Darwin’, ‘Debian’, ‘RedHat’]"¬

`

ansible could (optionally be configured to) apply a “support check up” based on the platforms information (names and versions) defined in role’s meta/main.yml.

Note that this “auto-check” feature should be optional or easily overridable, because in some context you might prefer to not check anything or have different support conditions (e.g. support ansible_distribution ‘MacOSX’ but not necessarily the “whole” ansible_os_family ‘Darwin’), which might be not present in role meta data.

I know this is a little added value, but I think it could help to make roles look nicer and encourage good practices in meta data usage. Looking forward to reading your feedbacks :slight_smile:

Best regards and a Happy New Year 2015 to everybody!
Gilles

I think if we did this, it should be on all the time.

I’m wanting to control config option sprawl, as that’s more cognitive load on trying to figure out what to turn on, should I do this or not, best practices, etc.

However if the role doesn’t have metadata, it shouldn’t do anything to stop execution.

Ultimately, this needs to wait until the v2 refactoring tree is “live” so we don’t have a moving target to hit, but I’m open to the idea.

Thanks!

Thanks Michael for your positive feedback! If you agree, I’ll create a GitHub issue to keep this idea in the “TODO’s heap”, making it clear that its development requires v2 refactoring.