Fix 'add_hosts' task to add headers only when needed