A little policy to render mustache templated cfengine module scripts #5305
craigcomstock
started this conversation in
Show and tell
Replies: 1 comment 1 reply
-
Nice, I like it. Perhaps it should be elevated to a build module? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In CFEngine we have a feature of module scripts/executables that can be used to gather information and return it via classes/vars to the policy engine.
https://docs.cfengine.com/docs/3.21/reference-language-concepts-modules.html
I was thinking it would be nice if some of these module scripts could be mustache templates.
For this example I created a modules/custom directory under the root of my masterfiles directory.
def.json
custom_modules.cf
Typically you want to avoid using datastate(). Better would be to inject a small set of necessary information that you need.
modules/custom/one
modules/custom/two.mustache
output when running cf-agent -KIf update.cf
(in this case I am using alpine linux and their standard cfengine community packages so we have
/var/lib/cfengine
assys.workdir
instead of our typical/var/cfengine
)And in
/var/lib/cfengine/modules/custom/two
we haveNo mention of the module script
one
since I am only doing findfiles for *.mustache.That
one
script is copied over though due to it's location in the modules directory.Beta Was this translation helpful? Give feedback.
All reactions