How to automount a network share once OpenVPN has connected? (Using Tunnelblick)
1.

Edit the file /Applications/Tunnelblick.app/Contents/Resources/client.up.osx.sh and add these commands at the end of the file, just before exit 0 :

su USERNAME -c '
mkdir /Volumes/TimeCapsule
mount_afp afp://afp_username@server/volumename /Volumes/TimeCapsule
'
open /Volumes/TimeCapsule


Replace USERNAME with your username on the system.

2.

Then add the following at the end of /Applications/Tunnelblick.app/Contents/Resources/client.down.osx.sh :

umount /Volumes/TimeCapsule


3.

Do not forget to check the set nameserver option for your configuration : 



Warning : Configuration files client.(up|down).osx.sh are executed for every connections made using OpenVPN.

This could also be made using launchd for watching if the vpn connection is up, but I don't know how to use launchd.