It seems the puppet apt module doesn’t runs apt-get update more than once even when you explicitly define it if you haven’t changes your sources.list. Because it thinks nothing has changed.
This is an issue we encountered with Tower Storm where we released new versions of private packages but our servers didn’t run apt-get update before trying to install them and so they’d try and fetch an old version and get a 404 error.
To fix it you simply need to add these lines to your manifest:
class { 'apt':
always_apt_update => true,
}
Then install your packages like so:
exec { 'apt-get-update':
command => '/usr/bin/apt-get update',
refreshonly => true,
}
$packages = ["nodejs", "npm"]
package {
$packages: ensure => installed,
require => Exec['apt-get-update'],
}
When your packages install they will first call apt-get update every time just to make sure they have the latest version.