When assigning variables under certain conditions, if there is no match,
the last condition is erroneously assigned.
Ej:
---
- hosts: hostwin
vars:
# Definimos el paquete a instalar según el sistema operativo.
- package_name: httpd
when: ansible_os_family == "Red Hat"
- package_name: apache2
when: ansible_os_family == "Debian"
tasks:
# Consultamos al usuario si quiere actuar con dicho paquete.
- name: Consulta sobre la instalacion del paquete {{package_name}} en
{{ansible_os_family}}
pause: prompt="Acepta la instalacion del paquete {{package_name}} en
{{ansible_os_family}} "
register: confirmación
# ansible-playbook playbooks/test-httpd.yml
PLAY [hostwin] ***************************************
TASK [setup] *******************************************************************
ok: [hostwin]
TASK [Consulta sobre la instalacion del paquete apache2 en *Windows*]
************
[Consulta sobre la instalacion del paquete apache2 en *Windows*]
Acepta la instalacion del paquete apache2 en *Windows* :
ok: [hostwin]
PLAY RECAP *********************************************************************
hostwin : ok=2 changed=0 unreachable=0 failed=0
This should be null or return error, but do not assign any one.
--
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/56e7d408-ebe6-476a-b928-0fbcad290a1e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.