community.general.a_module (8.5.0) — test

Test whether a given string refers to an existing module or action plugin

| "added in version" 4.0.0 of community.general"

Authors: Felix Fontein (@felixfontein)

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

Test whether a given string refers to an existing module or action plugin.

This can be useful in roles, which can use this to ensure that required modules are present ahead of time.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Make sure that community.aws.route53 is available
  ansible.builtin.assert:
    that:
      - >
        'community.aws.route53' is community.general.a_module
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Make sure that community.general.does_not_exist is not a module or action plugin
  ansible.builtin.assert:
    that:
      - "'community.general.does_not_exist' is not community.general.a_module"

Inputs

    
_input:
    description: A string denoting a fully qualified collection name (FQCN) of a module
      or action plugin.
    required: true
    type: string

Outputs

_value:
  description: Whether the module or action plugin denoted by the input exists.
  type: boolean