Modules automatique installation

Hi alls,
I must to deploy FreePBX to the servers and install same modules in the deployed servers.
I look for a possibility to deploy modules automaticly.
I think to downloads .tar modules files and installing by a script but I don’t know if it is a good idea …
Any idea ?