AdminKit is a tool to manage systems’ configuration. It automates system administration tasks. All the configuration descriptions are stored in a central directory tree. This tree is copied on all the systems by a mean that is outside AdminKit. You can use a network file system or a distributed revision control for this purpose. For example, we use git to manage the versionning and distribution of the files for our needs.
The files are usually stored under /var/lib/adminkit.
The main file is adminkit.conf. It describes the roles for each managed system. It must be at the root of /var/lib/adminkit.
The roles are described in the roles sub-directory. The roles describe the needed config files and services.
The config files are under the files sub-directory. You can specialize the config files by adding the name of the system or any roles or domain.
adminkit.conf is the entry point of the configuration for your set of systems administrated under AdminKit. It describes globally what roles are defined for your systems.
The adminkit.conf file is in fact a python file so you can use any python construct.
Roles are defined by files of the same name declared in the adminkit.conf file. They are located under the roles directory. Role files can use the following directives:
In fact role files are python files so you can use any python construct you want.
The config files are in fact templates that can use variables. Some variables are automatically defined:
You can also define variables in the main config file or in the role files using the add_var definitions.
Variables are used in the config files using the jinja2 conventions (for example {{ hostname }}). You can also use variables in the name of files or directories.
You can have specialized version of the same file by using extensions taken from variables or role names. For example, if you are using a file called /etc/config in your role file, adminkit will lookup /etc/config.<shortname>, /etc/config.<hostname>, /etc/config.<osname>...
Imagine we want to manage a system called host1 under AdminKit. So on the disk, we have the following directory structure:
/var/lib/adminkit/adminkit.conf
/var/lib/adminkit/roles/base
/var/lib/adminkit/files/etc/cron.hourly/base
/var/lib/adminkit/files/etc/mailname
The base role defines that a system is under AdminKit control and so it has a crontab entry that run the adminkit command every hour and it ensures that the mailname file is always coherent with the host name.
Here is the adminkit.conf file with the assumption that the fqdn of host1 is host1.domain.com:
define_domain('domain.com')
add_roles('host1', 'base')
Then the base role defines what files are defined for the role:
add_files(('/etc/cron.hourly/base', 0755, 'root', 'root'),
'/etc/mailname')
The file /var/lib/adminkit/files/etc/mailname will be copied to /etc/mailname if there is a difference with the local copy. This file is interesting as we use a variable that will be expanded during the copy phase:
{{ hostname }}
Once we have everything setup, we just have to call the adminkit command that runs the checks and takes the needed actions defined in adminkit.conf.