Skip to content

Instantly share code, notes, and snippets.

@zipkid
Created May 31, 2012 08:30
Show Gist options
  • Save zipkid/2841913 to your computer and use it in GitHub Desktop.
Save zipkid/2841913 to your computer and use it in GitHub Desktop.
puppet audited resource report
[root@pm1 puppet]# puppet agent -t
info: Retrieving plugin
info: Loading facts in /etc/puppet-modules/puppet/lib/facter/facter_dot_d.rb
info: Loading facts in /etc/puppet-modules/puppet/lib/facter/puppet_vardir.rb
info: Loading facts in /etc/puppet-modules/puppet/lib/facter/root_home.rb
info: Loading facts in /var/lib/puppet/lib/facter/puppet_vardir.rb
info: Loading facts in /var/lib/puppet/lib/facter/root_home.rb
info: Loading facts in /var/lib/puppet/lib/facter/facter_dot_d.rb
info: Caching catalog for pm1.lan.super-visions.com
info: Applying configuration version '1338452803'
notice: /Stage[main]/Puppet::Config/File[puppet.conf]/owner: owner changed 'vagrant' to 'root'
notice: /Stage[main]/Puppet::Config/File[puppet.conf]/group: group changed 'vagrant' to 'root'
notice: Finished catalog run in 1.14 seconds
[root@pm1 puppet]# puppet inspect
notice: Finished inspection in 0.97 seconds
[root@pm1 puppet]# puppet agent -t --noop
info: Retrieving plugin
info: Loading facts in /etc/puppet-modules/puppet/lib/facter/facter_dot_d.rb
info: Loading facts in /etc/puppet-modules/puppet/lib/facter/puppet_vardir.rb
info: Loading facts in /etc/puppet-modules/puppet/lib/facter/root_home.rb
info: Loading facts in /var/lib/puppet/lib/facter/puppet_vardir.rb
info: Loading facts in /var/lib/puppet/lib/facter/root_home.rb
info: Loading facts in /var/lib/puppet/lib/facter/facter_dot_d.rb
info: Caching catalog for pm1.lan.super-visions.com
info: Applying configuration version '1338452803'
notice: /Stage[main]/Puppet::Config/File[puppet.conf]/owner: current_value vagrant, should be root (noop)
notice: /Stage[main]/Puppet::Config/File[puppet.conf]/group: current_value vagrant, should be root (noop)
notice: Class[Puppet::Config]: Would have triggered 'refresh' from 2 events
notice: Stage[main]: Would have triggered 'refresh' from 1 events
notice: Finished catalog run in 1.11 seconds
[root@pm1 puppet]# puppet inspect
notice: Finished inspection in 1.03 seconds
[root@pm1 puppet]# puppet agent -t
info: Retrieving plugin
info: Loading facts in /etc/puppet-modules/puppet/lib/facter/facter_dot_d.rb
info: Loading facts in /etc/puppet-modules/puppet/lib/facter/puppet_vardir.rb
info: Loading facts in /etc/puppet-modules/puppet/lib/facter/root_home.rb
info: Loading facts in /var/lib/puppet/lib/facter/puppet_vardir.rb
info: Loading facts in /var/lib/puppet/lib/facter/root_home.rb
info: Loading facts in /var/lib/puppet/lib/facter/facter_dot_d.rb
info: Caching catalog for pm1.lan.super-visions.com
info: Applying configuration version '1338453479'
notice: /Stage[main]/Puppet::Config/File[test-puppet.conf]/ensure: created
notice: /Stage[main]/Puppet::Config/File[test-puppet.conf]/owner: audit change: newly-recorded value absent
notice: /Stage[main]/Puppet::Config/File[test-puppet.conf]/group: audit change: newly-recorded value absent
notice: /Stage[main]/Puppet::Config/File[test-puppet.conf]/mode: audit change: newly-recorded value absent
notice: /Stage[main]/Puppet::Config/File[puppet.conf]/owner: owner changed 'vagrant' to 'root'
notice: /Stage[main]/Puppet::Config/File[puppet.conf]/group: group changed 'vagrant' to 'root'
notice: Finished catalog run in 1.17 seconds
[root@pm1 puppet]# puppet agent -t
info: Retrieving plugin
info: Loading facts in /etc/puppet-modules/puppet/lib/facter/facter_dot_d.rb
info: Loading facts in /etc/puppet-modules/puppet/lib/facter/puppet_vardir.rb
info: Loading facts in /etc/puppet-modules/puppet/lib/facter/root_home.rb
info: Loading facts in /var/lib/puppet/lib/facter/puppet_vardir.rb
info: Loading facts in /var/lib/puppet/lib/facter/root_home.rb
info: Loading facts in /var/lib/puppet/lib/facter/facter_dot_d.rb
info: Caching catalog for pm1.lan.super-visions.com
info: Applying configuration version '1338453479'
notice: /Stage[main]/Puppet::Config/File[test-puppet.conf]/owner: owner changed 'vagrant' to 'root' (previously recorded value was absent)
notice: /Stage[main]/Puppet::Config/File[test-puppet.conf]/group: group changed 'vagrant' to 'root' (previously recorded value was absent)
err: /Stage[main]/Puppet::Config/File[test-puppet.conf]: Could not evaluate: undefined method `rjust' for :absent:Symbol
notice: /Stage[main]/Puppet::Config/File[puppet.conf]/owner: owner changed 'vagrant' to 'root'
notice: /Stage[main]/Puppet::Config/File[puppet.conf]/group: group changed 'vagrant' to 'root'
notice: Finished catalog run in 1.08 seconds
[root@pm1 puppet]# puppet agent -t
info: Retrieving plugin
info: Loading facts in /etc/puppet-modules/puppet/lib/facter/facter_dot_d.rb
info: Loading facts in /etc/puppet-modules/puppet/lib/facter/puppet_vardir.rb
info: Loading facts in /etc/puppet-modules/puppet/lib/facter/root_home.rb
info: Loading facts in /var/lib/puppet/lib/facter/puppet_vardir.rb
info: Loading facts in /var/lib/puppet/lib/facter/root_home.rb
info: Loading facts in /var/lib/puppet/lib/facter/facter_dot_d.rb
info: Caching catalog for pm1.lan.super-visions.com
info: Applying configuration version '1338453479'
notice: /Stage[main]/Puppet::Config/File[test-puppet.conf]/owner: owner changed 'vagrant' to 'root'
notice: /Stage[main]/Puppet::Config/File[test-puppet.conf]/group: group changed 'vagrant' to 'root'
notice: /Stage[main]/Puppet::Config/File[puppet.conf]/owner: owner changed 'vagrant' to 'root'
notice: /Stage[main]/Puppet::Config/File[puppet.conf]/group: group changed 'vagrant' to 'root'
notice: Finished catalog run in 1.14 seconds
"File[puppet.conf]": !ruby/object:Puppet::Resource::Status
change_count: 2
changed: true
evaluation_time: 0.006097
events:
- !ruby/object:Puppet::Transaction::Event
audited: true
desired_value: 0
historical_value: 500
message: *id005
name: !ruby/sym owner_changed
previous_value: 500
property: owner
status: success
time: 2012-05-31 08:26:49.027303 +00:00
- !ruby/object:Puppet::Transaction::Event
audited: true
desired_value: 0
historical_value: 500
message: *id006
name: !ruby/sym group_changed
previous_value: 500
property: group
status: success
time: 2012-05-31 08:26:49.029113 +00:00
failed: false
file: *id001
line: 20
out_of_sync: true
out_of_sync_count: 2
resource: "File[puppet.conf]"
resource_type: File
skipped: false
tags:
- file
- puppet.conf
- class
- puppet::config
- puppet
- config
- puppet::agent
- agent
- common
- node
- pm1
time: 2012-05-31 08:26:49.025024 +00:00
title: puppet.conf
@zipkid
Copy link
Author

zipkid commented May 31, 2012

config.pp

class puppet::config
{
$puppet_user = hiera('puppet_user')
$puppet_group = hiera('puppet_group')
$puppet_config_dir = hiera('puppet_config_dir')
$puppet_server_fqdn = hiera('puppet_server_fqdn', 'UNDEFINED')
$dashboard_report_server = hiera('dashboard_report_server', 'UNDEFINED')

@file { 'puppet.conf':
path => "${puppet_config_dir}/puppet.conf",
ensure => present,
content => template("${module_name}/agent/puppet.conf.erb"),
owner => $puppet_user,
group => $puppet_group,
mode => '0644',
audit => [owner, group, mode],

}

file { 'test-puppet.conf':
path => "${puppet_config_dir}/test-puppet.conf",
ensure => present,
content => template("${module_name}/agent/puppet.conf.erb"),
owner => $puppet_user,
group => $puppet_group,
mode => '0644',
audit => [owner, group, mode],
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment