How to use tasker to select playlist

Is it possible to automate my music so that Playlist A plays when I connect to my car, but a different playlist plays when I connect to my headphones?

Should be possible but I have not tried.