Introduction

The meta-runtime rule in Ansible checks the requires_ansible key in the meta/runtime.yml file to ensure it contains a supported version of Ansible. This rule helps maintain compatibility between Ansible collections and different versions of Ansible-core.

In a typical Ansible collection, the meta/runtime.yml file specifies the minimum required version of Ansible for the collection to function correctly. This requirement ensures that users of the collection are aware of the necessary Ansible version.

The rule enforces the use of supported Ansible versions, such as 2.13.x, 2.14.x, and 2.15.x, which are known to work with the collection. If an unsupported version is specified in the requires_ansible key, it triggers an error.

This rule aims to prevent potential compatibility issues, improve user experience, and provide clear guidance for collection developers. Ensuring that the requires_ansible key is set to a supported version helps maintain the reliability and functionality of Ansible collections.

Problematic Code

``yaml

runtime.yml

---

requires_ansible: ">=2.9"

`

Ansible Lint Output:

`bash

WARNING Ignored exception from CheckRequiresAnsibleVersion.<bound method CheckRequiresAnsibleVersion.matchyaml of meta-runtime: Required ansible version in meta/runtime.yml must be a supported version.> while processing test/test/meta/runtime.yml (meta-runtime): 'NoneType' object has no attribute 'get'

WARNING Listing 1 violation(s) that are fatal

schema[meta-runtime]: $ None is not of type 'object'. See https://docs.ansible.com/ansible/devel/dev_guide/developing_collections_structure.html#meta-directory

test/test/meta/runtime.yml:1 Returned errors will not include exact line numbers, but they will mention

the schema name being used as a tag, like schema[playbook],

schema[tasks].

This rule is not skippable and stops further processing of the file.

If incorrect schema was picked, you might want to either:

* move the file to standard location, so its file is detected correctly.

* use kinds: option in linter config to help it pick correct file type.

Read documentation for instructions on how to ignore specific rule violations.

Rule Violation Summary

count tag profile rule associated tags

1 schema[meta-runtime] basic core

Failed: 1 failure(s), 0 warning(s) on 1 files. Last profile that met the validation criteria was 'min'.

`

Correct Code

`yaml

runtime.yml

---

requires_ansible: ">=2.14.0"

`

In the correct code, the requires_ansible key specifies the minimum required Ansible version as 2.14.0, ensuring compatibility with Ansible versions that include this release and higher. Using a valid version specification helps avoid errors and ensures smooth operation of the collection.

Developers should follow the guidelines and maintain the requires_ansible` key with the supported version to provide a se