Cloudinit is a good direction I would say (preferring SSH keys than root password by the way)