In this recipe, we will outline how to validate input data using Ansible. We rely heavily on the information that we either retrieve from the network or declare in host or group variables, in order to execute different tasks in Ansible such as generating configuration or provisioning devices. Before we start to use this information, we need to be able to validate the structure and validity of this data before further processing our playbooks.
Validating user input using Ansible
How to do it...
- Create an ACLs definition in ACLs.yml, as shown in the following code block:
---
ACLs:
INFRA_ACL:
- src: 10.1.1.0/24
dst: any
dport: ssh
state: present
- src: 10.2.1.0/24
dst: any
app: udp
dport...