Skip to content
Xavier Cases Camats edited this page Jul 7, 2016 · 3 revisions

Here you can see the content of the file mongodb.xml explained:

<NodeType name="MongoDB" shape="ellipse" color="#332299" image="docker.png">
	<DerivedFrom typeRef="root" />
	<PropertiesDefinition element="MongoDBProperties"
		type="tMongoDBProperties" />
	<Interfaces>
		<Interface name="Install">
			<Operation name="compilePuppetTemplateHierarchy"></Operation>
		</Interface>
	</Interfaces>
	<CapabilityDefinitions>
		<CapabilityDefinition capabilityType="portsExposeCaps" />
	</CapabilityDefinitions>
</NodeType>
<NodeTypeImplementation nodeType="MongoDB"
	name="MongoDBImpl">
	<DeploymentArtifacts>
		<DeploymentArtifact name="MongoDBPT.ftl"
			artifactType="PuppetTemplate" artifactRef="MongoDBPT">
		</DeploymentArtifact>
		<DeploymentArtifact artifactType="PuppetModule"
			artifactRef="MongoDBPM">
		</DeploymentArtifact>
	</DeploymentArtifacts>
</NodeTypeImplementation>
<ArtifactTemplate type="PuppetTemplate" id="MongoDBPT">
	<ArtifactReferences>
		<ArtifactReference reference="Templates/MongoDBPT.ftl"></ArtifactReference>
	</ArtifactReferences>
</ArtifactTemplate>
<ArtifactTemplate type="PuppetModule" id="MongoDBPM">
	<Properties
		xmlns:co="http://docs.oasis-open.org/tosca/ns/2011/12/CloudOptingTypes">
		<co:PuppetModuleProperties>
			<co:module>mongodb</co:module>
			<co:git>https://github.com/puppetlabs/puppetlabs-mongodb</co:git>
		</co:PuppetModuleProperties>
	</Properties>
</ArtifactTemplate>

In the file CloudOptingTypes.xsd we can find the types tMongoDBProperties and MongoDBProperties defined:

	<xs:complexType name="tMongoDBProperties">
		<xs:sequence>
			<xs:element name="admin_username">
				<xs:complexType>
					<xs:simpleContent>
						<xs:extension base="xs:string">
							<xs:attribute name="title" fixed="Root DB user"></xs:attribute>
							<xs:attribute name="formtype" fixed="string"></xs:attribute>
						</xs:extension>
					</xs:simpleContent>
				</xs:complexType>
			</xs:element>
			<xs:element name="admin_password">
				<xs:complexType>
					<xs:simpleContent>
						<xs:extension base="xs:string">
							<xs:attribute name="title" fixed="Root DB password"></xs:attribute>
							<xs:attribute name="formtype" fixed="string"></xs:attribute>
						</xs:extension>
					</xs:simpleContent>
				</xs:complexType>
			</xs:element>
			<xs:element name="bind_ip">
				<xs:complexType>
					<xs:simpleContent>
						<xs:extension base="xs:string">
							<xs:attribute name="title" fixed="Listen addresses"></xs:attribute>
							<xs:attribute name="formtype" fixed="string"></xs:attribute>
						</xs:extension>
					</xs:simpleContent>
				</xs:complexType>
			</xs:element>
			<xs:element name="version">
				<xs:complexType>
					<xs:simpleContent>
						<xs:extension base="xs:string">
							<xs:attribute name="title" fixed="MongoDB version"></xs:attribute>
							<xs:attribute name="formtype" fixed="string"></xs:attribute>
						</xs:extension>
					</xs:simpleContent>
				</xs:complexType>
			</xs:element>
		</xs:sequence>
	</xs:complexType>
	<xs:element name="MongoDBProperties" type="tMongoDBProperties" />

The defined params have to match with the puppetfile MongoDBPT.ftl

<#if version?has_content>class { '::mongodb::globals':
<#if version?has_content>version => '${version}',</#if>
}-></#if>
class { '::mongodb::server':
      <#if bind_ip?has_content>bind_ip => '${bind_ip}',</#if>
      <#if admin_password?has_content>admin_password => '${admin_password}',</#if>
      <#if port?has_content>port => ${port},</#if>
      <#if admin_username?has_content>admin_username => '${admin_username}',</#if>
    }

<#foreach childTemplate in childtemplates>
${childTemplate}
</#foreach>

With this nodetype what we can see on the TOSCA IDE is the following: image

Clone this wiki locally