# Making an unsafe variable safe

**URL:** <https://forum.ansible.com/t/making-an-unsafe-variable-safe/33059>\
**Category:** Ansible Project\
**Created:** [May 31, 2020, 3:42pm UTC](https://forum.ansible.com/t/making-an-unsafe-variable-safe/33059 "2020-05-31T15:42:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vadim\_Eisenberg](https://avatars.discourse-cdn.com/v4/letter/v/9d8465/32.png) [@Vadim\_Eisenberg](https://forum.ansible.com/u/Vadim_Eisenberg)\
**Post date:** [May 31, 2020, 3:42pm UTC](https://forum.ansible.com/t/making-an-unsafe-variable-safe/33059/1 "2020-05-31T15:42:18Z")

</div>

Hello,

I have the following use case: I want to read a string from some source into a variable, marking it unsafe. Then I want to perform my own sanitation checks and then make the variable safe so I could use Jinja2 templating on it. My question is: is there something opposite to the `!unsafe` tag, like `!safe`? Or any other tip how to make an unsafe variable safe?

Thanks,  
Vadim

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [June 1, 2020, 3:51pm UTC](https://forum.ansible.com/t/making-an-unsafe-variable-safe/33059/2 "2020-06-01T15:51:10Z")

</div>

No, not really.
