This patch provides the Puppet package, a configuration management tool. I've already got upstream support for OpenWrt into Puppet, so this patch doesn't require any puppet modifications, so that is cool.
This does require a ruby patch. Please accept the patches in this ticket: https://dev.openwrt.org/ticket/9873 http://patchwork.openwrt.org/patch/3754/ Signed-off-by: Kyle Anderson <k...@xkyle.com> Index: admin/puppet/files/puppet.init =================================================================== --- admin/puppet/files/puppet.init (revision 0) +++ admin/puppet/files/puppet.init (working copy) @@ -0,0 +1,12 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2013 OpenWrt.org + +START=70 + +start() { + service_start /usr/bin/ruby /usr/bin/puppet agent +} + +stop() { + service_stop /usr/bin/ruby /usr/bin/puppet agent +} Index: admin/puppet/files/etckeeper-commit-post =================================================================== --- admin/puppet/files/etckeeper-commit-post (revision 0) +++ admin/puppet/files/etckeeper-commit-post (working copy) @@ -0,0 +1,10 @@ +#!/bin/sh + +PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + +which etckeeper > /dev/null 2>&1 || exit 0 + +etckeeper commit "committing changes in /etc after puppet catalog run" + +# Failure of etckeeper should not be fatal. +exit 0 Index: admin/puppet/files/puppet.conf =================================================================== --- admin/puppet/files/puppet.conf (revision 0) +++ admin/puppet/files/puppet.conf (working copy) @@ -0,0 +1,17 @@ +[main] +# Careful as /var is ephemeral on OpenWrt. +logdir=/var/log/puppet +vardir=/etc/puppet +ssldir=/etc/puppet/ssl +rundir=/var/run/puppet +factpath=$vardir/lib/facter +templatedir=$confdir/templates +prerun_command=/etc/puppet/etckeeper-commit-pre +postrun_command=/etc/puppet/etckeeper-commit-post + +[master] +# These are needed when the puppetmaster is run by passenger +# and can safely be removed if webrick is used. +ssl_client_header = SSL_CLIENT_S_DN +ssl_client_verify_header = SSL_CLIENT_VERIFY + Index: admin/puppet/files/etckeeper-commit-pre =================================================================== --- admin/puppet/files/etckeeper-commit-pre (revision 0) +++ admin/puppet/files/etckeeper-commit-pre (working copy) @@ -0,0 +1,10 @@ +#!/bin/sh + +PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + +which etckeeper > /dev/null 2>&1 || exit 0 + +etckeeper commit "saving uncommitted changes in /etc prior to puppet catalog run" + +# Failure of etckeeper should not be fatal. +exit 0 Index: admin/puppet/Makefile =================================================================== --- admin/puppet/Makefile (revision 0) +++ admin/puppet/Makefile (working copy) @@ -0,0 +1,98 @@ +# +# Copyright (C) 2013 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=puppet +PKG_VERSION:=3.3.1 +PKG_RELEASE:=1 + +PKG_SOURCE:=${PKG_NAME}-${PKG_VERSION}.tar.gz +PKG_SOURCE_URL:=http://downloads.puppetlabs.com/puppet/ +PKG_MD5SUM:=e553c381df75b24c8eda00ecc6dcef8a + +include $(INCLUDE_DIR)/package.mk + +define Package/puppet + SECTION:=admin + CATEGORY:=Administration + DEPENDS:= +libruby +ruby-core +ruby-enc +facter +ruby-yaml +ruby-gems +ruby-cgi +ruby-openssl +shadow-useradd +ruby-xmlrpc \ + +shadow-useradd +shadow-userdel +shadow-usermod +shadow-groups +shadow-groupmod +shadow-groupdel +shadow-groupadd +shadow-chage +net-tools-hostname + + TITLE:=Centralized configuration management + URL:=http://projects.puppetlabs.com/projects/puppet +endef + +define Package/puppet/description + Puppet lets you centrally manage every important aspect of your system + using a cross-platform specification language that manages all the + separate elements normally aggregated in different files, like users, + cron jobs, and hosts, along with obviously discrete elements like + packages, services, and files. + + Puppet's simple declarative specification language provides powerful + classing abilities for drawing out the similarities between hosts while + allowing them to be as specific as necessary, and it handles dependency + and prerequisite relationships between objects clearly and explicitly. +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/puppet/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/$(PKG_NAME) $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/lib/ruby/1.9/puppet + $(CP) $(PKG_BUILD_DIR)/lib/* $(1)/usr/lib/ruby/1.9/ + + $(INSTALL_DIR) $(1)/etc/ + $(INSTALL_DIR) $(1)/etc/puppet + $(INSTALL_DATA) ./files/puppet.conf $(1)/etc/puppet/puppet.conf + $(INSTALL_BIN) ./files/etckeeper-commit-post $(1)/etc/puppet/etckeeper-commit-post + $(INSTALL_BIN) ./files/etckeeper-commit-pre $(1)/etc/puppet/etckeeper-commit-pre + $(INSTALL_DIR) $(1)/etc/puppet/manifests + $(INSTALL_DIR) $(1)/etc/puppet/modules + $(INSTALL_DIR) $(1)/etc/puppet/templates + $(INSTALL_DIR) $(1)/etc/init.d/ + $(INSTALL_BIN) ./files/puppet.init $(1)/etc/init.d/puppet + +endef + +define Package/puppet/postinst +#!/bin/sh +grep -q '^puppet:' /etc/passwd && exit 0 +group=$$(grep '^puppet:' /etc/group | cut -f3 -d:) +if [ -z "$${group}" ] ; then + group=1000 + tst=$$(cat /etc/group | grep ":$${group}:") + while [ -n "$${tst}" ] ; do + group=$$(($${group}+1)) + tst=$$(cat /etc/group | grep ":$${group}:") + done + echo "puppet:x:$${group}:" >>/etc/group +fi + +user=$$(cat /etc/passwd | grep "^puppet:") +if [ -z "$${user}" ] ; then + num="$${group}" + tst=$$(cat /etc/passwd | grep ":.*:$${num}:") + while [ -n "$${tst}" ] ; do + num=$$(($${num}+1)) + tst=$$(cat /etc/passwd | grep ":.*:$${num}:") + done + echo "puppet:*:$${num}:$${group}:Puppet configuration management daemon:/var/lib/puppet:/bin/ash" >>/etc/passwd +fi +endef + +define Package/puppet/conffiles +/etc/puppet/ +endef + +$(eval $(call BuildPackage,puppet)) _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel