# Help with conditional

**URL:** <https://forum.ansible.com/t/help-with-conditional/27011>\
**Category:** Ansible Project\
**Created:** [March 16, 2018, 7:38am UTC](https://forum.ansible.com/t/help-with-conditional/27011 "2018-03-16T07:38:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marc\_Herren](https://avatars.discourse-cdn.com/v4/letter/m/5f8ce5/32.png) [@Marc\_Herren](https://forum.ansible.com/u/Marc_Herren)\
**Post date:** [March 16, 2018, 7:38am UTC](https://forum.ansible.com/t/help-with-conditional/27011/1 "2018-03-16T07:38:03Z")

</div>

Hi all,

I’m struggling with the following conditional check:

`

- set\_fact:  
url: “{{ url | default(‘www.search.ch’) }}”  
url\_points\_to: “‘{{ lookup(‘dig’, ‘{{ url }}’) }}’”

- block:

- name: “Check if {{ url }} points to our Liferay Webserver”  
fail:  
msg: “DNS doesn’t point to our Liferay webserver. Let’s encrypt won’t work!”

- meta: end\_play  
when:

- url\_points\_to != “lr\_public\_ip”

- deploy\_type == “goinglive”  
`

Although I provide the IP, which points to www.search.ch in this example, it always fails.

From the debugger I see:  
`(debug) p vars['deploy_type'] u'goinglive' (debug) p vars['lr_public_ip'] u'195.141.85.90' (debug) p vars['url_points_to'] u"'195.141.85.90'"`

I see quotes on url\_points\_to, but I was not able to remove them.

Any help kindly appreciated.

Marc

---

<div class="post-metadata">

**Author:** ![Marc\_Herren](https://avatars.discourse-cdn.com/v4/letter/m/5f8ce5/32.png) [@Marc\_Herren](https://forum.ansible.com/u/Marc_Herren)\
**Post date:** [March 16, 2018, 8:13am UTC](https://forum.ansible.com/t/help-with-conditional/27011/2 "2018-03-16T08:13:04Z")

</div>

fixed it myself … sometime you don’t see the tree in the forest

`

- set\_fact:  
url: “{{ url | default(‘www.search.ch’) }}”  
working\_url: “{{ working\_url | default(‘www.search.ch’) }}”  
url\_points\_to: “{{ lookup(‘dig’, ‘{{ url }}’) }}”  
working\_points\_to\_us: “{{ lookup(‘dig’, ‘{{ working\_url }}’) }}”

- block:

- name: “Check if {{ url }} points to our Liferay Webserver”  
fail:  
msg: “DNS doesn’t point to our Liferay webserver. Let’s encrypt won’t work!”

- meta: end\_play  
when:

- url\_points\_to != lr\_public\_ip

- deploy\_type == “goinglive”  
`
