You can but I would recommend adding it at bottling/kegging time. Soak the spices and vanilla ( cut length wise and scrapped out ) in some vodka and dose the bottling bucket or keg.
If you do add at primary, I'd still soak them in a small amount of vodka and add after the primary is done at least 90%