ansibleansible-collections

Why do I get [WARNING]: running playbook inside collection


I am trying to structure my re-usable ansible code in collections (roles, modules...) and I wanted to use the same strategy for playbooks. Imagine a collection named acme.cloud.

In the root of the collection, I have the following files directory structure:

/docs
/meta
/playbooks
/playbooks/test.yml
/roles
galaxy.yml
README.md

Now when I run ansible-plybook acme.cloud.test -i /someinventory i get the warning:

[WARNING]: running playbook inside collection acme.cloud

The playbook runs fine but I am concerned about the warning, the reason about it, possible problems and side consequences. I could not find any documentation state that playbooks are not allowed in collections

Any idea or comment?

Thanks


Solution

  • This is indeed a simple warning which was added in 2020 when ansible learned to run playbooks from collections. I suppose this was a way to draw attention to developers/users that they were executing playbooks a bit differently than previously (e.g. no adjacent library folder for example).

    Unfortunately at this stage, this warning cannot be silenced. But the good news is there's a commit in devel branch on November 8 2022 which moves that information display from a warning to a simple info you get when running ansible in verbose mode (-v). It makes a lot of sense since running from collections is now well spread with the latest versions.

    This commit was pushed a day after ansible-core 2.14 version was fixed in the git repo and released. So I guess this feature will be available in ansible 2.14.1 (actually crafted in rc)