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, <[email protected]> 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 [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.
>
>
>
--
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.