Hi, I need your help, this is my stage.

Good morning I need your help, I want to run a playbook using a console
variable and compare it with a dictionary, example:

ansible-playbook --extra-vars "SERVER=new" example. <https://example.com/>
yaml

If in the console variable I type new I want to print the value of the url
key belonging to new and if I type old I type the url value in old.

---
- name: "Instalando Elastic Logger"
  hosts: localhost
  gather_facts: no
  vars:
   servers:
      new:
        url: "url-new"
      old:
        url: "url-old"
  tasks:
    - name: "Debug"
      shell: echo '{{ url-new }} '
      when: new in dict

    - name: "Debug"
      shell: echo '{{ url-old }} '
      when: old in dict

any helps?

Regards,

-- 
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/CAGUDtnkq%3DkZjfQs_8W77%2B9yrk10pMXAF_EmxTAwzf%2BHNC2D%2BKw%40mail.gmail.com.

Reply via email to