Dyfi - moduli
Dyfi - Asentaa dyfi-update daemonin, joka pitää http://dy.fi:ssä varatun hostnamen varattuna palvelimen ip:lle.
Ladattavissa täältä.
Käyttöjärjestelmät:
Testattu seuraavilla käyttöjärjestelmillä:
Xubuntu 12.10 32-bit
Ubuntu 12.04 LTS 64-bit
Debian 6.0 64-bit
Rakenne:
dyfi ├── files │ ├── COPYING │ ├── dyfi-update │ ├── dyfi-update.conf │ ├── dyfi-update.pl │ ├── Makefile │ └── README ├── manifests │ ├── config.pp │ ├── init.pp │ ├── install.pp │ ├── params.pp │ └── service.pp ├── README └── templates └── dyfi-update.conf.erb
README
######################### # Puppet module: dyfi # ######################### This module installs and manages dyfi-update daemon. Dyfi-update daemon resfreshes the specified hostname at 'http://dy.fi'. ###################### # TODO before using # ###################### Check dyfi::params for wanted specifications. Fill '$email', '$password' and '$host' with your own information. ################ # Sample usage # ################ include dyfi ########## # Author # ########## Made by Sampo Tyllilä <sampo.tyllila@gmail.com> ########### # License # ########### This software is distributed under the GNU General Public License version 2 or any later version. http://www.gnu.org/licenses/
Manifests kansion sisältö:
init.pp
# == Class: dyfi # # This module manages domain hostname refreshing from dy.fi. # # === Parameters # # [*email*] - The email of dy.fi account. # [*password*] - The password of dy.fi account. # [*host*] - The hostname to refresh. # [*release*] - Whether to release hostname when service is shutted down or not. # # === Examples # # See README for details. # # === Author # # Sampo Tyllilä# class dyfi ( $email = $dyfi::params::email, $password = $dyfi::params::password, $host = $dyfi::params::host, $release = $dyfi::params::release ) inherits dyfi::params { include dyfi::params, dyfi::install, dyfi::config, dyfi::service }
install.pp
# == Class: dyfi::install # # This module creates '/etc/dyfi' directory, transfers # there files that are needed to instal dyfi-update and installs make. # # === Author # # Sampo Tyllilä# class dyfi::install { package { 'make': ensure => latest, } file { '/etc/dyfi-update': ensure => directory, } file { '/etc/dyfi-update/Makefile': ensure => file, source => "puppet:///modules/dyfi/Makefile", require => File["/etc/dyfi-update"], } file { '/etc/dyfi-update/dyfi-update': ensure => present, source => "puppet:///modules/dyfi/dyfi-update", require => File["/etc/dyfi-update"], } file { '/etc/dyfi-update/dyfi-update.pl': ensure => present, source => "puppet:///modules/dyfi/dyfi-update.pl", require => File["/etc/dyfi-update"], } file { '/etc/dyfi-update/README': ensure => present, source => "puppet:///modules/dyfi/README", require => File["/etc/dyfi-update"], } file { '/etc/dyfi-update/COPYING': ensure => present, source => "puppet:///modules/dyfi/COPYING", require => File["/etc/dyfi-update"], } }
service.pp
# == Class: dyfi::service # # This class manages dyfi-update service. # # === Requires # # The dyfi::config class. # # === Author # # Sampo Tyllilä# class dyfi::service { service { "dyfi-update": ensure => running, enable => true, require => Class["dyfi::config"], } }
config.pp
# == Class: dyfi::config # # This class manages '/usr/local/etc/dyfi-update.conf' and installs dyfi-update. # # === Requires # # The dyfi::install class. # # === Subscribes # # The File["/usr/local/etc/dyfi-update.conf"] resource. # # === Author # # Sampo Tyllilä# class dyfi::config { file { "/usr/local/etc/dyfi-update.conf": ensure => file, content => template("dyfi/dyfi-update.conf.erb"), owner => "root", group => "root", mode => 644, require => Class["dyfi::install"], } exec { "install dyfi": cwd => "/etc/dyfi-update", command => "/usr/bin/make install", subscribe => File["/usr/local/etc/dyfi-update.conf"], } }
params.pp
# == Class: dyfi::params # # This class manages the parameters of this dyfi module. # # === Parameters # # [*email*] - The email of dy.fi account. # [*password*] - The password of dy.fi account. # [*host*] - The hostname to refresh. # [*release*] - Whether to release hostname when service is shutted down or not. # # === Author # # Sampo Tyllilä# class dyfi::params { $email = 'email@email.com' $password = 'MyPassword' $host = 'MyHost.dy.fi' $release = 'no' }
Templates kansion sisältö:
dyfi-update.conf.erb
# MANAGED BY PUPPET! # # dyfi-update.pl config file # # use the -f option of dyfi-update.pl to specify the # location of this file. If the -f option is not given, # the script expects to get all parameters on the command line. # # Please remember - dyfi-update.pl is a daemon. Do not put it in # crontab. Run it from an init script when booting. # # dy.fi username (email address) and password: User <%= email %> Password <%= password %> # List of hostnames to point to the address of the host where the # dyfi-update.pl client is running Hosts <%= host %> # Release hosts when shutting down? Set to 'no' or comment the # following line out to disable releasing hosts at shutdown. # With the 'offline URL' feature of dy.fi, and automatic # releasing, you can forward web browsers to another URL while # your home web server is down. Release <%= release %> # Log file: filename or - for stdout Logfile /var/log/dyfi-update.log # Write the PID of the dyfi-update.pl process to this file # This is a mandatory parameter, a PID file is required for # the 'rabbit check' (makes sure only one copy of dyfi-update # is running at a time). Pidfile /var/run/dyfi-update.pid
Files kansion sisältö:
Koostuu tiedostoista, jotka ovat ladattavissa http://www.dy.fi/files/dyfi-update-pl-1.2.0.tar.gz
Huomioita.
Modulin toteutuksessa tulisi käyttää tyyliä, joka kopioisi koko 'Files' kansion sisällön yhdellä komennolla kohteeseen.