diff --git a/README.md b/README.md index b2c3e70..a2eabaa 100644 --- a/README.md +++ b/README.md @@ -44,13 +44,13 @@ This example would run /usr/local/bin/additional-provisioning-steps.sh on the sa ##### Clone a template and put vm is specific folder ``` -ezmomi clone --template centos67 --hostname test01 --cpus 2 --mem 4 --destination-folder "/DC/folder/" --ips 172.10.16.203 172.10.16.204 +ezmomi clone --server vcenter_url --template centos67 --hostname test01 --cpus 2 --mem 4 --destination-folder "/DC/folder/" --ips 172.10.16.203 172.10.16.204 ``` -This ^ example will put the cloned vm to specific destination folder +This example will put the cloned vm to specific destination folder in specified vcenter. -##### Power Operations +##### Power Operations Guest shutdown diff --git a/ezmomi/config/config.yml.example b/ezmomi/config/config.yml.example index 93c0b6b..e7cdef7 100644 --- a/ezmomi/config/config.yml.example +++ b/ezmomi/config/config.yml.example @@ -17,7 +17,6 @@ password: "mypass#123" cpus: 1 mem: 3 -default_templates_path: "Specific_folder_for_the_template_This_is_option_like_/DC/folder1/folder2" #Optional template: centos65 domain: example diff --git a/ezmomi/ezmomi.py b/ezmomi/ezmomi.py index 26ef783..af17ae6 100644 --- a/ezmomi/ezmomi.py +++ b/ezmomi/ezmomi.py @@ -162,7 +162,6 @@ def clone(self): self.config['hostname'] = self.config['hostname'].lower() self.config['mem'] = int(self.config['mem'] * 1024) # convert GB to MB - template_path = self.config['default_templates_path'] print "Cloning %s to new host %s with %sMB RAM..." % ( self.config['template'], self.config['hostname'], @@ -255,12 +254,12 @@ def clone(self): % ip_settings[0]['datastore'] sys.exit(1) - if template_path: + if self.config['template_folder']: template_vm = self.get_vm_failfast( self.config['template'], False, 'Template VM', - path=template_path + path=self.config['template_folder'] ) else: template_vm = self.get_vm_failfast( diff --git a/ezmomi/params.py b/ezmomi/params.py index 86e7b04..02ec0a9 100644 --- a/ezmomi/params.py +++ b/ezmomi/params.py @@ -46,6 +46,12 @@ def arg_setup(): help="Set this flag to disable ssl verification" ) + common_parser.add_argument( + "--server", + required=False, + help="vsphere server to connect to." + ) + # list list_parser = subparsers.add_parser( "list", @@ -178,6 +184,12 @@ def arg_setup(): type=str, help="VM template name to clone from" ) + clone_parser.add_argument( + "--template-folder", + type=str, + default="", + help="Folder to pull templates from" + ) clone_parser.add_argument( "--host", required=False,