Hello here,

Today I'm blocked with a little problem in ma playbook.

I want to call a variable with the content of other variable.

The aim is to compare a database fields with environment variables to make 
an inventory of my servers.


The fonctionnal but crappy code was:

- set_fact: 
    artifact_field: "{{ item }}" 
  loop: "{{ lookup('list', json_artifact['json']['values']) }}" 
  when: (item.label == "OS_Version" and item.value != {{ OS_Version }}) or 
        (item.label == "DNS_Name" and item.value != {{ DNS_Name }}) or 
        (item.label == "Provider" and item.value != {{ Provider }}) or 
        (item.label == "Bay" and item.value != {{ Bay }}) or 
        (item.label == "Datacenter" and item.value != {{ Datacenter }})

I want to replace this with more versatile like:

- set_fact: 
    artifact_field: "{{ item }}" 
  loop: "{{ lookup('list', json_artifact['json']['values']) }}" 
  when: item.value != {{ {{ item.label }} }}) 


But this syntax do not work and I didn't find any workaround.

If somebody have an idea, it's will so apreciate :)

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/d55eae95-88d1-46ef-890a-d8c6454a7ea7%40googlegroups.com.

Reply via email to