# Variable validation for user input

**URL:** <https://forum.ansible.com/t/variable-validation-for-user-input/14469>\
**Category:** Ansible Project\
**Created:** [January 31, 2014, 4:03pm UTC](https://forum.ansible.com/t/variable-validation-for-user-input/14469 "2014-01-31T16:03:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Doug\_Campbell](https://avatars.discourse-cdn.com/v4/letter/d/87869e/32.png) [@Doug\_Campbell](https://forum.ansible.com/u/Doug_Campbell)\
**Post date:** [January 31, 2014, 4:03pm UTC](https://forum.ansible.com/t/variable-validation-for-user-input/14469/1 "2014-01-31T16:03:51Z")

</div>

Is there an easy way to validate user imputed variables in a playbook? I am taking in an IP address from a vars\_prompt and I just want to validate the variable to make sure the IP does not have any typos before using it in a lineinfile task. Do I need to make a module for this or am I just missing an easier way?

Example: I input 123,53,56,2 it should fail (or auto correct) because it has commas instead of periods. Or 1111.23.3.4 should fails since 1111 is not a valid octet. I just want to protect against a typo before it writes to the file.
