Question on organization #5872
-
I'm working on migrating our configuration management from puppet over to Cfengine and I would like to do this piecemeal. My first target is our development mysql installation, so I went ahead and got all of my mysql daemon-related code into a single file called Now I want to move onto the next chunk of code (our node server) and I'm at a loss of how to organize it. I wanted to organize things into files grouped by service (e.g. node, mysql, java) to make it more straightforward to use docker containers (e.g. the MySQL container just runs We don't use docker containers now, but I want the configuration code for Docker containers to be the same as the configuration code for our bare metal AWS+development instances (or as close to the same as possible...). It will (hopefully) make migration that much smoother in the long run, and means I don't have to rewrite configuration again to get Docker working for local development. I can invoke Cfengine multiple times from a Makefile for each service to setup on the bare metal instances, and only the relevant service in my Docker containers, but it seems like there should be a way to do this in Cfengine? I played around with a Any thoughts? Any resources I should look into? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
Hi Brian! Welcome!
Yes, CFEngine is blazing fast.
services/main.cf is the suggested place to put your custom policies
That’s in the masterfiles policy framework (MPF) which ships with CFEngine.
You don’t HAVE to use it but it provides a lot of nice things.
See
https://docs.cfengine.com/docs/3.26/reference-masterfiles-policy-framework-services-main.html
You can use inputs to pull in multiple files under services, e.g., services/
mysqld.cf
Hope this helps! Let us know how it goes.
Best,
Aleksey
…On Fri, Aug 29, 2025 at 2:50 PM Brian Bauman ***@***.***> wrote:
I'm working on migrating our configuration management from puppet over to
Cfengine and I would like to do this piecemeal. My first target is our
development mysql installation, so I went ahead and got all of my mysql
daemon-related code into a single file called mysqld.cf. Inside that file
I have a body common control block that defines the bundlesequence and
everything is running as expected (boy howdy is it fast!).
Now I want to move onto the next chunk of code (our node server) and I'm
at a loss of how to organize it. I wanted to organize things into files
grouped by service (e.g. node, mysql, java) to make it more straightforward
to use docker containers (e.g. the MySQL container just runs mysqld.cf,
the node container just runs node.cf, etc).
We don't use docker containers now, but I want the configuration code for
Docker containers to be the same as the configuration code for our bare
metal AWS+development instances (or as close to the same as possible...).
It will (hopefully) make migration that much smoother in the long run, and
means I don't have to rewrite configuration again to get Docker working for
local development.
I can invoke Cfengine multiple times from a Makefile for each service to
setup on the bare metal instances, and only the relevant service in my
Docker containers, but it seems like there should be a way to do this in
Cfengine? I played around with a control.cf file that defined the
bundlesequence as a variable, then override that variable in a __main__
bundle in each service file, but I couldn't get that working...
Any thoughts? Any resources I should look into?
—
Reply to this email directly, view it on GitHub
<#5872>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAD4GIDXURBFHKKG5QP2S6T3QCVJ5AVCNFSM6AAAAACFFOOAEGVHI2DSMVQWIX3LMV43ERDJONRXK43TNFXW4OZYHAYTMMRWGE>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Organizing things is a bit like opinions, everyone has their own, and generally CFEngine doesn't try to make many prescriptions about that. I would encourage you to checkout build.cfengine.com and consider managing your policy set with the cfbs tooling. Let us know how you progress, reach out for help here, on the mailing list, and or on matrix. |
Beta Was this translation helpful? Give feedback.
-
Yes like Nick said build it round `cfbs` then you are the most flexible.
You can easily add services, modules and promise types.
Maybe this can be inspiration for you. It is all installable via `cfbs`:
* https://build.cfengine.com/modules/surf-cfengine-library/
* https://build.cfengine.com/modules/promise-type-docker-compose/
There are many more that are useful and easy to install.
Have fun
…On 29/08/2025 23:43, Nick Anderson wrote:
Organizing things is a bit like opinions, everyone has their own, and
generally CFEngine doesn't try to make many prescriptions about that.
I would encourage you to checkout build.cfengine.com and consider
managing your policy set with the cfbs tooling. Let us know how you
progress, reach out for help here, on the mailing list, and or on matrix.
—
Reply to this email directly, view it on GitHub <https://github.com/
cfengine/core#5872#discussioncomment-14259779>, or
unsubscribe <https://github.com/notifications/unsubscribe-auth/
AADJKB2DSRQD4DWJWZQ7DZ33QDCQDAVCNFSM6AAAAACFFOOAEGVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTIMRVHE3TOOI>.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
--
--
Bas van der Vlies
| High Performance Computing & Visualization | SURF| Science Park 140
| 1098 XG Amsterdam | T +31 (0) 20 800 1300 | ***@***.***
| www.surf.nl
|
Beta Was this translation helpful? Give feedback.
-
Thanks everyone, I wish I could mark more than one comment as an answer. I think the main lesson I am taking from this is that a sequence of events can be an anti-pattern in the context of a declarative language. While
To some extent, every language is opinionated. When it takes 100 lines to replace 5 lines of shell scripting, it seems like a good indication that you are going against the grain of what the authors had in mind. That being said:
For now, I've created a bundle that runs the other bundles I've made with explicit handles + depends_on, then refactored that into its own bundle with a note to avoid doing the same in the future. It ain't pretty, but it works:
Which gets called as:
We'll see how the code matures after moving more parts of our system off of puppet into cfengine. Thanks again! |
Beta Was this translation helpful? Give feedback.
Organizing things is a bit like opinions, everyone has their own, and generally CFEngine doesn't try to make many prescriptions about that.
I would encourage you to checkout build.cfengine.com and consider managing your policy set with the cfbs tooling. Let us know how you progress, reach out for help here, on the mailing list, and or on matrix.