sean_m_sullivan.controller_configuration.enforce_defaults (2.2.0) — lookup

Return difference for objects from Controller API

| "added in version" 2.4.0 of sean_m_sullivan.controller_configuration"

Authors: Sean Sullivan (@sean-m-sullivan)

Install collection

Install with ansible-galaxy collection install sean_m_sullivan.controller_configuration:==2.2.0


Add to requirements.yml

  collections:
    - name: sean_m_sullivan.controller_configuration
      version: 2.2.0

Description

This plugin is used to return what the default value should be depending on conditions.

If enforce default is true, it will return the default value. Otherwise it will return the omit.

This is so the value used for the default filter can be turned on and off.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Test Filter
  ansible.builtin.debug:
    msg: "{{ nothing | default(lookup('infra.controller_configuration.enforce_defaults', enforce_default=false , default_value='', omit_value=omit), false) }}"

Inputs

    
omit_value:
    default: ''
    description:
    - the omit value
    type: str

default_value:
    default: ''
    description:
    - Value to supply if enforce_default is True.
    - This should be empty value or some form of string.

enforce_default:
    default: false
    description: Whether to enforce the default value or use omit.
    type: bool

Outputs

_raw:
  description:
  - Will either return the omit value, or the default value.