On Sep 19, 2011, at 7:20 PM, newguy wrote:
> Hi guys
> am running puppet clients as Ubuntu machines and am under a VPC, now
> the problem is that due to a bug in ubuntu (lets not get in to the bug
> details) I cant run apt-get update, upgrade remotely from the new VPC
> puppet client but I can connect to my puppetmaster(I have a script
> which takes care of that when a new system comes up), so what am
> looking for is that when I connect to puppetmaster only one module
> (ex: source.list) is pushed to the client which would allow me to
> change source.list file and hence I can do update/ upgrade and then
> client connects again to master to get all other modules(the
> connecting again part is already there).
>
> Is there a way to do it?
----
Of course there''s a way to do that... this is how I handle it.
# cat manifests/nodes.pp
# Note: this is what is installed on the first pass for a new puppet client
node default {
include apt
... irrelevant snip ...
}
----
# cat modules/apt/manifests/apt.pp
class apt {
include apt::updates
package { "apt":
ensure => installed,
}
# Puppet maintained file /etc/apt/sources.list
file{"/etc/apt/sources.list":
ensure => present,
owner => root,
group => root,
mode => 0444,
content => template("apt/sources.list.erb"),
require => Package["apt"],
notify =>
File["/etc/puppet/deployment_files/apt_update_initiator"],
}
}
----
# cat modules/apt/templates/sources.list.erb
# This file is managed by puppet
#
# MANUAL EDITS OF THIS FILE WILL BE OVERWRITTEN!
#
deb http://archive.ubuntu.com/ubuntu/ <%= lsbdistcodename %> main
restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ <%= lsbdistcodename %> main
restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ <%= lsbdistcodename %>-updates main
restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ <%= lsbdistcodename %>-updates
main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu <%= lsbdistcodename %>-security main
restricted universe multiverse
deb-src http://security.ubuntu.com/ubuntu <%= lsbdistcodename %>-security
main restricted universe multiverse
#
deb http://archive.canonical.com/ <%= lsbdistcodename %> partner
deb-src http://archive.canonical.com/ <%= lsbdistcodename %> partner
----
# cat modules/apt/manifests/apt_updates.pp
# apt::updates class
#
# Last update 07/20/2011
#
# Craig White
#
# Maintains puppet deployment files & executes apt updates/upgrades
#
# Causes clients to ''apt update'', ''aptitude
safe_upgrade'' or ''aptitude full_upgrade''
# merely by changing the appropriate file. On the client machine, this file is
# in /etc/puppet/deployment_files directory.
#
# On the puppet master, the files that can be twiddled are in
/etc/puppet/modules/apt/files
#
# I have been executing the ''date'' command. Example...
#
# date > /etc/puppet/modules/apt/files/apt_update_initiator which will cause
all puppet
# client systems to run ''apt-get update'' at their next cycle.
The plan is to implement
# a cron script that does this automatically each day.
#
class apt::updates {
include mod_puppet::deployment_files
# Puppet maintained file /etc/puppet/deployment_files/apt_update_initiator
file { "/etc/puppet/deployment_files/apt_update_initiator":
source => "puppet:///modules/apt/apt_update_initiator",
require => Class["mod_puppet::deployment_files"],
ensure => present,
owner => root,
group => root,
mode => 0644,
}
exec { "/usr/bin/aptitude update":
refreshonly => true,
subscribe =>
File["/etc/puppet/deployment_files/apt_update_initiator"],
}
# Puppet maintained file
/etc/puppet/deployment_files/apt_safe_upgrade_initiator
file { "/etc/puppet/deployment_files//apt_safe_upgrade_initiator":
source =>
"puppet:///modules/apt/apt_safe_upgrade_initiator",
require => [ Class["mod_puppet::deployment_files"],
Exec["/usr/bin/aptitude update"] ],
ensure => present,
owner => root,
group => root,
mode => 0644,
}
exec { "/usr/bin/aptitude -y safe-upgrade":
refreshonly => true,
subscribe =>
File["/etc/puppet/deployment_files/apt_safe_upgrade_initiator"],
}
# Puppet maintained file
/etc/puppet/deployment_files/apt_full_upgrade_initiator
file { "/etc/puppet/deployment_files/apt_full_upgrade_initiator":
source =>
"puppet:///modules/apt/apt_full_upgrade_initiator",
require => [ Class["mod_puppet::deployment_files"],
Exec["/usr/bin/aptitude update"] ],
ensure => present,
owner => root,
group => root,
mode => 0644,
}
exec { "/usr/bin/aptitude -y full-upgrade":
refreshonly => true,
subscribe =>
File["/etc/puppet/deployment_files/apt_full_upgrade_initiator"],
}
}
----
Craig
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.