Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

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:...

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/www.conf 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/www.conf

  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.

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question