Preheat oven to 180 degrees C. Line a rimmed baking tray with baking paper.
Arrange pineapple slices in an even layer on prepared tray.
Roast pineapple in the preheated oven until tender, about 45 minutes. Let cool until easily handled, 20 to 30 minutes.
Transfer cooled pineapple to a container. Top with rum.
Split vanilla bean lengthwise with the tip of a sharp knife. Holding the pod open, scrape seeds from each half using the flat side of your knife. Add seeds and scraped pods to the container. Stir in raisins, cinnamon sticks, orange zest, vanilla extract, peppercorns, allspice berries, nutmeg, star anise and cardamom.
Seal container and store in a cool, dark place. Mix every day, removing any spice that becomes too dominant for your taste, until rum reaches desired flavour, 5 days to 2 weeks. Strain through a fine sieve. Strain again through a coffee filter. Discard whole spices; reserve strained fruit.