The mongodb service runs as user mongodb, and therefore the preStart-script has no permissions to set up mongodb directories. This is solved by adding an initialisation service that runs as root and just sets up the required directories.