[Puppet Users] Re: How can we add multiple lines to a file ?

2014-08-12 Thread Sijis Aviles


On Tuesday, August 12, 2014 1:57:14 AM UTC-5, Vikas Kumar wrote:
>
> Hello,
>
> I am looking for an option to add multiple lines to a */etc/bashrc* and 
> */etc/profile*. I can do this with *file_line*, but is there any other 
> alternative. *file_line* does the job but for each line I will have to 
> create a *file_line* resource, which does not sound good for multiple 
> lines.
>
> Regards,
> Vikas
>

Vikas,

Maybe try using concat module 
(https://github.com/puppetlabs/puppetlabs-concat)? But i think you'll still 
have multiple concat::fragment entries.

Sijis

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/72ec07d4-2f78-4889-94d4-938d331d324c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Disable firewall using puppetlabs firewall module

2014-08-12 Thread Sijis Aviles
Hi,

I'm trying to setup the firewall module to be disabled on certain nodes 
(for testing). However, when even if i set the following:

class { 'firewall': ensure => stopped, }

The firewall is still running on centos 6.5 and is sometimes stopped on 
centos 7.0.

I've also noticed that the firewall rules keep changing between runs (which 
i think is some of the problem).

Below is the sample code i've got going:


manifests/site.pp
--
resources
{ "firewall": purge => true, }
Firewall
{ before => Class['test::post'], require => Class['test::pre'], }
modules/test/manifests/pre.pp
--
class test::pre {
Firewall
{ require => undef, }
# Default firewall rules
firewall { '000 accept all icmp': proto => 'icmp', action => 'accept', }
}
modules/test/manifests/post.pp
--
class test::post {
firewall
{ '999 drop all': proto => 'all', action => 'drop', before => undef, }
}
manifests/nodes/test.pp
--
node ... {
class
{ 'firewall': ensure => stopped, }
class
{ 'test::pre': }
class
{ 'test::post': }
class
{ 'ssh': }
}
modules/ssh/manifests/init.pp

class ssh
{ include ssh::server }
modules/ssh/manifests/server.pp

class ssh::server (
..
){
firewall
{ '100 allow ssh': chain => 'INPUT', state => ['NEW', 'ESTABLISHED'], dport 
=> '22', proto => 'tcp', action => 'accept', }
...
}

=
OUTPUT
=
First Run
-
Notice: /Stage[main]/Test::Pre/Firewall[000 accept all icmp]/ensure: created
Notice: /Stage[main]/Firewall::Linux::Redhat/Service[iptables]/ensure: 
ensure changed 'running' to 'stopped'
Notice: /Stage[main]/Ssh::Server/Firewall[100 allow ssh]/ensure: created
Notice: /Stage[main]/Test::Post/Firewall[999 drop all]/ensure: created
Notice: Finished catalog run in 2.57 seconds

Second Run
-
Notice: /Stage[main]/Test::Pre/Firewall[000 accept all icmp]/ensure: created
Notice: /Stage[main]/Firewall::Linux::Redhat/Service[iptables]/ensure: 
ensure changed 'running' to 'stopped'
Notice: Finished catalog run in 2.38 seconds

Third Run

See First Run ...
(loops)


As a side note, i poked/hacked through the ruby code in the module and i 
was seeing this difference between centos 7.0 and centos 6.5. It seems that 
the 'proto', 'icmp' stuff isn't parsed correctly??

centos 6.5 output:
-
Debug: (provider=iptables): sijis/@property_hash #B: 
protoicmpactionacceptensurepresentline-A INPUT -p icmp -m comment --comment 
"000 accept all icmp" -j ACCEPT chainINPUTname000 accept all 
icmptablefilterprovideriptables

centos 7.0.1406
-
Debug: (provider=iptables): sijis/@property_hash #B: {:name=>"000 accept 
all icmp", :proto=>"icmp", :chain=>"INPUT", :line=>"-A INPUT -p icmp -m 
comment --comment \"000 accept all icmp\" -j ACCEPT", 
:provider=>"iptables", :table=>"filter", :ensure=>:present, 
:action=>"accept"}

I added this line "debug 'sijis/@property_hash #B: %s' % 
@property_hash.to_s" to 
https://github.com/puppetlabs/puppetlabs-firewall/blob/master/lib/puppet/provider/firewall/iptables.rb#L123-L127

I'd appreciate any feedback.

Thanks

Sijis

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/ab3e3a43-07d0-4489-bc66-b0cbcd8849ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.