I'm having a really weird problem with systemd on RHEL7.The /run/puppetboot.lock file is not being removed at the end of execution for the unit file. Strangely, when I replace the 'puppet agent' lines with '/usr/bin/true', then them lock file is deleted as expected.
[Unit]
Description=Extra Puppet runs
Wants=basic.target
Before=puppet.service
After=basic.target network.target puppetmaster.service
[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=-/etc/sysconfig/puppetagent
EnvironmentFile=-/etc/sysconfig/puppet
ExecStart=/usr/bin/touch /run/puppetboot.lock
ExecStart=/usr/bin/puppet agent --onetime --no-daemonize --ignoreschedules
ExecStart=/usr/bin/puppet agent --onetime --no-daemonize --ignoreschedules
ExecStart=/usr/bin/rm -f /run/puppetboot.lock
ExecStart=/bin/bash -c "/bin/test -x /usr/local/sbin/reboot-if-needed && /usr/local/sbin/reboot-if-needed"
[Install]
WantedBy=multi-user.target puppet.service
I'm using the lock file as a signal that the early-booting config and setup is done so that I can send an email to the admins for post-build configuration. I'm hoping to avoid adding a systemd unit file just to send me nag emails after a new server is built.
0 Answers