from .xlate import XLATOR
-__version__ = '3.1.0'
+__version__ = '3.1.1'
LOG = logging.getLogger(__name__)
_ = XLATOR.gettext
# --------------------------------------------------------------------------
def create_varfiles(self):
+ vs_name = str(self.vsphere.keys()[0])
+ vs_host = self.config.vsphere[vs_name].host
+ vs_port = self.config.vsphere[vs_name].port
+ vs_user = self.config.vsphere[vs_name].user
+ vs_pwd = self.config.vsphere[vs_name].password
+ vs_dc = self.config.vsphere[vs_name].dc
+
content = textwrap.dedent('''\
## filename: terraform.tfvars
## This file declares the values for the variables to be used in the instance.tf playbook
''')
- content = tpl.format(
- u=self.config.vsphere_user, p=self.config.vsphere_password,
- a=self.config.pdns_api_key)
+ content = tpl.format(u=vs_user, p=vs_pwd, a=self.config.pdns_api_key)
LOG.debug(_("Creating {!r} ...").format('private.auto.tfvars'))
if self.simulate:
}}
''')
- content += tpl.format(self.config.vsphere_host)
+ content += tpl.format(vs_host)
tpl = textwrap.dedent('''\
variable "vsphere_user" {
}}
''')
- content += tpl.format(dc=self.config.vsphere_dc)
-
-# i = 0
-# for cluster in self.vsphere.clusters:
-# i += 1
-# tpl = textwrap.dedent('''\
-# variable "{v}" {{
-# default = "{cl}"
-# description = "Name of the vSphere host cluster {i} to use."
-# type = "string"
-# }}
-#
-# ''')
-# content += tpl.format(v=cluster.var_name, cl=cluster.name, i=i)
+ content += tpl.format(dc=vs_dc)
tpl = textwrap.dedent('''\
variable "timezone" {{