We talked about this a bit on IRC. I wanted to summarize it.
1) We discussed changing the naming in the custom systemd stuff to avoid
any potential conflict with systemd support when it gets added upstream
to puppet.
2) I think it would be good to add some references to this stuff in the
manual. The installation section of the getting started chapter would
be an appropriate location.
Thanks,
On 09/13/2011 02:24 PM, Adam Stokes wrote:
- Uses puppet for easy configuration and package installation
- A simple kickstart script intended to be included in a existing
kickstart configuration
Signed-off-by: Adam Stokes<astokes(a)fedoraproject.org>
---
contrib/kickstart/matahari-win.ks | 3 +
contrib/kickstart/matahari.ks | 10 +++++
contrib/puppet/README | 3 +
.../puppet/lib/puppet/provider/service/systemd.rb | 42 ++++++++++++++++++++
contrib/puppet/lib/puppet/type/systemd.rb | 18 ++++++++
contrib/puppet/manifests/modules.pp | 1 +
contrib/puppet/manifests/site.pp | 3 +
contrib/puppet/modules/matahari/manifests/init.pp | 28 +++++++++++++
contrib/puppet/modules/yum/manifests/init.pp | 25 ++++++++++++
9 files changed, 133 insertions(+), 0 deletions(-)
create mode 100644 contrib/kickstart/matahari-win.ks
create mode 100644 contrib/kickstart/matahari.ks
create mode 100644 contrib/puppet/README
create mode 100644 contrib/puppet/lib/puppet/provider/service/systemd.rb
create mode 100644 contrib/puppet/lib/puppet/type/systemd.rb
create mode 100644 contrib/puppet/manifests/modules.pp
create mode 100644 contrib/puppet/manifests/site.pp
create mode 100644 contrib/puppet/modules/matahari/manifests/init.pp
create mode 100644 contrib/puppet/modules/yum/manifests/init.pp
diff --git a/contrib/kickstart/matahari-win.ks b/contrib/kickstart/matahari-win.ks
new file mode 100644
index 0000000..10e6252
--- /dev/null
+++ b/contrib/kickstart/matahari-win.ks
@@ -0,0 +1,3 @@
+%packages
+mingw32-matahari
+%end
diff --git a/contrib/kickstart/matahari.ks b/contrib/kickstart/matahari.ks
new file mode 100644
index 0000000..8557021
--- /dev/null
+++ b/contrib/kickstart/matahari.ks
@@ -0,0 +1,10 @@
+%packages
+matahari
+matahari-agent-lib
+matahari-service
+matahari-broker
+matahari-host
+matahari-net
+matahari-lib
+!matahari-devel
+%end
diff --git a/contrib/puppet/README b/contrib/puppet/README
new file mode 100644
index 0000000..278c8f6
--- /dev/null
+++ b/contrib/puppet/README
@@ -0,0 +1,3 @@
+Within the contrib/puppet directory run:
+
+# sudo RUBYLIB=lib/ puppet --modulepath=modules/ --verbose manifests/site.pp
\ No newline at end of file
diff --git a/contrib/puppet/lib/puppet/provider/service/systemd.rb
b/contrib/puppet/lib/puppet/provider/service/systemd.rb
new file mode 100644
index 0000000..9a0fca4
--- /dev/null
+++ b/contrib/puppet/lib/puppet/provider/service/systemd.rb
@@ -0,0 +1,42 @@
+Puppet::Type.type(:service).provide :systemd,
+ :parent => :init, :source => :init do
+
+ desc "execute systemd service using systemctl"
+
+ commands :service => "/bin/systemctl"
+ defaultfor :operatingsystem => [:fedora]
+ def self.defpath
+ superclass.defpath
+ end
+
+ def disable
+ [command(:service), "disable", @resource[:name]]
+ end
+
+ def enabled?
+ system("/bin/systemctl", "is-enabled", @resource[:name])
+ if [0].include?($CHILD_STATUS.exitstatus)
+ return :true
+ else
+ return :false
+ end
+ end
+
+ def enable
+ output = service(:enable, @resource[:name])
+ rescue Puppet::ExecutionFailure => detail
+ raise Puppet::Error, "Could not enable #{self.name}: #{detail}"
+ end
+
+ def restartcmd
+ [command(:service), "restart", @resource[:name]]
+ end
+
+ def startcmd
+ [command(:service), "start", @resource[:name]]
+ end
+
+ def stopcmd
+ [command(:service), "stop", @resource[:name]]
+ end
+end
diff --git a/contrib/puppet/lib/puppet/type/systemd.rb
b/contrib/puppet/lib/puppet/type/systemd.rb
new file mode 100644
index 0000000..c94a516
--- /dev/null
+++ b/contrib/puppet/lib/puppet/type/systemd.rb
@@ -0,0 +1,18 @@
+require 'puppet/type'
+
+Puppet::Type.newtype :systemd do
+ @doc = "Run service via systemd"
+
+ newparam :service do
+ desc "Name of service"
+ end
+
+ newparam :action do
+ desc "Start/Stop/Restart service"
+ end
+
+ ensurable do
+ defaultvalues
+ defaultto :start
+ end
+end
diff --git a/contrib/puppet/manifests/modules.pp b/contrib/puppet/manifests/modules.pp
new file mode 100644
index 0000000..e5b1959
--- /dev/null
+++ b/contrib/puppet/manifests/modules.pp
@@ -0,0 +1 @@
+import "matahari"
diff --git a/contrib/puppet/manifests/site.pp b/contrib/puppet/manifests/site.pp
new file mode 100644
index 0000000..a254b49
--- /dev/null
+++ b/contrib/puppet/manifests/site.pp
@@ -0,0 +1,3 @@
+import "modules.pp"
+
+include matahari::base
diff --git a/contrib/puppet/modules/matahari/manifests/init.pp
b/contrib/puppet/modules/matahari/manifests/init.pp
new file mode 100644
index 0000000..3cd830d
--- /dev/null
+++ b/contrib/puppet/modules/matahari/manifests/init.pp
@@ -0,0 +1,28 @@
+class matahari::base {
+ notice("Matahari manifests begin")
+
+ $packagelist = [
+ "matahari-host",
+ "matahari-network",
+ "matahari-service",
+ "matahari-sysconfig",
+ "matahari-lib",
+ "matahari-agent-lib",
+ "matahari-broker",
+ "matahari"]
+ package {
+ $packagelist: ensure => latest
+ }
+
+ $serlist = [
+ "matahari-host.service",
+ "matahari-network.service",
+ "matahari-sysconfig.service",
+ "matahari-service.service",
+ "matahari-broker.service"]
+ service {
+ $serlist:
+ ensure => stopped,
+ enable => true
+ }
+}
diff --git a/contrib/puppet/modules/yum/manifests/init.pp
b/contrib/puppet/modules/yum/manifests/init.pp
new file mode 100644
index 0000000..9a8e8f4
--- /dev/null
+++ b/contrib/puppet/modules/yum/manifests/init.pp
@@ -0,0 +1,25 @@
+class matahari::yum {
+ package {
+ yum: ensure => installed
+ }
+
+ file {
+ fedora-updates:
+ name => '/etc/yum.repos.d/fedora-updates.repo',
+ ensure => present,
+ owner => root,
+ group => root,
+ mode => 600,
+ require => Package["yum"],
+ }
+
+ yumrepo {
+ fedora-updates:
+ descr => 'fedora-updates',
+ baseurl =>
'http://download.fedoraproject.org/pub/fedora/linux/updates/16/x86_64/',
+ enabled => 1,
+ gpgcheck => 0,
+ gpgkey => 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora',
+ require => File["fedora-updates"];
+ }
+}
--
Russell Bryant