hostinfo:
‘host001’:
ip: 192.168.43.10
hostclass: ‘puppet’
‘host002’:
ip: 192.168.43.11
hostclass: ‘ess’
‘host003’:
ip: 192.168.43.21
hostclass: ‘mdb’
‘host004’:
ip: 192.168.43.22
hostclass: ‘ess’
‘host005’:
ip: 192.168.43.31
hostclass: ‘mdbconf’
‘host006’:
ip: 192.168.43.32
hostclass: ‘mdbconf’
‘host007’:
ip: 192.168.43.41
hostclass: ‘ess’
‘host008’:
ip: 192.168.43.42
hostclass: ‘ess’
‘host009’:
ip: 192.168.43.51
hostclass: ‘essmas’
‘host010’:
ip: 192.168.43.52
hostclass: ‘essmas’
1) Given the above Hash existing in Hiera, write puppet code to return only the hostnames of the entries that are in the ‘ess’ hostclass.
Bonus Guru Question: Write in Ruby a Custom Puppet Function that does the same thing as above, except the hostclass to be searched for is passed as an argument.
2) Given an Array variable with hosts from #1 and using Puppet code how would you change each element in the array to look like: http://<hostname>:8080
3) Write a quick module that accomplishes the following tasks.
a) Installs Apache2
b) Creates the file /etc/apache2/apache2.conf using a template (the contents of the template doesn’t matter)
c) Creates the file /etc/apache2/site-available/ from a file in the module (the contents of the file doesn’t matter)
d) Links the file in c) to /etc/apache2/site-enabled/ e) Restarts apache if any of these files changes.
4) Given a hostname pattern of ‘host-<company>-<hostclass>-<index>’ (i.e. host-apple-puppet-0) write a custom fact that extracts the <company> value and assigns it to the variable ‘company’ in facter.
Select your paper details and see how much our professional writing services will cost.
Our custom human-written papers from top essay writers are always free from plagiarism.
Your data and payment info stay secured every time you get our help from an essay writer.
Your money is safe with us. If your plans change, you can get it sent back to your card.
We offer more than just hand-crafted papers customized for you. Here are more of our greatest perks.
Get instant answers to the questions that students ask most often.
See full FAQ