To anyone interested, this thread has been duplicated (and answered) on 
https://www.redhat.com/archives/augeas-devel/2013-May/msg00028.html

Raphaƫl


On Wednesday, May 29, 2013 4:35:30 PM UTC+2, kashif wrote:
>
>
> Hi
>
> I am trying to configure hosts.allow using augeas with puppet. I can add a 
> ip range if process exists with this code
>
>  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",
>
> but if a process doesn't exist then  I can't do it  dynamically, some 
> thing like this works 
>
> augeas { "Add ${name} - ${process}":
>    context => "/files/etc/hosts.allow",
>    changes => [ "set 02/process ${process}", "set 02/client[.='{$name}'] 
> ${name}" ],
>    onlyif  => "match *[process='${process}'] size == 0",
>   }
>
> But I have to provide node number (02 here) . The above code is mostly 
> based on 
> https://gist.github.com/rodjek/18c50d8800840696bac0 
>
> Can some one give a better option. What I want is that I can define 
> different process and ip range in node manifest file like this
>
> ssh::hosts_allow { [ '1.1.1.1', '2.2.2.2',  ]:
>        process => 'sshd',
>      
> ssh::hosts_allow { [ '3.3.3.3 ]:
>        process => 'nrpe',
>
> Thanks
> Kashif
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to