with_dict + conditional depending on item.value

Hi,

I’ve been working on single and multiple wars deployment ansible scripts. To simplify teh mutiple I just created the vars/projectX.yml with the artifacts information so the ansible call doesn’t contain several parameters…

I’ve been able to pull the artifacts from nexus and deployed them, but I want to test the deployed apps only when an artifact’s variable value has been set, I just read about the "default{}"usage but what I need is to check a specific attribute over the iteration. is this possible?

tasks/test_app_multiple.yml:

  • name: Checking if the application is running
    get_url: url=http://{{ host_ip.stdout }}:{{ application_port }}/{{ item.value.application_path }} dest=“/tmp”
    with_dict: artifacts
    when: item.value.application_path != “”
  • For the record, I got a similar task but for single deploy without the "with_dict"clause and it works with no issues, in that case the application_path variable is provided in ansible-playbook call as argument…