|
Home | Switchboard | Unix Administration | Red Hat | TCP/IP Networks | Neoliberalism | Toxic Managers |
(slightly skeptical) Educational society promoting "Back to basics" movement against IT overcomplexity and bastardization of classic Unix |
After installation you need to populate your repository. It is very dependent on your local configuration, your configuration management goals, the politics surrounding your particular machines, and many other similar details. We can, however, give you guidance.
After the above steps, you should have a toplevel repository structure that looks like:
bcfg-server:~ # ls /var/lib/bcfg2 Base/ Bundler/ Cfg/ Metadata/ Pkgmgr/ Rules/ SSHbase/ etc/
The place to start is the Metadata directory, which contains two files: clients.xml and groups.xml. Your current clients.xml will look pretty close to:
<Clients> <Client profile="basic" pingable="Y" pingtime="0" name="bcfg-server.example.com"/> </Clients>
The clients.xml file is just a series of <Client /> tags, each of which describe one host you manage. Right now we only manage one host, the server machine we just created. This machine is bound to the basic profile, is pingable, has a pingtime of 0, and has the name bcfg-server.example.com. The two “ping” parameters don’t matter to us at the moment, but the other two do. The name parameter is the fully qualified domain name of your host, and the profile parameter maps that host into the groups.xml file.
Our simple groups.xml file looks like:
<Groups> <Group profile='true' public='false' name='basic'> <Group name='suse'/> </Group> <Group name='ubuntu' /> <Group name='debian' /> <Group name='redhat' /> <Group name='suse' /> <Group name='mandrake' /> <Group name='solaris' /> </Groups>
There are two types of groups in Bcfg: profile groups (profile='true') and non-profile groups (profile='false'). Profile groups can act as top-level groups to which clients can bind, while non-profile groups only exist as members of other groups. In our simple starter case, we have a profile group named basic, and that is the group that our first client bound to. Our first client is a SuSE machine, so it contains the suse group. Of course, bcfg2-admin isn’t smart enough to fill out the rest of your config, so the suse group further down is empty.
Let’s say the first thing we want to set up on our machine is the message of the day. To do this, we simply need to create a Bundle and add that Bundle to an appropriate group. In this simple example, we start out by adding
<Bundle name='motd'/>
to the basic group.
Next, we create a motd.xml file in the Bundler directory:
<Bundle name='motd'> <Path name='/etc/motd' /> </Bundle>
Now when we run the client, we get slightly different output:
Loaded tool drivers: Chkconfig POSIX YUM Incomplete information for entry Path:/etc/motd; cannot verify Phase: initial Correct entries: 0 Incorrect entries: 1 Total managed entries: 1 Unmanaged entries: 242 In dryrun mode: suppressing entry installation for: Path:/etc/motd Phase: final Correct entries: 0 Incorrect entries: 1 Total managed entries: 1 Unmanaged entries: 242
We now have an extra unmanaged entry, bringing our total number of managed entries up to one. To manage it we need to copy /etc/motd to /var/lib/bcfg2/Cfg/etc/motd/. Note the layout of that path: all plain-text config files live in the Cfg directory. The directory structure under that directory directly mimics your real filesystem layout, making it easy to find and add new files. The last directory is the name of the file itself, so in this case the full path to the motd file would be /var/lib/bcfg2/Cfg/etc/motd/motd. Copy your real /etc/motd file to that location, run the client again, and you will find that we now have a correct entry:
Loaded tool drivers: Chkconfig POSIX YUM Phase: initial Correct entries: 1 Incorrect entries: 0 Total managed entries: 1 Unmanaged entries: 242 Phase: final Correct entries: 1 Incorrect entries: 0 Total managed entries: 1 Unmanaged entries: 242
Done! Now we just have 242 (or more) entries to take care of!
Bundler is a relatively easy directory to populate. You can find many samples of Bundles in the Bundler Example Repository, many of which can be used without editing.
Several other utilities can help from this point on:
bcfg2-info is a utility that instantiates a copy of the Bcfg2 server core (minus the networking code) for examination. From this, you can directly query:
Run bcfg2-info, and type help and the prompt when it comes up.
bcfg2-admin can perform a variety of repository maintenance tasks. Run bcfg2-admin help for details.
Once you have the server setup, you may be interested in bootstrapping additional clients.
Bundler is used to describe groups of inter-dependent configuration entries, such as the combination of packages, configuration files, and service activations that comprise typical Unix daemons. Bundles are used to add groups of configuration entries to the inventory of client configurations, as opposed to describing particular versions of those entries. For example, a bundle could say that the configuration file /etc/passwd should be included in a configuration, but will not describe the particular version of /etc/passwd that a given client will receive.
Group and Client tags can be used inside of bundles to differentiate which entries particular clients will recieve; this is useful for the case where entries are named differently across systems; for example, one linux distro may have a package called openssh while another uses the name ssh. Configuration entries nested inside of Group elements only apply to clients who are a member of those groups; multiple nested groups must all apply. Also, groups may be negated; entries included in such groups will only apply to clients who are not a member of said group. The same applies to Client elements.
The following is an annotated copy of a bundle:
<Bundle name='ssh' version='2.0'> <Path name='/etc/ssh/ssh_host_dsa_key'/> <Path name='/etc/ssh/ssh_host_rsa_key'/> <Path name='/etc/ssh/ssh_host_dsa_key.pub'/> <Path name='/etc/ssh/ssh_host_rsa_key.pub'/> <Path name='/etc/ssh/ssh_host_key'/> <Path name='/etc/ssh/ssh_host_key.pub'/> <Path name='/etc/ssh/sshd_config'/> <Path name='/etc/ssh/ssh_config'/> <Path name='/etc/ssh/ssh_known_hosts'/> <Group name='rpm'> <Package name='openssh'/> <Package name='openssh-askpass'/> <Service name='sshd'/> <Group name='fedora' > <Group name='fc14' negate='true'> <Package name='openssh-clients'/> </Group> <Package name='openssh-server'/> </Group> </Group> <Group name='deb'> <Package name='ssh'/> <Service name='ssh'/> </Group> <Client name='trust.example.com'> <Path name='/etc/ssh/shosts.equiv'/> </Client> </Bundle>
In this bundle, most of the entries are common to all systems. Clients in group deb get one extra package and service, while clients in group rpm get two extra packages and an extra service. In addition, clients in group fedora and group rpm get one extra package entries, unless they are not in the fc14 group, in which case, they get an extra package. The client trust.example.com gets one extra file that is not distributed to any other clients. Notice that this file doesn’t describe which versions of these entries that clients should get, only that they should get them. (Admittedly, this example is slightly contrived, but demonstrates how group entries can be used in bundles)
Group/Hostname | Entry |
---|---|
all | /etc/ssh/ssh_host_dsa_key |
all | /etc/ssh/ssh_host_rsa_key |
all | /etc/ssh/ssh_host_dsa_key.pub |
all | /etc/ssh/ssh_host_rsa_key.pub |
all | /etc/ssh/ssh_host_key |
all | /etc/ssh/ssh_host_key.pub |
all | /etc/ssh/sshd_config |
all | /etc/ssh/ssh_config |
all | /etc/ssh/ssh_known_hosts |
rpm | Package openssh |
rpm | Package openssh-askpass |
rpm | Service sshd |
rpm and fedora | Package openssh-server |
rpm and fedora and not fc4 | Package openssh-clients |
deb | Package ssh |
deb | Service ssh |
trust.example.com | /etc/ssh/shosts.equiv |
Genshi XML templates allow you to use the Genshi templating system to dynamically generate a bundle. Genshi templates can be specified one of two ways:
The top-level Bundle tag should look like the following:
<Bundle name="foo" xmlns:py="http://genshi.edgewall.org/">
Several variables are pre-defined inside templates:
Name | Description |
---|---|
metadata | Client metadata |
repo | The path to the Bcfg2 repository on the filesystem |
Note
<Group> and <Client> tags are allowed inside of Genshi templates as of Bcfg2 1.2. However, they do not behave the same as using a Genshi conditional, e.g.:
<py:if test="'groupname' in metadata.groups"> </py:if>
The conditional is evaluated when the template is rendered, so code inside the conditional is not executed if the conditional fails. A <Group> tag is evaluated after the template is rendered, so code inside the tag is always executed. This is an important distinction: if you have code that will fail on some groups, you must use a Genshi conditional, not a <Group> tag. The same caveats apply to <Client> tags.
See also the Genshi XML Template Reference.
To render a bundle for a given client, you can run:
bcfg2-info buildbundle <bundle name> <hostname>
This will render the template; it will not fully bind all of the entries in the bundle.
See bcfg2-info for more details.
In some cases, configuration files need to include the client’s hostname in their name. The following template produces such a config file entry.
<Bundle name='foo' xmlns:py="http://genshi.edgewall.org/"> <Path name='/etc/package-${metadata.hostname}'/> </Bundle>
Depending on the circumstance, these configuration files can either be handled by individual entries in Cfg, or can be mapped to a single entry by using the altsrc feature.
In this example, configuration file names are built using probed results from the client. getmac is a probe that gathers client MAC addresses and returns them in a newline delimited string.
<Bundle name="networkinterfaces" xmlns:py="http://genshi.edgewall.org/"> <?python files = metadata.Probes["getmacs"].split("\n") ?> <Path py:for="file in files" name="/etc/sysconfig/network/ifcfg-eth-${file}" altsrc="/etc/ifcfg-template"/> </Bundle>
Note
If you want a file to be only on a per-client basis, you can use an if declaration.
<Bundle name='bacula' xmlns:py="http://genshi.edgewall.org/"> <Path name="/etc/bacula/bconsole.conf"/> <Path name="/etc/bacula/bacula-fd.conf"/> <Path name="/etc/bacula/bacula-sd.conf"/> <Path py:if="metadata.hostname == 'foo.bar.com'" name="/etc/bacula/bacula-dir.conf"/> </Bundle>
or alternately
<Bundle name='bacula' xmlns:py="http://genshi.edgewall.org/"> <Path name="/etc/bacula/bconsole.conf"/> <Path name="/etc/bacula/bacula-fd.conf"/> <Path name="/etc/bacula/bacula-sd.conf"/> <py:if="metadata.hostname == 'foo.bar.com'"> <Path name="/etc/bacula/bacula-dir.conf"/> </py:if> </Bundle>
or yet another way
<Bundle name='bacula' xmlns:py="http://genshi.edgewall.org/"> <Path name="/etc/bacula/bconsole.conf"/> <Path name="/etc/bacula/bacula-fd.conf"/> <Path name="/etc/bacula/bacula-sd.conf"/> <Client name="foo.bar.com"> <Path name="/etc/bacula/bacula-dir.conf"/> </Client> </Bundle>
The final form is preferred if there is no code inside the block that would fail on other clients.
While these examples are simple, the test in the if block can in fact be any python statement.
Some simple examples of Bundles can be found in the Bcfg2 example repository.
In addition to the example repository, the following is a list of some more complex example Bundles.
Google matched content |
https://en.wikipedia.org/wiki/Bcfg2
http://bcfg2.org/ -- official website
Society
Groupthink : Two Party System as Polyarchy : Corruption of Regulators : Bureaucracies : Understanding Micromanagers and Control Freaks : Toxic Managers : Harvard Mafia : Diplomatic Communication : Surviving a Bad Performance Review : Insufficient Retirement Funds as Immanent Problem of Neoliberal Regime : PseudoScience : Who Rules America : Neoliberalism : The Iron Law of Oligarchy : Libertarian Philosophy
Quotes
War and Peace : Skeptical Finance : John Kenneth Galbraith :Talleyrand : Oscar Wilde : Otto Von Bismarck : Keynes : George Carlin : Skeptics : Propaganda : SE quotes : Language Design and Programming Quotes : Random IT-related quotes : Somerset Maugham : Marcus Aurelius : Kurt Vonnegut : Eric Hoffer : Winston Churchill : Napoleon Bonaparte : Ambrose Bierce : Bernard Shaw : Mark Twain Quotes
Bulletin:
Vol 25, No.12 (December, 2013) Rational Fools vs. Efficient Crooks The efficient markets hypothesis : Political Skeptic Bulletin, 2013 : Unemployment Bulletin, 2010 : Vol 23, No.10 (October, 2011) An observation about corporate security departments : Slightly Skeptical Euromaydan Chronicles, June 2014 : Greenspan legacy bulletin, 2008 : Vol 25, No.10 (October, 2013) Cryptolocker Trojan (Win32/Crilock.A) : Vol 25, No.08 (August, 2013) Cloud providers as intelligence collection hubs : Financial Humor Bulletin, 2010 : Inequality Bulletin, 2009 : Financial Humor Bulletin, 2008 : Copyleft Problems Bulletin, 2004 : Financial Humor Bulletin, 2011 : Energy Bulletin, 2010 : Malware Protection Bulletin, 2010 : Vol 26, No.1 (January, 2013) Object-Oriented Cult : Political Skeptic Bulletin, 2011 : Vol 23, No.11 (November, 2011) Softpanorama classification of sysadmin horror stories : Vol 25, No.05 (May, 2013) Corporate bullshit as a communication method : Vol 25, No.06 (June, 2013) A Note on the Relationship of Brooks Law and Conway Law
History:
Fifty glorious years (1950-2000): the triumph of the US computer engineering : Donald Knuth : TAoCP and its Influence of Computer Science : Richard Stallman : Linus Torvalds : Larry Wall : John K. Ousterhout : CTSS : Multix OS Unix History : Unix shell history : VI editor : History of pipes concept : Solaris : MS DOS : Programming Languages History : PL/1 : Simula 67 : C : History of GCC development : Scripting Languages : Perl history : OS History : Mail : DNS : SSH : CPU Instruction Sets : SPARC systems 1987-2006 : Norton Commander : Norton Utilities : Norton Ghost : Frontpage history : Malware Defense History : GNU Screen : OSS early history
Classic books:
The Peter Principle : Parkinson Law : 1984 : The Mythical Man-Month : How to Solve It by George Polya : The Art of Computer Programming : The Elements of Programming Style : The Unix Hater’s Handbook : The Jargon file : The True Believer : Programming Pearls : The Good Soldier Svejk : The Power Elite
Most popular humor pages:
Manifest of the Softpanorama IT Slacker Society : Ten Commandments of the IT Slackers Society : Computer Humor Collection : BSD Logo Story : The Cuckoo's Egg : IT Slang : C++ Humor : ARE YOU A BBS ADDICT? : The Perl Purity Test : Object oriented programmers of all nations : Financial Humor : Financial Humor Bulletin, 2008 : Financial Humor Bulletin, 2010 : The Most Comprehensive Collection of Editor-related Humor : Programming Language Humor : Goldman Sachs related humor : Greenspan humor : C Humor : Scripting Humor : Real Programmers Humor : Web Humor : GPL-related Humor : OFM Humor : Politically Incorrect Humor : IDS Humor : "Linux Sucks" Humor : Russian Musical Humor : Best Russian Programmer Humor : Microsoft plans to buy Catholic Church : Richard Stallman Related Humor : Admin Humor : Perl-related Humor : Linus Torvalds Related humor : PseudoScience Related Humor : Networking Humor : Shell Humor : Financial Humor Bulletin, 2011 : Financial Humor Bulletin, 2012 : Financial Humor Bulletin, 2013 : Java Humor : Software Engineering Humor : Sun Solaris Related Humor : Education Humor : IBM Humor : Assembler-related Humor : VIM Humor : Computer Viruses Humor : Bright tomorrow is rescheduled to a day after tomorrow : Classic Computer Humor
The Last but not Least Technology is dominated by two types of people: those who understand what they do not manage and those who manage what they do not understand ~Archibald Putt. Ph.D
Copyright © 1996-2021 by Softpanorama Society. www.softpanorama.org was initially created as a service to the (now defunct) UN Sustainable Development Networking Programme (SDNP) without any remuneration. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.
FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available to advance understanding of computer science, IT technology, economic, scientific, and social issues. We believe this constitutes a 'fair use' of any such copyrighted material as provided by section 107 of the US Copyright Law according to which such material can be distributed without profit exclusively for research and educational purposes.
This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Grammar and spelling errors should be expected. The site contain some broken links as it develops like a living tree...
|
You can use PayPal to to buy a cup of coffee for authors of this site |
Disclaimer:
The statements, views and opinions presented on this web page are those of the author (or referenced source) and are not endorsed by, nor do they necessarily reflect, the opinions of the Softpanorama society. We do not warrant the correctness of the information provided or its fitness for any purpose. The site uses AdSense so you need to be aware of Google privacy policy. You you do not want to be tracked by Google please disable Javascript for this site. This site is perfectly usable without Javascript.
Last modified: March, 12, 2019