--- - hosts: '{{ ip_addr }}' become: yes become_method: sudo gather_facts: yes tasks: - name: "[CONFIG HOSTS FILE] Comprobando si es necesario configurar hosts file " debug: msg: "No es necesario configurar hosts file en la máquina" when: hosts_enabled is not defined or not hosts_enabled - name: "[CONFIG HOSTS FILE] Configure hosts file" import_role: name: config-hosts when: hosts_enabled is defined and hosts_enabled