Difference between revisions of "Hierahandson"
From Gridkaschool
(Created page with "This is our hiera hierarchy: :hierarchy: environments/%{::environment}/hieradata/%{::certname} environments/%{::environment}/hieradata/%{::role} environments/%{::envi…") |
|||
(5 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
This is our hiera hierarchy: |
This is our hiera hierarchy: |
||
− | :hierarchy: |
||
environments/%{::environment}/hieradata/%{::certname} |
environments/%{::environment}/hieradata/%{::certname} |
||
environments/%{::environment}/hieradata/%{::role} |
environments/%{::environment}/hieradata/%{::role} |
||
Line 6: | Line 5: | ||
environments/%{::environment}/hieradata/common |
environments/%{::environment}/hieradata/common |
||
hieradata/common |
hieradata/common |
||
+ | # Merge the master branch in git, and include the "lab" module. It's trivial, as it just creates /etc/labpurpose |
||
− | # Enhance the apache module with hiera |
||
− | ## In the root of your environment, "mkdir hieradata" |
+ | ## In the root of your environment in git, at the same level as "modules" and "manifests" "mkdir hieradata" |
## cd hieradata |
## cd hieradata |
||
+ | ## touch <schoolmachine>.desy.de.yaml where <schoolmachine> is your puppet client machine (ie gridkaschool01.desy.de) |
||
− | ## touch $(hostname).desy.de.yaml |
||
## touch web.yaml data.yaml compute.yaml |
## touch web.yaml data.yaml compute.yaml |
||
## touch RedHat.yaml |
## touch RedHat.yaml |
||
## touch common.yaml |
## touch common.yaml |
||
− | ## convert |
+ | ## convert the param to the lab class to an automatic hiera call |
+ | ### use "common".yaml for now |
||
− | ### you will need to define the key in one of the yaml files that will apply to your machine. Note that only one of web/data/compute will apply to you! You can add different values to different parts of the hierarchy and see which apply |
||
− | ## convert the direct |
+ | ## convert the direct hiera() calls to automatic lookups, with a new param. Remember that if a class is called "foo" and it has a parameter "$bar" then you need a hiera key foo::bar |
+ | # In your environment, using at least 2 of the fqdn / role or osfamily yaml files you've created, add different values and see how they get used / override values in other parts of the hierarchy |
||
− | # In your environment, using |
||
+ | Bonus: |
||
+ | # Try using hiera_include to include a class |
Latest revision as of 11:08, 9 September 2015
This is our hiera hierarchy:
environments/%{::environment}/hieradata/%{::certname} environments/%{::environment}/hieradata/%{::role} environments/%{::environment}/hieradata/%{::osfamily} environments/%{::environment}/hieradata/common hieradata/common
- Merge the master branch in git, and include the "lab" module. It's trivial, as it just creates /etc/labpurpose
- In the root of your environment in git, at the same level as "modules" and "manifests" "mkdir hieradata"
- cd hieradata
- touch <schoolmachine>.desy.de.yaml where <schoolmachine> is your puppet client machine (ie gridkaschool01.desy.de)
- touch web.yaml data.yaml compute.yaml
- touch RedHat.yaml
- touch common.yaml
- convert the param to the lab class to an automatic hiera call
- use "common".yaml for now
- convert the direct hiera() calls to automatic lookups, with a new param. Remember that if a class is called "foo" and it has a parameter "$bar" then you need a hiera key foo::bar
- In your environment, using at least 2 of the fqdn / role or osfamily yaml files you've created, add different values and see how they get used / override values in other parts of the hierarchy
Bonus:
- Try using hiera_include to include a class