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')