What is `argument_specs` for roles?
AdvancedConceptRoles, Collections and Galaxy
Answer
meta/argument_specs.yml declares a role's accepted variables with types, defaults, choices and required flags. Ansible validates the inputs before the role runs and fails with a clear message, and the spec also feeds documentation (ansible-doc -t role).
argument_specs:
main:
short_description: Install and configure nginx
options:
nginx_port:
type: int
default: 80
nginx_tls:
type: bool
default: false
nginx_sites:
type: list
elements: dict
required: true
This replaces hand-written assert blocks at the top of tasks/main.yml.