**Check variable** ansible -i inventories/ -m debug -a "msg={{ ((users|default([])|selectattr('ssh_key','defined')|list|first).ssh_key|split('-'))[1] }}" host **Install packege** ansible -i inventories/ -m apt -a "name=package" host