[augeas-devel] augeas for hosts.allow
Raphaël Pinson
raphael.pinson at camptocamp.com
Thu May 30 13:15:14 UTC 2013
On Thu, May 30, 2013 at 3:12 PM, mohammad kashif <kashif.alig at gmail.com>wrote:
> Hi Raphael
>
> I know that it is not straight forward but is there any mechanism to
> remove a entry from a node.
>
> define ssh::hosts_allow($process,) {
>
> augeas { "Add ${name} - ${process}":
> context => "/files/etc/hosts.allow",
> changes => [ "set 01/process ${process}", "set 01/client[.='{$name}']
> ${name}" ],
> onlyif => "match *[process='${process}'] size == 0",
> }
>
>
> augeas { "Add ${name} to ${process}":
> context => "/files/etc/hosts.allow",
> changes => "set *[process='${process}']/client[last()+1] ${name}",
> onlyif => "match *[process='${process}']/client[.='${name}'] size ==
> 0",
> }
> }
>
> I pass parameters like this
> ssh::hosts_allow { [ '1.1.1.1', '2.2.2.2' ]:
> process => 'sshd',
>
>
> At some stage if I want to remove 1.1.1.1, there is no straight forward
> way to remove it from clients. A purge kind of thing. Any thought about it ?
>
>
You're reaching a complexity for which I would recommend writing a native
ruby provider instead of using Puppet code. See augeasproviders.com for
examples.
--
Raphaël Pinson
Développeur et Formateur Infrastructure
+33 479 926 57 93
Camptocamp France
Savoie Technolac
BP 352
48, avenue du Lac du Bourget
73372 Le Bourget du Lac, Cedex
www.camptocamp.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20130530/07524ef3/attachment.htm>
More information about the augeas-devel
mailing list