mitchellh/vagrant — Issue #586: Getting Started - Provisioning - Puppet config needs apt-get update
Author: jufo
Created: 2011-12-09 11:05:54+00:00
State: open

Using the Puppet manifest shown in the Provisioning part of the Getting Started guide gave these errors:

```
[default] err: /Stage[main]//Package[apache2]/ensure: change from purged to present failed: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install apache2' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
apache2-mpm-worker apache2-utils apache2.2-bin apache2.2-common libapr1
libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap ssl-cert
Suggested packages:
apache2-doc apache2-suexec apache2-suexec-custom
The following NEW packages will be installed:
apache2 apache2-mpm-worker apache2-utils apache2.2-bin apache2.2-common
libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap ssl-cert
0 upgraded, 10 newly installed, 0 to remove and 5 not upgraded.
Need to get 3076kB/3342kB of archives.
After this operation, 10.2MB of additional disk space will be used.
Err http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main apache2.2-bin 2.2.14-5ubuntu8.4
404 Not Found [IP: 91.189.92.180 80]
Err http://security.ubuntu.com/ubuntu/ lucid-security/main apache2.2-bin 2.2.14-5ubuntu8.4
404 Not Found [IP: 91.189.92.166 80]
Err http://security.ubuntu.com/ubuntu/ lucid-security/main apache2-utils 2.2.14-5ubuntu8.4
404 Not Found [IP: 91.189.92.166 80]
Err http://security.ubuntu.com/ubuntu/ lucid-security/main apache2.2-common 2.2.14-5ubuntu8.4
404 Not Found [IP: 91.189.92.166 80]
Err http://security.ubuntu.com/ubuntu/ lucid-security/main apache2-mpm-worker 2.2.14-5ubuntu8.4
404 Not Found [IP: 91.189.92.166 80]
Err http://security.ubuntu.com/ubuntu/ lucid-security/main apache2 2.2.14-5ubuntu8.4
404 Not Found [IP: 91.189.92.166 80]
Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/a/apache2/apache2.2-bin_2.2.14-5ubuntu8.4_i386.deb 404 Not Found [IP: 91.189.92.166 80]
Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/a/apache2/apache2-utils_2.2.14-5ubuntu8.4_i386.deb 404 Not Found [IP: 91.189.92.166 80]
Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/a/apache2/apache2.2-common_2.2.14-5ubuntu8.4_i386.deb 404 Not Found [IP: 91.189.92.166 80]
Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/a/apache2/apache2-mpm-worker_2.2.14-5ubuntu8.4_i386.deb 404 Not Found [IP: 91.189.92.166 80]
Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/a/apache2/apache2_2.2.14-5ubuntu8.4_i386.deb 404 Not Found [IP: 91.189.92.166 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
```

I couldn't find a generic (cross-platform) way of using Puppet to ensure that a package manager's lists are up to date, so I used an exec. I also created the puppet group, to stop Puppet complaining about that, and I copied the index.html file from /vagrant to /var/www.

This is the Puppet manifest I ended up with (in manifests/lucid32.pp):

```
group { 'puppet': ensure => 'present' }

exec { 'apt-get update':
command => '/usr/bin/apt-get update'
}

package { 'apache2':
ensure => present,
require => Exec['apt-get update']
}

service { 'apache2':
ensure => running,
require => Package['apache2']
}

File {
owner => 'root',
group => 'root',
mode => '0644'
}

file { 'index.html':
path => '/var/www/index.html',
source => '/vagrant/index.html',
require => Package['apache2']
}
```

Note that this is my first exposure to Puppet - there may be better ways of doing this.