Tiny Puppet

As we can see when developing Puppet modules, when we want to configure a service, whatever it is, we follow more or less the same pattern: we install the software, we deploy the configuration files, and we start the services.

Tiny Puppet (http://tiny-puppet.com/) is an ambitious project that aims to provide a unified way to manage any kind of software in any operating system using minimalistic code by taking advantage of this common pattern that most modules implement.

The project is basically divided into two parts. One is a smart module with a collection of definitions that can manage the basic use cases: packages installation, configuration files management, and additional repositories setup. The second part is tiny data, a repository of Hiera data that defines the characteristics of each supported software so the first module knows how to manage it.

Then, for example, to install an Apache server in any of the supported operating systems, we only need the tiny Puppet module and a line of Puppet code:

tp::install { 'apache': }

If we need to provide additional configurations, we can use the tp::conf define:

tp::conf { 'apache::example.com.conf':
  template => 'site/apache/example.com.conf.erb',
  base_dir => 'config', # Use the settings key: config_dir_path
}

As you can see, we are not saying which package installs Apache, or if it contains a service, and we are also not telling tp::conf where to place the configuration file. Here is where the second part of the project, tiny data, enters into the game. For example, for the Apache project it contains some default settings and additional overrides for specific operating systems. For example, the YAML file with the Hiera data with the default settings looks like the following:

---
  apache::settings:
    package_name: 'httpd'
    service_name: 'httpd'
    config_file_path: '/etc/httpd/conf/httpd.conf'
    config_dir_path: '/etc/httpd'
    tcp_port: '80'
    pid_file_path: '/var/run/httpd.pid'
    log_file_path: [ '/var/log/httpd/access.log' , '/var/log/httpd/error.log' ]
    log_dir_path: '/var/log/httpd'
    data_dir_path: '/var/www/html'
    process_name: 'httpd'
    process_user: 'apache'
    process_group: 'apache'

And the overrides for FreeBSD are:

---
  apache::settings:
    config_file_path: '/usr/local/etc/apache20/httpd.conf'
    config_dir_path: '/usr/local/etc/apache20'
    config_file_group: 'wheel'

Some of the more useful implemented defines are:

  • tp::install: Installs the application, and manages its service, if any
  • tp::conf: Manages specific configuration files, multiple directories, where to place them and can exist for any software
  • tp::dir: Provides full directories with configuration, which can also be taken from remote repositories
  • tp::repo: Configures additional repositories for supported applications
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.94.153