Skip to content
Snippets Groups Projects

validate_role_parameters

This role MUST be imported/included from another role.

validate_role_parameters checks if the variables used by a role and defined in a JSON schema meet their requirements.

Example Playbook

---
- name: Validate role parameters
  hosts: "all"
  roles:
    # A message will say that validation is skipped because the role is not
    # imported nor included from another role.
    - role: validate_role_parameters

Example Role

---
# tasks/main.yaml
- name: Validate role parameters
  ansible.builtin.include_role:
    name: validate_role_parameters
---
# vars/main.yaml
role_name_variable_schema:
  type: object
  properties:
    role_example_string:
      type: string
    role_example_integer:
      type: integer
      minimum: 1
      maximum: 65535

License

GPLv3

Author information

Wallun <wallun CAT disroot DOG org>