<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Templating guide on CloudBolt Documentation</title>
		<link>https://docs.cloudbolt.io/docs/onefuse/templating/</link>
		<description>Recent content in Templating guide on CloudBolt Documentation</description>
		<generator>Hugo</generator>
		<language>en-us</language>
		
		
		
		
			<atom:link href="https://docs.cloudbolt.io/docs/onefuse/templating/index.xml" rel="self" type="application/rss+xml" />
			<item>
				<title>Best practices</title>
				<link>https://docs.cloudbolt.io/docs/onefuse/templating/best-practices/</link>
				<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
				<guid>https://docs.cloudbolt.io/docs/onefuse/templating/best-practices/</guid>
				<description>&lt;p&gt;The CloudBolt OneFuse Platform leverages the &lt;a href=&#34;https://jinja.palletsprojects.com/en/2.11.x/&#34;&gt;Jinja2 templating language&lt;/a&gt; to allow our customers to define logic around how a module is to be consumed inside of a &lt;a href=&#34;https://docs.cloudbolt.io/docs/onefuse/concepts/policy/&#34;&gt;OneFuse Policy&lt;/a&gt;. These templates can be extremely powerful and can define very granularly exactly how OneFuse Policies should be consumed by an &lt;a href=&#34;https://docs.cloudbolt.io/docs/onefuse/consume/what-is-upstream-provider/&#34;&gt;Upstream Provider&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;However, the OneFuse Platform was designed to simplify your automation journey, so these best practices will help to better define how to mitigate complexity when building OneFuse Policies.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Property Sets</title>
				<link>https://docs.cloudbolt.io/docs/onefuse/templating/property-sets/</link>
				<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
				<guid>https://docs.cloudbolt.io/docs/onefuse/templating/property-sets/</guid>
				<description>&lt;p&gt;Property Sets are typically grouped in one of two main functional areas:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Property Sets for &lt;a href=&#34;#property-sets-for-modeling-onefuse-policies&#34;&gt;modeling OneFuse Policies&lt;/a&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Used for &lt;a href=&#34;#template-preview-results&#34;&gt;Template Previews&lt;/a&gt; in the OneFuse platform while building Policies with the &lt;a href=&#34;#active-property-set&#34;&gt;Active Property Set&lt;/a&gt;.&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Ability to validate the result of a &lt;a href=&#34;https://docs.cloudbolt.io/docs/onefuse/concepts/policy/&#34;&gt;Policy&lt;/a&gt; while building it, giving the user real-time feedback on exactly how the Policy will behave with a certain set of inputs.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;Property Sets for &lt;a href=&#34;#property-sets-for-property-toolkit-features&#34;&gt;Property Toolkit features&lt;/a&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Properties get applied to the resource being provisioned as configuration. Each property in these Property Sets is used to drive the outcomes of the resource that we are building.&lt;/li&gt;&#xA;&lt;li&gt;Some properties may be used to name the resource, determine the number of CPUs, or place a virtual machine in a particular cluster. Almost any aspect of the provisioned resource is capable of being influenced by these Property Sets.&lt;/li&gt;&#xA;&lt;li&gt;Template both &lt;code&gt;key:value&lt;/code&gt; of the property&lt;/li&gt;&#xA;&lt;li&gt;Call other Property Sets within the parent Property Set&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;managing-property-sets&#34;&gt;Managing Property Sets&lt;/h2&gt;&#xA;&lt;div class=&#34;alert alert-info&#34; role=&#34;alert&#34;&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://docs.cloudbolt.io/docs/onefuse/getting-started/roles-and-permissions/#workspace-roles&#34;&gt;Workspace Role&lt;/a&gt; needed to manage Property Sets: &lt;strong&gt;Admin&lt;/strong&gt; or &lt;strong&gt;Member&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;/div&gt;</description>
			</item>
			<item>
				<title>Quick reference</title>
				<link>https://docs.cloudbolt.io/docs/onefuse/templating/quick-reference/</link>
				<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
				<guid>https://docs.cloudbolt.io/docs/onefuse/templating/quick-reference/</guid>
				<description>&lt;h2 id=&#34;_all_properties&#34;&gt;&lt;code&gt;_all_properties&lt;/code&gt;&lt;/h2&gt;&#xA;&lt;p&gt;This is a Custom filter created for OneFuse to output all the Properties from the Deployment at Run Time.&lt;/p&gt;&#xA;&lt;p&gt;The primary use-case for this is to access all the Properties when using the Scripting Module to utilize meta data within the OS scripts or to populate Ansible Host Variables which can be used for playbook executions.&lt;/p&gt;&#xA;&lt;p&gt;Output rendered &lt;code&gt;templateProperties&lt;/code&gt; with: &lt;code&gt;_all_properties&lt;/code&gt; during Policy execution calls and/or Templating API.&lt;/p&gt;&#xA;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-jinja2&#34; data-lang=&#34;jinja2&#34;&gt;{#&#xA;  Example templateProperties stack:&#xA;&#xA;  {&#xA;    &amp;#34;foo&amp;#34;: &amp;#34;hello&amp;#34;,&#xA;    &amp;#34;bar&amp;#34;: &amp;#34;world&amp;#34;&#xA;  }&#xA;#}&#xA;&#xA;{# Example 1 #}&#xA;&#xA;{{ _all_properties }}&#xA;&#xA;&#xA;{# Example 2 #}&#xA;&#xA;{% for key, value in _all_properties.items() %}&#xA;  Key: {{key}}&#xA;  Value: {{value}}&#xA;{% endfor %}&#xA;&#xA;&#xA;{# Example 3#}&#xA;&#xA;{%for key in _all_properties %}&#xA;  {{key}}&#xA;{%endfor%}&#xA;&#xA;{# Example 4 #}&#xA;&#xA;{{ _all_properties.foo }}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;div class=&#34;alert alert-info&#34; role=&#34;alert&#34;&gt;&#xA;&lt;p&gt;Will not account for variables set after invocation, for example setting new variables using &lt;code&gt;{%set foo = &amp;quot;bar&amp;quot; %}&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;/div&gt;</description>
			</item>
			<item>
				<title>Expressions</title>
				<link>https://docs.cloudbolt.io/docs/onefuse/templating/expressions/</link>
				<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
				<guid>https://docs.cloudbolt.io/docs/onefuse/templating/expressions/</guid>
				<description>&lt;p&gt;Expressions get replaced with values when a template is rendered.&lt;/p&gt;&#xA;&lt;p&gt;Expressions appear inside &lt;code&gt;{{ ... }}&lt;/code&gt; tags.&lt;/p&gt;&#xA;&lt;h2 id=&#34;literals&#34;&gt;Literals&lt;/h2&gt;&#xA;&lt;p&gt;The simplest form of expressions.&lt;/p&gt;&#xA;&lt;h3 id=&#34;boolean&#34;&gt;Boolean&lt;/h3&gt;&#xA;&lt;p&gt;&lt;code&gt;true&lt;/code&gt; is always true and &lt;code&gt;false&lt;/code&gt; is always false.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-jinja2&#34; data-lang=&#34;jinja2&#34;&gt;true&#xA;false&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;dict&#34;&gt;Dict&lt;/h3&gt;&#xA;&lt;p&gt;A &lt;a href=&#34;https://www.w3schools.com/python/python_dictionaries.asp&#34;&gt;dict&lt;/a&gt; in Python is a structure that combines keys and values.&lt;/p&gt;&#xA;&lt;p&gt;Keys must be unique and always have exactly one value.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-jinja2&#34; data-lang=&#34;jinja2&#34;&gt;{&#xA;  &amp;#34;foo&amp;#34;: &amp;#34;Hello World&amp;#34;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;integers&#34;&gt;Integers&lt;/h3&gt;&#xA;&lt;p&gt;Integers are whole numbers without a decimal part.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Control structures</title>
				<link>https://docs.cloudbolt.io/docs/onefuse/templating/control-structures/</link>
				<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
				<guid>https://docs.cloudbolt.io/docs/onefuse/templating/control-structures/</guid>
				<description>&lt;p&gt;A control structure refers to all those things that control the flow: conditionals, for-loops, as well as assignments.&lt;/p&gt;&#xA;&lt;p&gt;Control structures appear inside &lt;code&gt;{% ... %}&lt;/code&gt; tags.&lt;/p&gt;&#xA;&lt;h2 id=&#34;for&#34;&gt;For&lt;/h2&gt;&#xA;&lt;p&gt;Loop over each item in a sequence.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-jinja2&#34; data-lang=&#34;jinja2&#34;&gt;{# List users provided in a variable called &amp;#39;users&amp;#39; #}&#xA;{% for user in users %}&#xA;  {{ user.username | e }}&#xA;{% else %}&#xA;  {# Optional else block if no iteration took place because sequence was empty or the filtering removed all items from the sequence. #}&#xA;  No users found.&#xA;{% endfor %}&#xA;&#xA;{#&#xA;Unlike other for loops, you cannot break or continue in a loop. Instead, use filters&#xA;#}&#xA;&#xA;{% for user in users if not user.hidden %}&#xA;  {{ user.username |e }}&#xA;{% endfor %}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;special-variables&#34;&gt;Special variables&lt;/h3&gt;&#xA;&lt;p&gt;Access special variables inside a for-loop block.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Tests</title>
				<link>https://docs.cloudbolt.io/docs/onefuse/templating/tests/</link>
				<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
				<guid>https://docs.cloudbolt.io/docs/onefuse/templating/tests/</guid>
				<description>&lt;p&gt;Tests can be used to test a variable against a common &lt;a href=&#34;https://docs.cloudbolt.io/docs/onefuse/templating/expressions/&#34;&gt;expression&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;To test a variable or expression, you add the &lt;a href=&#34;https://docs.cloudbolt.io/docs/onefuse/templating/expressions/#is&#34;&gt;is-operator&lt;/a&gt; or &lt;a href=&#34;https://docs.cloudbolt.io/docs/onefuse/templating/expressions/#not&#34;&gt;is not-operator&lt;/a&gt; plus the name of the test after the variable.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-jinja2&#34; data-lang=&#34;jinja2&#34;&gt;{{ 21 is divisibleby(3) }}&#xA;&#xA;=&amp;gt; true&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;boolean&#34;&gt;boolean&lt;/h2&gt;&#xA;&lt;p&gt;Test returns &lt;code&gt;true&lt;/code&gt; if the object is a boolean value.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-jinja2&#34; data-lang=&#34;jinja2&#34;&gt;{{ true is boolean }}&#xA;&#xA;=&amp;gt; true&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;See also: &lt;a href=&#34;#false&#34;&gt;false&lt;/a&gt;, &lt;a href=&#34;#true&#34;&gt;true&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;defined&#34;&gt;defined&lt;/h2&gt;&#xA;&lt;p&gt;Test returns &lt;code&gt;true&lt;/code&gt; if the variable is defined.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-jinja2&#34; data-lang=&#34;jinja2&#34;&gt;{{ foo is defined }}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Refer to the &lt;a href=&#34;https://docs.cloudbolt.io/docs/onefuse/templating/filters/#default&#34;&gt;default filter&lt;/a&gt;.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Filters</title>
				<link>https://docs.cloudbolt.io/docs/onefuse/templating/filters/</link>
				<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
				<guid>https://docs.cloudbolt.io/docs/onefuse/templating/filters/</guid>
				<description>&lt;p&gt;Filters appear inside &lt;code&gt;{{ ... }}&lt;/code&gt; tags and are separated from the variable by a pipe symbol (&lt;code&gt;|&lt;/code&gt;). Filters may have optional arguments in parentheses.&lt;/p&gt;&#xA;&lt;p&gt;Multiple filters can be chained; the output of one filter is applied to the next.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-jinja2&#34; data-lang=&#34;jinja2&#34;&gt;{# Example 1 #}&#xA;{% set foo = [&amp;#34;hello&amp;#34;, &amp;#34;world&amp;#34;] %}&#xA;{{ foo | first | upper }}&#xA;&#xA;&#xA;{# Example 2 #}&#xA;{# You can also apply filters on a block of template data within the filter section #}&#xA;&#xA;{% filter upper %}&#xA;hello world&#xA;{% endfilter %}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;Result:&lt;/strong&gt;&lt;/p&gt;</description>
			</item>
	</channel>
</rss>
