3. Introduction
What is AdminKit ?
a devops tool
in the same vein as cfengine, puppet, chef...
more in the spirit of cfengine V2 using the Python language
Frédéric Lepied () AdminKit 25 mai 2012 3 / 14
4. Objectives
What AdminKit do ?
configure and manage a set of Linux systems.
maintain the configurations as defined.
KISS principle.
What AdminKit do not do ?
manage the distribution of files → you need to use a way to distribute
AdminKit files yourself : packages, version control system, web site,
gui...
Frédéric Lepied () AdminKit 25 mai 2012 4 / 14
5. Concepts
One central configuration file describing the roles for each system you
want to manage.
Role files describe what is needed for fulfill the roles (packages,
configuration files, services...).
Configuration files are templates to allow easy customization and
reuse.
Frédéric Lepied () AdminKit 25 mai 2012 5 / 14
6. Central configuration
Objective : define roles for all the systems and their associated
variables.
The central configuration file is stored under
/var/lib/adminkit/adminkit.conf
It’s a Python file so you can use conditionals, loops
and functions...
Example:
1 define_domain ( ’ domain . com ’)
2 add_roles ( ’ host1 ’ , ’ smtpserver ’ , ’ imapserver ’)
3 add_roles ( ’ host2 ’ , ’ webserver ’)
4 add_var ( ’ host1 ’ , ’ ip ’ , ’ 192.168.0.1 ’)
5 add_var ( ’ host2 ’ , ’ ip ’ , ’ 192.168.0.2 ’)
Frédéric Lepied () AdminKit 25 mai 2012 6 / 14
7. Central configuration functions
define_domain(<name>) define the domain name for the hosts used
bellow this declaration.
add_roles(<host>, <name1>, ...) adds roles for <host>.
add_var(<host>, <name>, <value>) define a variable for
<host>.
add_to_list(<host>, <name>, <value>) add a <value> to the
list <name> for <host>.
get_var(<name>) return the value of variable <name>.
Frédéric Lepied () AdminKit 25 mai 2012 7 / 14
8. Role file
Role files are stored under /var/lib/adminkit/roles/
Objectives: define the files, services and packages to
manage for the role.
Exemple:
activate_service ( ’ ntp ’)
files_for_service ( ’ ntp ’ , ’/ etc / ntp . conf ’)
Frédéric Lepied () AdminKit 25 mai 2012 8 / 14
10. Config file
Config files are stored under /var/lib/adminkit/files/
Objectives: file templates for easy reuse.
jinja2 templates with access to all the variables
defined by the roles and the global config file.
the relative path under the root directory is the
destination filename.
Extract from /var/lib/adminkit/files/etc/ntp.conf (will
go to /etc/ntp.conf):
{% for server in timeservers %}
server {{ server }} iburst
{% endfor %}
Frédéric Lepied () AdminKit 25 mai 2012 10 / 14
11. Invoking
Single command to know :
# adminkit
Interesting options :
-d provide debug information.
-n dry run.
-s log to syslog.
The execution is done in 2 steps :
compute what needs to be done.
execute changes to be able to do actions only once.
Frédéric Lepied () AdminKit 25 mai 2012 11 / 14
12. Advanced usage : Global conf directive
global_conf is a role directive to be able to process the whole
configuration of your park on a system.
for example you want to generate Nagios files for all your servers
automatically. You just have to declare this in your nagios role :
global_conf ( ’ nagios ’ )
Then adminkit.conf will be read again by a special driver that will
launch adminkit for all the servers setting their roles and using the
root dir /var/lib/adminkit/nagios.
Frédéric Lepied () AdminKit 25 mai 2012 12 / 14
13. Advanced usage : update-adminkit.conf
Allow to split configuration in multiple files. By default lookup in
/var/lib/adminkit/adminkit.conf.d/*.conf. Files are copied in order.
Use the config file /etc/update-adminkit.conf to specify other
directories to lookup configuration parts using the TOPDIRS shell
variable. In these case, take files from $DIR/{*.conf,files,roles}.
Template files are copied, roles and conf files are concatenated in
order from each directory.
Frédéric Lepied () AdminKit 25 mai 2012 13 / 14