# assert and fail. When to use what?

**URL:** <https://forum.ansible.com/t/assert-and-fail-when-to-use-what/26621>\
**Category:** Ansible Project\
**Created:** [February 1, 2018, 3:13pm UTC](https://forum.ansible.com/t/assert-and-fail-when-to-use-what/26621 "2018-02-01T15:13:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Varun\_Chopra](https://avatars.discourse-cdn.com/v4/letter/v/54ee81/32.png) [@Varun\_Chopra](https://forum.ansible.com/u/Varun_Chopra)\
**Post date:** [February 1, 2018, 3:13pm UTC](https://forum.ansible.com/t/assert-and-fail-when-to-use-what/26621/1 "2018-02-01T15:13:09Z")

</div>

Hi,

I’ve been working on a playbook that asserts prerequisites required for a mssql installation and I’m not entirely confident with what I’ve come up with.

[https://gist.githubusercontent.com/chopraaa/1b74480a7b286ee91dd855ae670104f1/raw/660b758b4e82e0b689999e6fe73946d005cfcac9/mssql.yml](https://gist.githubusercontent.com/chopraaa/1b74480a7b286ee91dd855ae670104f1/raw/660b758b4e82e0b689999e6fe73946d005cfcac9/mssql.yml)

What I know is that if an assert is false, it fails the playbook, and the same can be done using the fail module. So what’s the difference between the two?

---

<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:** [March 5, 2018, 5:00pm UTC](https://forum.ansible.com/t/assert-and-fail-when-to-use-what/26621/2 "2018-03-05T17:00:57Z")

</div>

Not much, they are mostly a 'contrary alias', I would be happy  
deprecating one of them in favor of the other.
