Quoting Luke Kanies <[EMAIL PROTECTED]>:
So, I tried to see what the simplest example configuration would look
like in this tool, vs. Puppet. I pretty much always use sudo for my
examples, because it's simple to centralize and an important tool.
Here's the simplified configuration in Puppet-speak:
class sudo {
package { sudo: ensure => installed }
file { "/etc/sudoers": mode => 440,
owner => root,
group => root,
source => "puppet://server/apps/sudo/sudoers"
}
}
node phage {
include sudo
}
Here's the closest I could come to that in mcfg:
aspect "sudo" {
# The file
sudoers.path = "/etc/sudoers";
sudoers.type = "file";
sudoers.mode = "440";
sudoers.owner = "root";
sudoers.group = "root";
sudoers.source = "puppet://server/apps/sudo/sudoers";
# The package
sudo_package.title = "sudo";
sudo_package.type = "package";
}
node "phage" inherits sudo { }
Am I doing this right? Is there a better way to do this?
How about this:
# This aspect encapsulates having sudo on a machine
aspect "sudo" {
# The file
files.sudoers.path = "/etc/sudoers";
files.sudoers.mode = "440";
files.sudoers.owner = "root";
files.sudoers.group = "root";
files.sudoers.source = "puppet://server/apps/sudo/sudoers";
# The package
packages =+ "sudo";
}
node "phage" inherits "sudo" { }
Using this tool to configure Puppet would require that every resource
specify a type.
You could do this using the top level maps, like I have here, or
perhaps some other way. It's important to note that mcfg doesn't
ascribe any meaning to maps intrinsically, so to a large extent, how
neat the example is depends on how your tool can use it...
I'm going to try to write a script to convert the output of this
program into the YAML that Puppet currently expects, which I don't
expect to be too difficult, and then perform the normal work from
there. In the meantime, I have some questions:
How would I handle running this on FreeBSD, where the group is
"wheel" instead of "root"? Create another aspect and reassign that
value? Is it possible to create a variable like 'rootgroup'
somewhere, and then just use that, so I don't have to create a new
aspect for every single instance of the root group?
Definitely, you could do something like this:
aspect FreeBSD {
root_group = "wheel";
}
aspect Linux {
root_group = "root";
}
...
aspect sudo {
files.sudoers.group = $root_group;
}
If I want to inject information in (e.g., Puppet's Facts, or BCFG2's
probes), would I have to generate a file, or is there another way?
At the moment, you'd have to generate mcfg source. That said, it's a
small change that I'm happy to undertake to add in the next few days to
let it read a bunch of resources from the "standard" format, and use
those instead. It didn't do this initially for the sake of simplicity,
but I have libraries and stuff developed by now that make this a fairly
easy step.
Is there any support for any kind of conditional beyond creating new
aspects? E.g., Puppet supports a trinary-operator-like conditional:
$group = $operatingsystem ? { freebsd => wheel, default => root }
This makes it easy to choose appropriate values.
I'll let you know when I successfully hook this into Puppet.
There's no conditional operator, so you would have to use aspect
inheritance. The short reason is that mcfg is a minimal tool, and I
added as little as possible to make something workable, yet still
interesting. So this example becomes exactly the same as the aspect
inheritance outlined above.
Hope this helps.
Ed
_______________________________________________
lssconf-discuss mailing list
lssconf-discuss@inf.ed.ac.uk
http://lists.inf.ed.ac.uk/mailman/listinfo/lssconf-discuss