Lookup function examples

Let's just quickly run through the main use cases for the lookup( ) function, also showing the equivalent usages of the old hiera( ) function:

  • The following usage is a completely regular lookup:

lookup('ntp::user')
# equivalent to hiera('ntp::user')
  • The following usage is a regular lookup, while providing a default:

lookup('ntp::user','root')
# equivalent to hiera('ntp::user','root')
  • The following usage is an array lookup:

lookup('my_ntp_servers', Array, 'unique')
# equivalent to hiera_array('ntp_servers')
  • The following is a deep-merge lookup:

lookup('users', Hash, 'deep')
# equivalent to hiera_hash('users') with deep
  • The following is a classification lookup:

lookup('classes', Array[String], 'unique').include
# equivalent to hiera_include('classes')
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.15.161