config.pp not working as expected

35 views
Skip to first unread message

John

unread,
Jan 16, 2014, 11:30:10 AM1/16/14
to puppet...@googlegroups.com
I've got the following code in my config.pp file on a FreeBSD 8.3 host:

freebsd# more config.pp ;
class ssh::config {
  include ssh::params
  $listenaddress = $ssh::params::listenaddress
  file { $ssh::params::sshd_config_file:
    ensure => present,
    owner => 'root',
    group => 'root',
    mode => '0600',
    content => template('ssh/sshd_config.erb'),
  }
  file { $ssh::params::ssh_config_file:
    ensure => present,
    owner => 'root',
    group => 'root',
    mode => '0644',
    content => template('ssh/ssh_config.erb'),
  }
}

I want to test that puppet will put back a configuration so I remove the contents of /etc/ssh_config file ( echo "" > /etc/ssh_config).  I would expect the puppet SSH module I'm using to restore the file contents.  It does not.  Furthermore, I believe it thinks I'm running this on a  linux host.

Check out the following and please advice.

[root@freebsd ~]# puppet apply --verbose --debug --noop /usr/local/etc/puppet/modules/ssh/manifests/init.pp
debug: Creating default schedules
debug: Failed to load library 'selinux' for feature 'selinux'
debug: Failed to load library 'shadow' for feature 'libshadow'
debug: Puppet::Type::User::ProviderUser_role_add: file roledel does not exist
debug: Puppet::Type::User::ProviderUseradd: file chage does not exist
debug: Failed to load library 'ldap' for feature 'ldap'
debug: Puppet::Type::User::ProviderLdap: feature ldap is missing
debug: Puppet::Type::User::ProviderDirectoryservice: file /usr/bin/dscl does not exist
debug: /File[/var/puppet/state]: Autorequiring File[/var/puppet]
debug: /File[/var/puppet/ssl/certs]: Autorequiring File[/var/puppet/ssl]
debug: /File[/var/puppet/state/graphs]: Autorequiring File[/var/puppet/state]
debug: /File[/var/puppet/state/last_run_report.yaml]: Autorequiring File[/var/puppet/state]
debug: /File[/var/puppet/facts]: Autorequiring File[/var/puppet]
debug: /File[/var/puppet/client_data]: Autorequiring File[/var/puppet]
debug: /File[/var/puppet/lib]: Autorequiring File[/var/puppet]
debug: /File[/var/puppet/log]: Autorequiring File[/var/puppet]
debug: /File[/var/puppet/ssl/certificate_requests]: Autorequiring File[/var/puppet/ssl]
debug: /File[/var/puppet/ssl/private_keys]: Autorequiring File[/var/puppet/ssl]
debug: /File[/var/puppet/ssl/public_keys]: Autorequiring File[/var/puppet/ssl]
debug: /File[/var/puppet/client_yaml]: Autorequiring File[/var/puppet]
debug: /File[/var/puppet/state/state.yaml]: Autorequiring File[/var/puppet/state]
debug: /File[/var/puppet/clientbucket]: Autorequiring File[/var/puppet]
debug: /File[/var/puppet/ssl/private]: Autorequiring File[/var/puppet/ssl]
debug: /File[/var/puppet/state/last_run_summary.yaml]: Autorequiring File[/var/puppet/state]
debug: /File[/var/puppet/ssl]: Autorequiring File[/var/puppet]
debug: Finishing transaction 17215411540
debug: Loaded state in 0.00 seconds
debug: Loaded state in 0.00 seconds
info: Applying configuration version '1389889969'
debug: /Schedule[daily]: Skipping device resources because running on a host
debug: /Schedule[monthly]: Skipping device resources because running on a host
debug: /Schedule[hourly]: Skipping device resources because running on a host
debug: /Schedule[never]: Skipping device resources because running on a host
debug: /Schedule[weekly]: Skipping device resources because running on a host
debug: /Schedule[puppet]: Skipping device resources because running on a host
debug: Finishing transaction 17214171820
debug: Storing state
debug: Stored state in 0.01 seconds
notice: Finished catalog run in 0.06 seconds
debug: Finishing transaction 17213963220
debug: Received report to process from freebsd.cde.vrsn.com
debug: Processing report from freebsd.cde.vrsn.com with processor Puppet::Reports::Store
[root@-freebsd ~]#

jcbollinger

unread,
Jan 17, 2014, 9:36:43 AM1/17/14
to puppet...@googlegroups.com


On Thursday, January 16, 2014 10:30:10 AM UTC-6, John wrote:
I've got the following code in my config.pp file on a FreeBSD 8.3 host:


You say "my config.pp file" as if we should know what file that is, where it is, and what its significance is.  In fact, we know none of those things.



freebsd# more config.pp ;
class ssh::config {
  include ssh::params
  $listenaddress = $ssh::params::listenaddress
  file { $ssh::params::sshd_config_file:
    ensure => present,
    owner => 'root',
    group => 'root',
    mode => '0600',
    content => template('ssh/sshd_config.erb'),
  }
  file { $ssh::params::ssh_config_file:
    ensure => present,
    owner => 'root',
    group => 'root',
    mode => '0644',
    content => template('ssh/ssh_config.erb'),
  }
}

I want to test that puppet will put back a configuration so I remove the contents of /etc/ssh_config file ( echo "" > /etc/ssh_config).  I would expect the puppet SSH module I'm using to restore the file contents.  It does not.


That is likely because you have not instructed Puppet to manage the file in question.

 
  Furthermore, I believe it thinks I'm running this on a  linux host.



I don't see why you say that.

 


In all likelihood, the manifest you are applying defines class "ssh" of a like-named module, but does not declare that any particular class should be applied to the target node.  You have given Puppet a cookbook, but not told it to cook anything.  (Moreover, you have told it (--noop) that whatever you might instruct it to cook, it should only pretend to cook it.)

Supposing that your Puppet is configured to have /usr/local/etc/puppet/modules as [part of] its module path, what you are looking for appears to be something more like this:

puppet apply --verbose --debug -e "include 'ssh'"


John

Reply all
Reply to author
Forward
0 new messages