Jump to content

Server Provision Automation


m5-1000

Recommended Posts

Hi,

 

I'm new to whmcs and am currently looking to automate server provisioning once a transaction has been processed. I'm currently in a testing phase, so my product is "free" at the moment.

 

The product includes the following information;

-"Product name"

-"Operating System"

-"Root Password"

 

I would like to take this info and pass it to another server. The other server is running tcl/expect and will do the actuall provisioning. All I need to do is pass the product,operating system, and password as a command to the other server.

 

I have downloaded the ModuleDevKit and read about hooks, but I am really unsure where to go with this? I have bash,tcl, and expect skills as well as modurate php and perl skills, enough to modify php and perl.

 

I'm wondering if anyone has successfully done this before or if someone can point me in the right direction. Any help is appreciated.

 

Thank you

Link to comment
Share on other sites

Thanks Joe,

 

I read through the link. Unfortunately I wasn't able to make heads or tails of any of it. The update function looks like something I could use;

 

 

 

function mymodule_UsageUpdate($params) {

 

$serverid = $params['serverid'];

$serverhostname = $params['serverhostname'];

$serverip = $params['serverip'];

$serverusername = $params['serverusername'];

$serverpassword = $params['serverpassword'];

$serveraccesshash = $params['serveraccesshash'];

$serversecure = $params['serversecure'];

 

# Run connection to retrieve usage for all domains/accounts on $serverid

 

# Now loop through results and update DB

 

foreach ($results AS $domain=>$values) {

update_query("tblhosting",array(

"diskused"=>$values['diskusage'],

"dislimit"=>$values['disklimit'],

"bwused"=>$values['bwusage'],

"bwlimit"=>$values['bwlimit'],

"lastupdate"=>"now()",

),array("server"=>$serverid,"domain"=>$values['domain']));

}

 

}

 

 

Where it loggs into the external server and enters the command;

[root@Server] ./command [serverProduct] [CentOS] [RootPASSword]

 

 

I'm thinking I could take the variables in the above code and use it in php expect? I'm just really unsure about the intended usage of the above code? How does it and what other code (if any) actually executes the above php?

 

Just to add - With my current product, it sends me a WHMCS New Order Notification with the variables I need to send to the new server. I'm wondering if I can sort of use the same idea as the email template but rather send the command and execute it on the other server.

 

I hope this makes sense,

 

-Thanks-

Link to comment
Share on other sites

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated