Hi,
I am newbie in puppet and just learning the things. I have created the
module to create users which is worked great. But I have created another
one for sysctl which doesn''t updated on agent server and as well on the
puppet master itself.
Working for users add:
========[root@puppet ~]# cat /etc/puppet/manifests/classes/users.pp
class users {
users::add { "testsudo":
username => ''testsudo'',
comment => ''Sudo Testing'',
shell => ''/bin/bash'',
password_hash =>
''$1$ULu2WAcE$k6/d5orSPRxsJWDhlvEEf.''
}
users::add { "testing":
username => ''testing'',
comment => ''Sudo Testing'',
shell => ''/bin/bash'',
password_hash =>
''$1$ULu2WAcE$k6/d5orSPRxsJWDhlvEEf.''
}
}
define users::add($username, $comment, $shell, $password_hash) {
user { $username:
ensure => ''present'',
home => "/home/${username}",
comment => $comment,
shell => $shell,
managehome => ''true'',
password => $password_hash,
}
}
========
Not working sysctl:
========[root@puppet ~]# cat /etc/puppet/manifests/classes/sysctl.pp
class sysctl {
file { "/etc/sysctl.conf":
ensure => "present",
owner => "root",
group => "root",
mode => 0644,
}
}
define sysctl::settings ($ensure="present", $source="",
$content="") {
$sysctl_file = "/etc/sysctl.conf"
exec { "reload-sysctl-settings":
command => "/sbin/sysctl -p ${sysctl_file}",
require => File[$sysctl_file],
subscribe => [
File[$sysctl_file],
File["/etc/sysctl.conf"],
],
refreshonly => "true",
}
if $source {
file { $sysctl_file:
ensure => $ensure,
source => $source,
owner => "root",
group => "root",
mode => 0644,
notify => Exec["reload-sysctl-settings"],
}
}
if $content {
file { $sysctl_file:
ensure => $ensure,
content=> "${content}",
owner => "root",
group => "root",
mode => 0644,
notify => Exec["reload-sysctl-settings"],
}
}
}
define sysctl::lvs_direct_routing ($ensure="present") {
sysctl::settings { "lvs-direct-routing":
priority => $priority,
ensure => $ensure,
source =>
"puppet://puppet.domain.com/files/direct-routing.conf",
}
}
define sysctl::tcp_performance ($ensure="present") {
sysctl::settings { "tcp-performance":
priority => $priority,
ensure => $ensure,
source =>
"puppet://puppet.domain.com/files/performance.conf",
}
}
==========
site.pp file:
==========[root@puppet ~]# cat /etc/puppet/manifests/site.pp
import "classes/*"
node default {
include users
include sysctl
}
node test {
include users
include sysctl
}
node ''server.domain.co'' inherits test {
}
node ''shiva.domain2.co'' inherits test {
}
===========
If I run the command "puppetd --server puppet.domain.com --waitforcert 60
--test" from agent then it creates users but it doesn''t update
anything
about sysctl and even it doesn''t throw any errors too. Even I have
tried to
execute the command "puppet -tv" on puppet master itself which has the
same
issue.
May I know where I am mistaking with sysctl?
--
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+unsubscribe@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
When you specify "include sysctl" then Puppet includes the sysctl
class and
this class only ensures that the /etc/sysctl.conf file exists:
class sysctl {
file { "/etc/sysctl.conf":
ensure => "present",
owner => "root",
group => "root",
mode => 0644,
}
}
which it likely already does so Puppet does nothing. Your users class
calls some of your defined types so you see Puppet creating resources. I
expect you want to create some of your sysctl defined types in your sysctl
class as well.
You can supply --debug command-line option to see what Puppet is doing
under the hood.
- Keith
On 29 January 2013 06:05, <linuxhack2012@gmail.com> wrote:
> Hi,
>
> I am newbie in puppet and just learning the things. I have created the
> module to create users which is worked great. But I have created another
> one for sysctl which doesn''t updated on agent server and as well
on the
> puppet master itself.
>
> Working for users add:
>
> ========> [root@puppet ~]# cat /etc/puppet/manifests/classes/**users.pp
> class users {
> users::add { "testsudo":
> username => ''testsudo'',
> comment => ''Sudo Testing'',
> shell => ''/bin/bash'',
> password_hash =>
''$1$ULu2WAcE$k6/**d5orSPRxsJWDhlvEEf.''
> }
> users::add { "testing":
> username => ''testing'',
> comment => ''Sudo Testing'',
> shell => ''/bin/bash'',
> password_hash =>
''$1$ULu2WAcE$k6/**d5orSPRxsJWDhlvEEf.''
> }
>
> }
>
> define users::add($username, $comment, $shell, $password_hash) {
> user { $username:
> ensure => ''present'',
> home => "/home/${username}",
> comment => $comment,
> shell => $shell,
> managehome => ''true'',
> password => $password_hash,
> }
> }
> ========>
> Not working sysctl:
>
> ========> [root@puppet ~]# cat /etc/puppet/manifests/classes/**sysctl.pp
>
> class sysctl {
>
> file { "/etc/sysctl.conf":
>
> ensure => "present",
>
> owner => "root",
>
> group => "root",
>
> mode => 0644,
>
> }
>
> }
>
> define sysctl::settings ($ensure="present", $source="",
$content="") {
>
> $sysctl_file = "/etc/sysctl.conf"
>
> exec { "reload-sysctl-settings":
>
> command => "/sbin/sysctl -p ${sysctl_file}",
>
> require => File[$sysctl_file],
>
> subscribe => [
>
> File[$sysctl_file],
>
> File["/etc/sysctl.conf"],
>
> ],
>
> refreshonly => "true",
>
> }
>
> if $source {
>
> file { $sysctl_file:
>
> ensure => $ensure,
>
> source => $source,
>
> owner => "root",
>
> group => "root",
>
> mode => 0644,
>
> notify => Exec["reload-sysctl-settings"]**,
>
> }
>
> }
>
> if $content {
>
> file { $sysctl_file:
>
> ensure => $ensure,
>
> content=> "${content}",
>
> owner => "root",
>
> group => "root",
>
> mode => 0644,
>
> notify => Exec["reload-sysctl-settings"]**,
>
> }
>
> }
> }
> define sysctl::lvs_direct_routing ($ensure="present") {
> sysctl::settings { "lvs-direct-routing":
> priority => $priority,
> ensure => $ensure,
> source =>
"puppet://puppet.domain.com/**files/direct-routing.conf<http://puppet.domain.com/files/direct-routing.conf>
> ",
> }
> }
> define sysctl::tcp_performance ($ensure="present") {
> sysctl::settings { "tcp-performance":
> priority => $priority,
> ensure => $ensure,
> source =>
"puppet://puppet.domain.com/**files/performance.conf<http://puppet.domain.com/files/performance.conf>
> ",
> }
> }
> ==========>
> site.pp file:
>
> ==========> [root@puppet ~]# cat /etc/puppet/manifests/site.pp
> import "classes/*"
>
> node default {
> include users
> include sysctl
> }
>
> node test {
> include users
> include sysctl
> }
>
> node ''server.domain.co'' inherits test {
> }
>
> node ''shiva.domain2.co'' inherits test {
> }
> ===========>
> If I run the command "puppetd --server puppet.domain.com --waitforcert
60
> --test" from agent then it creates users but it doesn''t
update anything
> about sysctl and even it doesn''t throw any errors too. Even I have
tried to
> execute the command "puppet -tv" on puppet master itself which
has the same
> issue.
>
> May I know where I am mistaking with sysctl?
>
> --
> 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+unsubscribe@googlegroups.com.
> To post to this group, send email to puppet-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/puppet-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
--
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+unsubscribe@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
Hi,
Somehow I got it working with the below config,
cat /etc/puppet/manifests/classes/sysctl.pp
=======class sysctl::config {
Class[''sysctl::config''] -> Sysctl::Entry <| |>
file { ''/etc/sysctl.conf'':
ensure => present,
mode => ''0644'',
owner => ''root'',
group => ''root'',
}
}
define sysctl::entry (
$value = false
) {
# Parameter validation
if ! $value {
fail(''sysctl::entry: value parameter must not be empty'')
}
augeas { "sysctl_${name}":
context => ''/files/etc/sysctl.conf'',
changes => [ "set ${name} ${value}" ],
onlyif => "get ${name} != ${value}",
notify => Exec["sysctl_${name}"],
}
exec { "sysctl_${name}":
command => ''/sbin/sysctl -p'',
refreshonly => true,
}
}
===========
on site.pp
=========node test {
sysctl::entry { ''net.ipv4.tcp_syncookies'': value =>
''1'' }
sysctl::entry { ''net.ipv4.tcp_syn_retries'': value =>
''3'' }
}
=========
But I want to pass the commented lines for each of the sysctl parameters so
is it possible to achieve with the above way?
--
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+unsubscribe@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
Hi, I find another one method but it doesn''t work :( https://redmine.koumbit.net/projects/puppet-sysctl/repository/diff?rev=80ca84b00e9942e33f18444150ff70e3b4d792fb&type=inline Would it be possible to make this work? -- 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+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.