augeas services - add same service name on multiple ports/protocols
Hello,
I would like to use the augeas services lens within Puppet to add services with the same name but on different ports and/or protocols to /etc/services, like this example from the default services file:
systat 11/tcp users
systat 11/udp users
I can currently add a unique service as follows, but I need the onlyif clause for it to work, and that also prevents me from doing what I need:
augeas {"my-service-tcp":
incl => "/etc/services",
lens => "Services.lns",
changes => [
"ins service-name after service-name[last()]",
"set service-name[last()] 'my-service'",
"set service-name[. = 'my-service']/port 2200",
"set service-name[. = 'my-service']/protocol tcp",
],
onlyif => "match service-name[. ='my-service'] size ==0",
}
I'd like to add another service, also called 'my-service' but on say port 2250 or with udp instead of tcp.
How can this be done?
Thanks, Eric