key with everyone? (assuming no one ever leaves on bad terms, get their laptop stolen, chmod 777 their key, sell their computer without cleaning the HDD, etc)
NBTZfOlPvMlAesyr4bUY4I5XeVbVk38XKxeriH69EFAD4CahIZlC8lkE/uDh! jJGQfh052eonkungHIcuGKY/5sEbbZl/qufjAtp/ufor15VBJtsXt17tXP4y! l5ZP119Fwq8xiREGOL0lVvFYJz2hZc1ppPCNG5lwuLnTekXN/OazNYpf4CMd! /HjZFXwcXRtTlzewJLc+/gox2IfByQRhsI/AgogRfYQKocZgFb/DOZoXR7wm! IZGeunzwhqfmEtGiqpvJJQ5wVRdzJVpTnANBA5qxeA==]! ! ---! plain-property: You can see me! ! encrypted-property: >! DEC(1)::PKCS7[You can't see me]!! ! Only encrypts the variables you need to hide And decrypt them when you actually need them eyaml encrypt -s ‘string’ to encrypt a string, -f for a file, etc. More on their github page
the first slides, there is still a lot of information that gets typed several times. My example has only 3 groups, but what if you have 25 across 600 hosts? Do you type them all every time? Or do you merge them?
--- dev.yaml sudoers: - dev - test ! --- test.yaml sudoers: - test ! --- nodes/snowflake.yaml sudoers: - dev - jim We didn’t put prod because it should be matched by common.
doing wrong? For starters, it’s called a hierarchy for a reason: First match (the file on top) takes all! ! The other bad thing is it won’t merge by default :(
as a catch-all when using the default implementation. You put them last so they apply if nothing else does! ! How do I apply variables across different files though?
== ['dev', 'test','ops'] hiera_array will parse all files that match your host following the hierarchy. A dev host will match both dev.yaml and common.yaml, and flatten the text and array values in a single array
- test! gateway: 192.168.0.12! --- common.yaml! config:! sudoers: ! - ops! Similarly hiera_hash will parse all the files that match and merge the multiple hashes into a single one.
- 'nodes/%{hostname}'! - '%{environment}'! :merge_behavior:! - deeper You need to change the merge behaviour in your hiera configuration. ! This require the “deep_merge” gem to be present on the system.
! config:! sudoers: ! ! - ops sudoers == [dev, test, ops] if an array exist in more than a hash, they’re flattened and the result goes in the final hash. Additionally, hashes are merged recursively but I was too lazy to write up an exemple.