ipbhat.sample.infn_cfg_validator (1.0.0) — module

Validate the user defined configurations

Authors: Anand Krishna Rallabhandi (anand-krishna)

preview | supported by network

Install collection

Install with ansible-galaxy collection install ipbhat.sample:==1.0.0


Add to requirements.yml

  collections:
    - name: ipbhat.sample
      version: 1.0.0

Description

The configurations given are to be validated against a JSON Schema defined for them

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
---
- hosts: swne
  connection: local
  gather_facts: False
  vars_files:
    - group_vars/iqnos_radius_config.yml
  vars:
     NE_IP: "{{ ne_ip | default(hostvars[inventory_hostname]['ansible_host']) }}"
     NE_User: "{{ ne_user | default(hostvars[inventory_hostname]['ansible_user']) }}"
     NE_Pwd: "{{ ne_pwd | default(hostvars[inventory_hostname]['ansible_password']) }}"
  tasks:
    - name: Check if the input configuration is valid or not
      infn_cfg_validator:
        what_is_being_validated: "NTP Server Configs"
        configs: "{{ configs }}"
        schema: "{{ lookup('file', 'ntp_config_schema.json') | from_json | string }}"

Inputs

    
schema:
    description:
    - JSON Schema for the input configuration of that role
    required: true
    type: string

configs:
    description:
    - Input configurations for any role
    required: true
    type: dict

what_is_being_validated:
    description:
    - A string describing what is being validated
    required: true
    type: string