service resource running always makes a corrective change

379 views
Skip to first unread message

Andy Hall

unread,
Nov 6, 2019, 6:02:33 AM11/6/19
to Puppet Users
Hey there - we have a server where part of the manifest is as follows:

  service { 'nfs':
    enable  
=> true,
   
ensure  => running,
 
}

Nice and simple however on every puppet run we get the following output which is recorded as a change:

[root@server ~]# puppet agent --test


Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Info: Loading facts
Info: Caching catalog for server
Info: Applying configuration version '1573029117'


Notice: /Stage[main]/Flex::Profiles::Archive::Server/Service[nfs]/ensure: ensure changed 'stopped' to 'running' (corrective)
Info: /Stage[main]/Flex::Profiles::Archive::Server/Service[nfs]: Unscheduling refresh on Service[nfs]


Notice: Applied catalog in 18.92 seconds


Could it be something to do with the fact that it is systemd ? This is CentOS 7:

[root@server ~]# service nfs status
Redirecting to /bin/systemctl status nfs.service
nfs-server.service - NFS server and services
   
Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; enabled; vendor preset: disabled)
 
Drop-In: /run/systemd/generator/nfs-server.service.d
           
└─order-with-mounts.conf
   
Active: active (exited) since Fri 2019-11-01 20:31:00 GMT; 4 days ago
 
Main PID: 28173 (code=exited, status=0/SUCCESS)
   
CGroup: /system.slice/nfs-server.service


Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.


[root@server ~]# systemctl cat nfs

# /usr/lib/systemd/system/nfs-server.service
[Unit]
Description=NFS server and services
DefaultDependencies=no
Requires= network.target proc-fs-nfsd.mount
Requires= nfs-mountd.service
Wants=rpcbind.socket network-online.target
Wants=rpc-statd.service nfs-idmapd.service
Wants=rpc-statd-notify.service


After= network-online.target local-fs.target
After= proc-fs-nfsd.mount rpcbind.socket nfs-mountd.service
After= nfs-idmapd.service rpc-statd.service
Before= rpc-statd-notify.service


# GSS services dependencies and ordering
Wants=auth-rpcgss-module.service
After=rpc-gssd.service gssproxy.service


Wants=nfs-config.service
After=nfs-config.service


[Service]
EnvironmentFile=-/run/sysconfig/nfs-utils


Type=oneshot
RemainAfterExit=yes
ExecStartPre=-/usr/sbin/exportfs -r
ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS
ExecStartPost=-/bin/sh -c 'if systemctl -q is-active gssproxy; then systemctl reload gssproxy ; fi'
ExecStop=/usr/sbin/rpc.nfsd 0
ExecStopPost=/usr/sbin/exportfs -au
ExecStopPost=/usr/sbin/exportfs -f


ExecReload=-/usr/sbin/exportfs -r


[Install]
WantedBy=multi-user.target


# /run/systemd/generator/nfs-server.service.d/order-with-mounts.conf
# Automatically generated by nfs-server-generator


[Unit]
RequiresMountsFor=/export/nfs/sl1-uat-permtest

Any thoughts on how this could be handled more gracefully ? Thanks very much.

Dirk Heinrichs

unread,
Nov 6, 2019, 6:24:24 AM11/6/19
to puppet...@googlegroups.com
Am Mittwoch, den 06.11.2019, 03:02 -0800 schrieb Andy Hall:

  service { 'nfs':
    enable  
=> true,
   
ensure  => running,
 
}

Nice and simple however on every puppet run we get the following output which is recorded as a change:

[root@server ~]# systemctl cat nfs

# /usr/lib/systemd/system/nfs-server.service

Name mismatch. Use "nfs-server" in your resource.

HTH...

Dirk
-- 
Dirk Heinrichs
Senior Systems Engineer, Delivery Pipeline
OpenText ™ Discovery | Recommind
Recommind GmbH, Von-Liebig-Straße 1, 53359 Rheinbach
Vertretungsberechtigte Geschäftsführer Gordon Davies, Madhu Ranganathan, Christian Waida, Registergericht Amtsgericht Bonn, Registernummer HRB 10646
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail sind nicht gestattet.

David Schmitt

unread,
Nov 6, 2019, 7:18:53 AM11/6/19
to Puppet Users
As far as I can tell from here, the process that's supposed to be running (rpc.nfsd) is not running and systemd therefore says the service is not running (Active: active (exited)). A running service would be Active: active (running) and showing the processes in the CGroup section.

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/5b3b2cde-db75-400d-85f9-2e9cbc995dc8%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages