Permalink
Browse files

Mass standardization of per project subclasses

This commits leverages the management of modules subclasses that are automatically loaded in the $my_project
variable is set.
- All the $my_project subclasses have been moved out of the modules and place in a same example42 project module
- modulename::$my_project::backup subclasses have been removed
- Name have been standardized to modulename::$my_project:: (note that this might break an existing setup which uses $my_project.
  The solution is easy: rename the included $my_project subclass
- 00_example42scripts/example42_project_clone.sh script now quickly creates a custom $my_project module
  • Loading branch information...
1 parent 909d7f5 commit 3a80fc564b20365a5d1674bd0d7df91c2223f6b1 root committed Dec 27, 2011
Showing 374 changed files with 759 additions and 3,332 deletions.
@@ -1,17 +1,17 @@
#!/bin/bash
-echo "This script makes a clone of the example43 module, with the name you provide"
+echo "This script makes a clone of the example42 module, with the name you provide"
echo "The result module can you used to place you custom files and classes related to you own \$my_project"
localsystem=$(uname)
-if [ ! -f example43/manifests/init.pp ] ; then
- echo "I don't find "example43/manifests/init.pp" , run 00_example42scripts/example43_project_clone.sh for the main Example42 modules directory"
+if [ ! -f example42/manifests/init.pp ] ; then
+ echo "I don't find "example42/manifests/init.pp" , run 00_example42scripts/example42_project_clone.sh for the main Example42 modules directory"
exit 1
fi
-OLDMODULE="example43"
+OLDMODULE="example42"
echo
echo -n "Enter the name of the new module: "
read NEWMODULE
@@ -1,46 +0,0 @@
-#!/bin/bash
-# This scripts changes references to example42 to your project string in Example42.com modules
-# - Renames manifests and directories
-# - Changes contents
-
-echo "This script changes all the references of example42 to the string you define (your project)"
-echo "Run it from the directory of the module you want to change"
-
-localsystem=$(uname)
-
-if [ ! -f manifests/init.pp ] ; then
- echo "I don't find "manifests/init.pp" , run this script from inside a module directory"
- exit 1
-fi
-
-echo -n "Enter the name of the original project (example42): "
-read OLDPROJECT
-
-echo -n "Enter the name of the new project: "
-read NEWPROJECT
-
-echo "RENAMING MANIFESTS"
-for file in $( find . -name $OLDPROJECT.pp ) ; do
- newfile=`echo $file | sed -e "s/$OLDPROJECT/$NEWPROJECT/"`
- mv "$file" "$newfile" && echo "Renamed $file to $newfile"
-done
-
-echo "---------------------------------------------------"
-echo "RENAMING DIRECTORIES"
-for file in $( find . -type d | grep $OLDPROJECT ) ; do
- newfile=`echo $file | sed -e "s/$OLDPROJECT/$NEWPROJECT/"`
- mv "$file" "$newfile" && echo "Renamed $file to $newfile"
-done
-
-echo "---------------------------------------------------"
-echo "CHANGING FILE CONTENTS"
-for file in $( grep -R $OLDPROJECT . | cut -d ":" -f 1 | uniq ) ; do
- case $localsystem in
- Darwin)
- sed -i "" -e "s/$OLDPROJECT/$NEWPROJECT/g" $file && echo "Changed $file" # Use under MacOS
- ;;
- *)
- sed -i "s/$OLDPROJECT/$NEWPROJECT/g" $file && echo "Changed $file" # Use under Linux
- ;;
-esac
-done
@@ -1,3 +0,0 @@
-# File Managed by Puppet
-# Default password "example42"
-cobbler:Cobbler:76e810795fbbb430f035e195784e9b30
@@ -1,63 +0,0 @@
-class cobbler::example42 inherits cobbler {
-
-# Uncomment and adapt for a separated cobbler data storage mount point
- Package["cobbler"] {
- require => Mount["/var/www/cobbler"],
- }
-
- file {
- "/var/www/cobbler":
- mode => 755, owner => root, group => root,
- ensure => directory,
- }
-
- mount {
- "/var/www/cobbler":
- name => "/var/www/cobbler",
- atboot => true,
- device => "/dev/sdb1",
- ensure => mounted,
- fstype => ext3,
- options => rw,
- require => File["/var/www/cobbler"],
- }
-
-
-# Custom Source for general configuration files
-
- File ["/etc/cobbler/settings"] {
- require => Package[cobbler],
- content => template("cobbler/example42/settings"),
- }
-
- File ["/etc/cobbler/rsync.exclude"] {
- content => template("cobbler/example42/rsync.exclude"),
- }
-
- File ["/etc/cobbler/dhcp.template"] {
- content => template("cobbler/example42/dhcp.template"),
- }
-
- file {
- "/etc/cobbler/users.digest":
- mode => 640, owner => root, group => root,
- require => Package[cobbler],
- backup => local,
- ensure => present,
- path => "/etc/cobbler/users.digest",
- source => "puppet://$servername/cobbler/example42/users.digest",
- }
-
-
-# Kickstart Templates
-
- file {
- "/etc/cobbler/example42.ks":
- mode => 644, owner => root, group => root,
- require => Package[cobbler],
- backup => local,
- ensure => present,
- content => template("cobbler/example42/example42.ks"),
- }
-
-}
@@ -1,57 +0,0 @@
-# Managed by Puppet
-# File generated by Cobbler
-
-ddns-update-style interim;
-ignore client-updates;
-
-allow booting;
-allow bootp;
-
-ignore client-updates;
-set vendorclass = option vendor-class-identifier;
-
-subnet <%= network %> netmask <%= netmask %> {
- option routers <%= default_gateway %>;
- option domain-name-servers <% dns_servers.each do |ns| %><%= ns %><% end %>
- option domain-name "<%= domain %>";
- option subnet-mask <%= network %>;
- range dynamic-bootp <%= dhcp_range %>;
- filename "/pxelinux.0";
- default-lease-time 21600;
- max-lease-time 43200;
- server-name "start";
- next-server $next_server;
-}
-
-#for dhcp_tag in $dhcp_tags.keys():
- ## group could be subnet if your dhcp tags line up with your subnets
- ## or really any valid dhcpd.conf construct ... if you only use the
- ## default dhcp tag in cobbler, the group block can be deleted for a
- ## flat configuration
-# group for Cobbler DHCP tag: $dhcp_tag
-group {
- #for mac in $dhcp_tags[$dhcp_tag].keys():
- #set iface = $dhcp_tags[$dhcp_tag][$mac]
- host $iface.name {
- hardware ethernet $mac;
- #if $iface.ip_address:
- fixed-address $iface.ip_address;
- #end if
- #if $iface.subnet:
- option subnet-mask $iface.subnet;
- #end if
- #if $iface.gateway:
- option routers $iface.gateway;
- #end if
- #if $iface.system.netboot_enabled:
- filename "$iface.filename";
- ## Cobbler defaults to $next_server, but some users
- ## like to use $iface.system.server for proxied setups
- next-server $next_server;
- ## next-server $iface.system.server;
- #end if
- }
- #end for
-}
-#end for
-
@@ -1,44 +0,0 @@
-key --skip
-auth --useshadow --enablemd5
-bootloader --location=mbr
-text
-firewall --disable
-selinux --permissive
-firstboot --disable
-keyboard it
-lang en_US
-timezone Europe/Rome
-url --url=$tree
-$yum_repo_stanza
-network --bootproto=static --ip=$ip_address --netmask=$subnet --hostname=$hostname --gateway=$gateway --device=eth0 --onboot=on
-rootpw --iscrypted $1$i/FKPUYn$feFVmvGMk5YJ/bpm3XfvW.
-reboot
-
-bootloader --location=mbr --driveorder=xvda --append="rhgb quiet"
-
-clearpart --all --initlabel --drives=xvda
-part /boot --fstype ext3 --size=100 --ondisk=xvda
-part pv.2 --size=0 --grow --ondisk=xvda
-volgroup system --pesize=32768 pv.2
-logvol / --fstype ext3 --name=lv00 --vgname=system --size=1024 --grow
-logvol swap --fstype swap --name=lv01 --vgname=system --size=512 --grow --maxsize=544
-
-%packages --nobase
-crontabs
-puppet
-nfs-utils
-openssh-clients
-openssh-server
-yum
-wget
-
-%post
-$yum_config_stanza
-hostname $hostname
-# Uncomment for puppet run
-# puppetd --server <%= puppet_server %> -v -o --no-daemonize --tags repo,puppet,hosts,resolver --logdest /var/log/firstpuppetrun.log
-# puppetd --server <%= puppet_server %> -v -o --no-daemonize --logdest /var/log/firstpuppetrun.log
-
-$kickstart_done
-%end
-
@@ -1,16 +0,0 @@
-# Managed by Puppet
-### files to exclude from "cobbler import" commands that use
-### rsync mirrors. by default ISOs, PPC code, and debug
-### RPM's are not transferred. Some users may want to
-### re-enable debug RPM's
-**/debug/**
-**/ppc/**
-**/ppc64/**
-**/s390/**
-**/s390x/**
-**/source/**
-**/SRPMS/**
-**/*.iso
-**/kde-i18n**
-**cache**
-
@@ -1,58 +0,0 @@
-# Managed by Puppet
----
-allow_duplicate_macs: 0
-allow_duplicate_ips: 0
-bind_bin: /usr/sbin/named
-bootloaders:
- ia64: /var/lib/cobbler/elilo-3.6-ia64.efi
- standard: /usr/lib/syslinux/pxelinux.0
-default_kickstart: /etc/cobbler/default.ks
-default_virt_bridge: xenbr0
-default_virt_type: auto
-default_virt_file_size: 5
-default_virt_ram: 512
-default_ownership: "admin"
-dhcpd_bin: /usr/sbin/dhcpd
-dhcpd_conf: /etc/dhcpd.conf
-dnsmasq_bin: /usr/sbin/dnsmasq
-dnsmasq_conf: /etc/dnsmasq.conf
-httpd_bin: /usr/sbin/httpd
-http_port: 80
-kernel_options:
- ksdevice: eth0
- lang: ' '
- syslog: '<%= cobbler_server %>:25150'
- text: ~
-ldap_server: "ldap.example42.com"
-ldap_base_dn: "DC=example42,DC=com"
-ldap_port: 389
-ldap_tls: 1
-ldap_anonymous_bind: 1
-ldap_search_bind_dn: ''
-ldap_search_passwd: ''
-ldap_search_prefix: 'uid='
-
-manage_dhcp: 1
-manage_dhcp_mode: isc
-manage_dns: 0
-next_server: '<%= tftp_server %>'
-server: '<%= cobbler_server %>'
-pxe_just_once: 1
-omapi_enabled: 0
-omapi_port: 647
-omshell_bin: /usr/bin/omshell
-register_new_installs: 1
-snippetsdir: /var/lib/cobbler/snippets
-syslog_port: 25150
-tftpboot: /tftpboot
-tftpd_bin: /usr/sbin/in.tftpd
-tftpd_conf: /etc/xinetd.d/tftp
-webdir: /var/www/cobbler
-xmlrpc_port: 25151
-xmlrpc_rw_enabled: 1
-xmlrpc_rw_port: 25152
-yum_post_install_mirror: 0
-yumdownloader_flags: "-resolve"
-yum_core_mirror_from_server: 1
-yum_core_repos_from_server: 1
-
@@ -1,8 +0,0 @@
-# Class postfix::backup::example42
-#
-# Custom backup class for example42 project.
-# Here you can override or define your settings for the backup wrapper
-#
-class postfix::backup::example42 inherits postfix::backup {
-
-}
@@ -1,27 +0,0 @@
-# Class postfix::example42
-#
-# Custom project class for example42 project. Use this to adapt the postfix module to your project.
-# This class is autoloaded if $my_module == example42 and $my_module_onmodule != yes
-# If $my_module_onmodule == yes Puppet tries to autoload example42::postfix
-# that is: MODULEPATH/example42/manifests/postfix.pp
-#
-# You can use your custom project class to modify the standard behaviour of postfix module
-# If you need to override parameters of resources defined in postfix class use a syntax like
-# class postfix::example42 inherits postfix {
-# File["postfix.conf"] {
-# source => [ "puppet:///postfix/postfix.conf-$hostname" , "puppet:///postfix/postfix.conf" ],
-# }
-#
-# You don't need to use class inheritance if you don't override or redefine resources in postfix class
-#
-# Note that this approach leaves you maximum flexinility on how to manage postfix application in your environment
-# You can add custom resources and decide how to provide the contents of the configuration files:
-# - Via static sourced files ( source => ) according to the naming convention you need
-# - Via custom templates ( content => ) or templates joins
-# - Via some kind on infile line modification tools, such as Augeas or the Example42's conf define approach
-#
-class postfix::example42 inherits postfix {
- File["main.cf"] {
- content => template("postfix/example42/main.cf"),
- }
-}
@@ -1,8 +0,0 @@
-# Class postfix::monitor::example42
-#
-# Custom monitor class for example42 project.
-# Here you can override or define your settings for the monitor wrapper
-#
-class postfix::monitor::example42 inherits postfix::monitor {
-
-}
@@ -1,28 +0,0 @@
-# File managed by Puppet
-
-smtpd_banner = $myhostname ESMTP $mail_name
-biff = no
-
-append_dot_mydomain = no
-#delay_warning_time = 4h
-
-readme_directory = no
-
-# TLS parameters
-smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
-smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
-smtpd_use_tls=no
-smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
-smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
-
-myhostname = <%= fqdn %>
-alias_maps = hash:/etc/aliases
-alias_database = hash:/etc/aliases
-myorigin = /etc/mailname
-mydestination = <%= fqdn %>, localhost.<%= domain %> , localhost, <%= scope.lookupvar('postfix::params::mydestination') %>
-relayhost = <%= scope.lookupvar('postfix::params::relayhost') %>
-mynetworks = 127.0.0.0/8 <%= scope.lookupvar('postfix::params::mynetworks') %>
-mailbox_size_limit = 0
-recipient_delimiter = +
-inet_interfaces = <%= scope.lookupvar('postfix::params::inet_interfaces') %>
-
File renamed without changes.
File renamed without changes.
@@ -38,7 +38,4 @@
target => "${activemq::params::backup_target_real}",
}
- # Include project specific backup class if $my_project is set
- if $my_project { include "activemq::${my_project}::backup" }
-
}
Oops, something went wrong.

0 comments on commit 3a80fc5

Please sign in to comment.