I again, thank you all for your help, I’m really learning a lot. I have a new query. I am passing via "extra-vars" a variable called wc2env and I need to compare it with a string (stage or prod).
Here is my playbook: hosts: all gather_facts: no vars: wc2env: '{{ wc2env }}' tasks: - name: "Validando si debo deployar dominio en PROD" ansible.builtin.import_playbook: add_carrier_prod.yaml when: "{{ wc2env == 'prod' }}" - name: "Validando si debo deployar el dominio en STAGE" ansible.builtin.import_playbook: add_carrier_stage.yaml when: "{{ wc2env == 'stage' }}" I run the playbook this way and for some reason the condition returns "false": ansible-playbook -i hosts --extra-vars "wc2env=stage" alta_carrier/playbook/tasks_target.yaml Here the debug: PLAYBOOK: tasks_target.yaml ************************************************************************************************************************ Positional arguments: alta_carrier/playbook/tasks_target.yaml verbosity: 8 connection: smart timeout: 10 become_method: sudo tags: ('all',) inventory: ('/etc/ansible/webcheckin/hosts',) extra_vars: ('wc2env=stage',) forks: 50 step: True 4 plays in alta_carrier/playbook/tasks_target.yaml [WARNING]: conditional statements should not include jinja2 templating delimiters such as {{ }} or {% %}. Found: {{ wc2env == 'prod' }} skipping: [wc2-stage] => { "changed": false, "skip_reason": "Conditional result was False" } I’m doing something wrong and I don’t realize they could help me. 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 ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAGUDtn%3DML6m-Q%2Boo9EfyWo8r7R91AgrM27_%3DNVU9FT0c_KokJw%40mail.gmail.com.