from .xlate import XLATOR
-__version__ = '1.8.3'
+__version__ = '1.9.0'
LOG = logging.getLogger(__name__)
_ = XLATOR.gettext
},
}
+ default_vsphere_tag_cat_os_id = 'OS'
+ default_vsphere_tag_cat_os_name = 'OS'
+ default_vsphere_tag_cat_os_desc = 'The operating system of a VM.'
+
+ default_vsphere_tag_os_rhel_id = 'os_rhel'
+ default_vsphere_tag_os_rhel_name = 'rhel'
+ default_vsphere_tag_os_rhel_desc = 'RedHat Enterprise Linux'
+
default_min_root_size_gb = 32.0
default_tz_name = 'Europe/Berlin'
default_guest_id = "oracleLinux7_64Guest"
self._rhsm_user = self.default_rhsm_user
self._rhsm_password = None
+ self._vsphere_tag_cat_os_id = self.default_vsphere_tag_cat_os_id
+ self._vsphere_tag_cat_os_name = self.default_vsphere_tag_cat_os_name
+ self._vsphere_tag_cat_os_desc = self.default_vsphere_tag_cat_os_desc
+
+ self._vsphere_tag_os_rhel_id = self.default_vsphere_tag_os_rhel_id
+ self._vsphere_tag_os_rhel_name = self.default_vsphere_tag_os_rhel_name
+ self._vsphere_tag_os_rhel_desc = self.default_vsphere_tag_os_rhel_desc
+
self._no_pdns = False
self.puppet_envs_add = set()
raise ValueError(msg)
self._pdns_api_timeout = val
+ # -----------------------------------------------------------
+ @property
+ def vsphere_tag_cat_os_id(self):
+ """The terraform ID of the VSphere tag category 'OS'."""
+ return self._vsphere_tag_cat_os_id
+
+ # -----------------------------------------------------------
+ @property
+ def vsphere_tag_cat_os_name(self):
+ """The name of the VSphere OS tag category."""
+ return self._vsphere_tag_cat_os_name
+
+ # -----------------------------------------------------------
+ @property
+ def vsphere_tag_cat_os_desc(self):
+ """The description of the VSphere OS tag category."""
+ return self._vsphere_tag_cat_os_desc
+
+ # -----------------------------------------------------------
+ @property
+ def vsphere_tag_os_rhel_id(self):
+ """The terraform ID of the VSphere tag for OS RHEL."""
+ return self._vsphere_tag_os_rhel_id
+
+ # -----------------------------------------------------------
+ @property
+ def vsphere_tag_os_rhel_name(self):
+ """The name of the VSphere tag for OS RHEL."""
+ return self._vsphere_tag_os_rhel_name
+
+ # -----------------------------------------------------------
+ @property
+ def vsphere_tag_os_rhel_desc(self):
+ """The description of the VSphere tag for OS RHEL."""
+ return self._vsphere_tag_os_rhel_desc
+
# -----------------------------------------------------------
@property
def vm_root_password(self):
res['root_min_size'] = self.root_min_size
res['root_max_size'] = self.root_max_size
res['rhsm_user'] = self.rhsm_user
+ res['vsphere_tag_cat_os_id'] = self.vsphere_tag_cat_os_id
+ res['vsphere_tag_cat_os_name'] = self.vsphere_tag_cat_os_name
+ res['vsphere_tag_cat_os_desc'] = self.vsphere_tag_cat_os_desc
+ res['vsphere_tag_os_rhel_id'] = self.vsphere_tag_os_rhel_id
+ res['vsphere_tag_os_rhel_name'] = self.vsphere_tag_os_rhel_name
+ res['vsphere_tag_os_rhel_desc'] = self.vsphere_tag_os_rhel_desc
res['vsphere'] = {}
for vsphere_name in self.vsphere.keys():
from ..xlate import XLATOR
-__version__ = '0.4.2'
+__version__ = '0.5.0'
LOG = logging.getLogger(__name__)
_ = XLATOR.gettext
''')
content += tpl.format(tn=tpl_tf_name, n=tname)
+ tpl = textwrap.dedent('''\
+ resource "vsphere_tag_category" "{cid}" {{
+ name = "{cname}"
+ description = "{cdesc}"
+ cardinality = "SINGLE"
+ associable_types = [
+ "VirtualMachine",
+ ]
+ }}
+
+ resource "vsphere_tag" "{tid}" {{
+ name = "{tname}"
+ category_id = "${{vsphere_tag_category.{cid}.id}}"
+ description = "{tdesc}"
+ }}
+
+ ''').format(
+ cid=self.config.vsphere_tag_cat_os_id,
+ cname=self.config.vsphere_tag_cat_os_name,
+ cdesc=self.config.vsphere_tag_cat_os_desc,
+ tid=self.config.vsphere_tag_os_rhel_id,
+ tname=self.config.vsphere_tag_os_rhel_name,
+ tdesc=self.config.vsphere_tag_os_rhel_desc,
+ )
+ content += tpl
+
+
if self.simulate:
if self.verbose:
print(content)