Skip to content

Instantly share code, notes, and snippets.

@roidelapluie
Last active January 27, 2016 10:07
Show Gist options
  • Save roidelapluie/069223753a576983de39 to your computer and use it in GitHub Desktop.
Save roidelapluie/069223753a576983de39 to your computer and use it in GitHub Desktop.
puppet-systemd
# Howto
```
export FACTER_test_file=/tmp/test-$RANDOM
export FACTER_test_group=NONE
test -f /tmp/foo2 && rm /tmp/foo2
test -f /tmp/foo && rm /tmp/foo
mkdir /tmp/foo2
puppet apply manifest.pp
rmdir /tmp/foo2
export FACTER_test_group=$(id -g -n)
puppet apply manifest.pp
test -f $FACTER_test_file || echo Service Not Reloaded
```
$ export FACTER_test_file=/tmp/test-$RANDOM
$ export FACTER_test_group=NONE
$ test -f /tmp/foo2 && rm /tmp/foo2
$ test -f /tmp/foo && rm /tmp/foo
$ mkdir /tmp/foo2
$ puppet apply manifest.pp
Notice: Compiled catalog for nitrogen in environment production in 0.10 seconds
Notice: /Stage[main]/Main/File[/tmp/foo]/ensure: defined content as '{md5}e0aa021e21dddbd6d8cecec71e9cf564'
Error: Could not find group NONE
Error: /Stage[main]/Main/File[/tmp/foo2]/group: change from roidelapluie to NONE failed: Could not find group NONE
Notice: /Stage[main]/Main/Exec[systemd daemon-reload]: Dependency File[/tmp/foo2] has failures: true
Warning: /Stage[main]/Main/Exec[systemd daemon-reload]: Skipping because of failed dependencies
Notice: /Stage[main]/Main/Exec[Service Foo]: Dependency File[/tmp/foo2] has failures: true
Warning: /Stage[main]/Main/Exec[Service Foo]: Skipping because of failed dependencies
Notice: Applied catalog in 0.02 seconds
$ rmdir /tmp/foo2
$ export FACTER_test_group=$(id -g -n)
$ puppet apply manifest.pp
Notice: Compiled catalog for nitrogen in environment production in 0.11 seconds
Notice: /Stage[main]/Main/File[/tmp/foo2]/ensure: created
Notice: /Stage[main]/Main/Exec[systemd daemon-reload]: Triggered 'refresh' from 1 events
Notice: Applied catalog in 0.02 seconds
$ test -f $FACTER_test_file || echo Service Not Reloaded
Service Not Reloaded
exec {
'systemd daemon-reload':
command => '/bin/true',
refreshonly => true
}
file {
'/tmp/foo':
content => 'OK',
notify => [Exec['systemd daemon-reload'], Exec['Service Foo']],
}
exec {
'Service Foo':
command => "/bin/touch ${::test_file}",
refreshonly => true,
require => Exec['systemd daemon-reload'],
}
file {
'/tmp/foo2':
ensure => present,
notify => Exec['systemd daemon-reload'],
group => $::test_group,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment