Skip to content

Commit

Permalink
Encapsulate exec resources in classes
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixBechstein0000 authored and jfarrell committed Sep 30, 2016
1 parent b2f44d4 commit cefc33f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 18 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ file { '/usr/lib/systemd/system/foo.service':
mode => '0644',
source => "puppet:///modules/${module_name}/foo.service",
} ~>
Exec['systemctl-daemon-reload']
Class['systemd::daemon_reload']
```

### tmpfiles
Expand All @@ -56,5 +56,5 @@ file { '/etc/tmpfiles.d/foo.conf':
mode => '0644',
source => "puppet:///modules/${module_name}/foo.conf",
} ~>
Exec['systemd-tmpfiles-create']
Class['systemd::tmpfiles_create']
```
9 changes: 9 additions & 0 deletions manifests/daemon_reload.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# -- Class: systemd::daemon_reload
# Triggers systemd to reload unit files
class systemd::daemon_reload {
exec { 'systemctl-daemon-reload':
command => 'systemctl daemon-reload',
refreshonly => true,
path => $::path,
}
}
20 changes: 4 additions & 16 deletions manifests/init.pp
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
# -- Class systemd
# This module allows triggering systemd commands once for all modules
class systemd {

Exec {
refreshonly => true,
path => $::path,
}

exec {
'systemctl-daemon-reload':
command => 'systemctl daemon-reload',
}

exec {
'systemd-tmpfiles-create':
command => 'systemd-tmpfiles --create',
}

include ::systemd::daemon_reload
include ::systemd::tmpfiles_create
}
9 changes: 9 additions & 0 deletions manifests/tmpfiles_create.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# -- Class: systemd::tmpfiles_create
# Triggers systemd to create tmpfiles
class systemd::tmpfiles_create {
exec { 'systemd-tmpfiles-create':
command => 'systemd-tmpfiles --create',
refreshonly => true,
path => $::path,
}
}

0 comments on commit cefc33f

Please sign in to comment.