With this post I will explain you the Puppet Configuration Key feature at the
server manager.
With the puppet configuration key feature you can store configuration data used in puppet classes at your database. You can also store configuration data on server groups and add servers to that group.
Yes - it's working like ripienaar's great
extlookup but with database.
For this example I have got two hosts:
- valentina.brachium-system.net
- web01.brachium-system.net
Both hosts are saved on the server manager.
We have some puppet configuration keys at server manager:
The first server
valentina.brachium-system.net has got the following puppet key configuration:
The second server
web01.brachium-system.net has got the following puppet key configuration:
We are using this puppet manifest:
# Configuration for dblookup from servermgmt:
$dblook_host = "localhost"
$dblook_user = "servermgmt"
$dblook_pass = "servermgmt"
$dblook_db = "servermgmt"
class ssh::server {
$ssh_server_password_authentication = dblookup('ssh_server_password_authentication')
$ssh_server_root_login = dblookup('ssh_server_root_login')
notice("ssh_server_password_authentication: $ssh_server_password_authentication")
notice("ssh_server_root_login: $ssh_server_root_login")
file { "/etc/ssh/sshd_config":
content => template("/home/jonas/puppet/templates/sshd_config.erb")
}
}
node default {
$pkg_install_subversion = dblookup('pkg_install_subversion')
notice("We are the server: ${fqdn}")
notice("pkg_install_subversion: $pkg_install_subversion")
include ssh::server
package {"subversion":
ensure => dblookup('pkg_install_subversion')
}
}
We run that manifest on the server
valentina:
notice: Scope(Node[default]): We are the server: valentina.brachium-system.net
notice: Scope(Node[default]): pkg_install_subversion: present
notice: Scope(Class[ssh::server]): ssh_server_password_authentication: yes
notice: Scope(Class[ssh::server]): ssh_server_root_login: no
We run that manifest on the server
web01:
notice: Scope(Node[default]): We are the server: web01.stg.brachium-system.net
notice: Scope(Node[default]): pkg_install_subversion: absent
notice: Scope(Class[ssh::server]): ssh_server_password_authentication: no
notice: Scope(Class[ssh::server]): ssh_server_root_login: yes
You can see on the verbose output from puppet, the information is fetched from the database - if the server has got no own value for one key, the default value is used.
You can get the source at
http://github.com/hggh/servermgmt