Help with conditional

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

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”
    `