automatically create/add multiple sub-server

6 posts / 0 new
Last post
#1 Tue, 05/12/2009 - 04:23
thetitan

automatically create/add multiple sub-server

I would like to automatically create/add multiple sub-server from a list. Is this posible in the GPL version? Is there a module or maybe someone has written a script that can do this?

I want to add handful of domains as aliases to an already existing server, but I would like to save some time. I would like to be able to either have a script or a module read a text file containing the domains or maybe paste them in a text box in a module and then let it go to work. It will follow the exact same process for creating a single sub-servers, only difference is that instead stopping after the sub-server has been created, it will restart the process for the domain next on the list, until the end of the list.

Months ago I read something about being able to do this in Virtualmin, but I can't remember if it was on the forums or somewhere else, and if it was a GPL, PRO or independent module feature. I have tried different searches here, but they haven't been very productive.

Tue, 05/12/2009 - 05:33
andreychek

Howdy,

I don't know a way to do it within the Virtualmin web GUI (the Pro version does have a "batch import" option, however).

You may be able to do what you need from the command line. They recently began including all the command line tools in the GPL version, and there's some things there that I think will help.

They're all documented here:

http://www.virtualmin.com/documentation/id,command_line_api/

But specifically, this one creates Virtual Servers:

http://www.virtualmin.com/documentation/id,virtualmin_api_create_domain/

And from there, you could do some scripting on your own to read your data from a file, and pass it to the Virtualmin script.
-Eric

Tue, 05/12/2009 - 06:11
thetitan

Awesome. Thank you Eric.

Tue, 05/12/2009 - 06:14
thetitan

Thinking about it, I might have read about this in the new release announcements.

Tue, 05/19/2009 - 08:46
thetitan

Let say I want to create a sub-server of type <u>alias</u>, where maindom.tld is the main domain and aliassubdom.tld is the alias of maindom.tld. I also want the applicable <i>server configuration template</i> to be domaliasplan and the <u>external IP address</u> to be &quot;Same as real address&quot;.

Would the following be the correct command line:

[code:1]virtualmin create-domain --alias aliassubdom.tld --paren maindom.tld --template domaliasplan --dns --web[/code:1]

Wed, 05/20/2009 - 18:47
thetitan

I figured it out

The correct command would be:

[code:1]virtualmin create-domain --domain aliassubdom.tld --alias maindom.tld --template domaliasplan --dns --web[/code:1]

--domain being the domain I want to add and --alias is the target domain/the main/parent domain to be aliased by the domain I am adding.

Topic locked