我正在尝试使用Puppet和APT模块实现最新版本的varnish服务器,但是,我遇到了一些错误。我需要使用“--force-yes”。我该怎么做呢任何人都可以告诉我我可能做错了什么或给我一个例子。感谢
这是我到目前为止所做的。
class profile::varnish {
notify{'Provisioning varnish server': }
include apt
apt::key {'apt-key':
id => 'E98C6BBBA1CBC5C3EB2DF21C60E7C096C4DEFFEB',
source => 'https://repo.varnish-cache.org/GPG-key.txt'
}
apt::source {'varnish':
location => 'https://repo.varnish-cache.org/ubuntu/',
release => 'trusty',
repos => 'varnish-4.1',
require => Apt::Key['apt-key']
}
package {'varnish':
ensure => installed,
require => Apt::Source['varnish']
}
}
这是错误,我正在使用Puppet代理。
Error: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install varnish' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
gcc gcc-4.8 libasan0 libatomic1 libc-dev-bin libc6-dev libgcc-4.8-dev
libitm1 libjemalloc1 libquadmath0 libtsan0 libvarnishapi1 linux-libc-dev
manpages-dev
Suggested packages:
gcc-multilib make autoconf automake1.9 libtool flex bison gdb gcc-doc
gcc-4.8-multilib gcc-4.8-doc gcc-4.8-locales libgcc1-dbg libgomp1-dbg
libitm1-dbg libatomic1-dbg libasan0-dbg libtsan0-dbg libquadmath0-dbg
glibc-doc varnish-doc
The following NEW packages will be installed:
gcc gcc-4.8 libasan0 libatomic1 libc-dev-bin libc6-dev libgcc-4.8-dev
libitm1 libjemalloc1 libquadmath0 libtsan0 libvarnishapi1 linux-libc-dev
manpages-dev varnish
0 upgraded, 15 newly installed, 0 to remove and 2 not upgraded.
Need to get 585 kB/12.3 MB of archives.
After this operation, 43.4 MB of additional disk space will be used.
WARNING: The following packages cannot be authenticated!
libvarnishapi1 varnish
E: There are problems and -y was used without --force-yes
Error: /Stage[main]/Profile::Varnish/Package[varnish]/ensure: change from absent to present failed: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install varnish' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
gcc gcc-4.8 libasan0 libatomic1 libc-dev-bin libc6-dev libgcc-4.8-dev
libitm1 libjemalloc1 libquadmath0 libtsan0 libvarnishapi1 linux-libc-dev
manpages-dev
Suggested packages:
gcc-multilib make autoconf automake1.9 libtool flex bison gdb gcc-doc
gcc-4.8-multilib gcc-4.8-doc gcc-4.8-locales libgcc1-dbg libgomp1-dbg
libitm1-dbg libatomic1-dbg libasan0-dbg libtsan0-dbg libquadmath0-dbg
glibc-doc varnish-doc
The following NEW packages will be installed:
gcc gcc-4.8 libasan0 libatomic1 libc-dev-bin libc6-dev libgcc-4.8-dev
libitm1 libjemalloc1 libquadmath0 libtsan0 libvarnishapi1 linux-libc-dev
manpages-dev varnish
0 upgraded, 15 newly installed, 0 to remove and 2 not upgraded.
Need to get 585 kB/12.3 MB of archives.
After this operation, 43.4 MB of additional disk space will be used.
WARNING: The following packages cannot be authenticated!
libvarnishapi1 varnish
E: There are problems and -y was used without --force-yes
更新 那些想知道我是如何设法获得apt :: key ID的人,我使用了以下命令
gpg --with-fingerprint your-gpg-key.txt
您需要键指纹输出,不带空格。我以为我和你分享了这个,因为我需要一段时间才弄明白。
答案 0 :(得分:0)
不知道这是否是正确的方法,但是,我已经通过在profile :: varnish类中添加以下行来设法解决了这个问题。
exec { 'apt-update':
command => "/usr/bin/apt-get update",
logoutput => "on_failure",
path => "/usr/bin:/usr/sbin:/bin:/usr/local/bin:/usr/local/sbin:/sbin",
}
exec { 'apt-upgrade':
command => "/usr/bin/apt-get --quiet --yes --fix-broken upgrade",
logoutput => "on_failure",
path => "/usr/bin:/usr/sbin:/bin:/usr/local/bin:/usr/local/sbin:/sbin",
require => Exec['apt-update'],
}
答案 1 :(得分:0)
您也可以使用apt模块添加gpg密钥https://forge.puppetlabs.com/puppetlabs/apt#add-gpg-keys
apt::key { 'puppetlabs':
id => '47B320EB4C7C375AA9DAE1A01054B7A24BD6EC30',
server => 'pgp.mit.edu',
options => 'http-proxy="http://proxyuser:proxypass@example.org:3128"',
}