configi.old
configi.old copied to clipboard
getting started guide
I'd love to start playing with configi, noticed there isn't an obvious tutorial, introduction or getting-started-guide on http://configi.org
I think it would be great to at least say how to run http://configi.org/#example-policy
I expect most folks would also want a little more guidance than http://configi.org/modules/modules/template.html has.
I'd love to throw together a doc showing a standard "deployment" pattern:
- install package
- template a config
- start a service
- add a crontab
and "user" pattern:
- add group
- add users
- set ssh keys
- set passwords
- manage sudoers file
Does that sound useful?
👍
Hello!
Indeed it's going to be useful. Just ask here if you have questions or if you encounter any problems.
Thank you very much.
Is a simple make supposed to generate the compiled cfg-agent? I'm seeing a bin/cfg-agent.lua, but not the compiled form.
Change the DEFAULT_GOAL in the top-level Makefile to release. That should compile the executable.
Hmm, where's the best place to document that for regular users? A README? The download page?
The DEFAULT_GOAL was/should be release. I held off too long for 2.0.0. I will change that now.
... and done.
awesome, on to the next!
so I thought I'd see what happened when I ran the example policy on my ubuntu box:
file.directory"/tmp/dir"{
comment = "Create directory if running on Gentoo",
context = fact.osfamily.gentoo,
mode = 0700,
notify = "touch"
}
yum.present"mtr"{
context = fact.osfamily.centos
}
file.absent"/tmp/dir"{
notify = "touch"
}
file.touch"/tmp/dir"{
comment = "Handle 'touch' notifications. This is only executed once.",
handle = "touch"
}
And I'm seeing:
$ cfg-agent -f policy.lua
[string "file.directory"/tmp/dir"{..."]:3: attempt to index a function value (field 'osfamily')
stack traceback:
[string "file.directory"/tmp/dir"{..."]:3: in main chunk
(...tail calls...)
[string "cfg-core.cli"]:136: in function 'cfg-core.cli.main'
[string "cfg-core.cli"]:285: in function 'cfg-core.cli.opt'
[string "bin.cfg-agent"]:22: in local 'func'
[string "cfg-agent"]:36: in main chunk
My lua is a bit rusty, do I need to explicitly call the fact function? Am I supposed to set fact myself?
Also, it appears http://configi.org/reference/factid/ will need some love after I'm done here ;-)
ah, $ cfg-agent -F -f policy.lua!
one thing I'm noticing: occasionally I get what appear to be complete hangs. With -v, I get as far as Applying policy: cfg/policy.lua and then nothing. Not seeing any logging or process death with a SIGTERM.
pstree seems to indicate sadness coming from dpkg-preconfigure:
$ pstree 24594
cfg-agent───apt-get───sh───dpkg-preconfigu─┬─dpkg-preconfigu
├─postfix.config.
└─whiptail
Sadly, I haven't tested in Ubuntu/Debian recently.
I'll fire up a Debian container for testing.
no worries, it seems to be from the mutt package.
BTW, I've been looking around at other curricula and I'm going to start with a straightforward port of https://learn.chef.io/tracks/infrastructure-automation.
I'm also considering making this happen inside a docker container, so if there's a platform you're most comfortable with, I can just use that.
Sound good.
About needing to pass -F. There's a bug that's requiring the factid module when it shouldn't be. I'll look into that.