Skip to content

Commit 01cb0a0

Browse files
Update Puppet_Intro_Installation.txt
1 parent 2aea02f commit 01cb0a0

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

Puppet_Intro_Installation.txt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,41 @@ node default {
215215
class { addusers:}
216216
}
217217
--------------
218+
Facts
219+
node default
218220

221+
{
222+
$message=$facts['os']['family'] ? {
223+
'RedHat'=> 'running redhat',
224+
default=> 'running somewhere',
225+
}
226+
notify { $message: }
227+
}
228+
229+
------
230+
mkdir -p /etc/facter/facts.d
231+
cd /etc/facter/facts.d/
232+
create file customfact.txt and add content
233+
customfact="hello world"
234+
235+
Now run following command
236+
---------
237+
Templates
238+
#Create file test.epp
239+
240+
<% | String $text, Boolean $bool | -%>
241+
Text value <%= $text %>
242+
243+
<% if $bool { -%>
244+
Bool has true value
245+
<% } -%>
246+
247+
To validate the syntax
248+
puppet epp validate test.epp
249+
To run the template
250+
puppet epp render test.epp --values '{ text => "Hello world", bool => true }'
251+
252+
facter customfact
219253

220254
Modules:-
221255
it is the collection of manifest with data( such as facts files and templates) and they have a specific directory structure. Modules are useful to organize puppet code because they allow you to split the code in multiple manifests.It is considered to be best practice to use modules to organize manifests.

0 commit comments

Comments
 (0)