使用 puppet 模块 puppetlabs/mysql 当我们无法选择安装与最新版本或其内部版本号不同的 MySQL 版本(8.0.19-1ubuntu18.04)时,我们遇到了问题(今天最新的是 8.0.20-1ubuntu18.04)请求的软件包存在于官方仓库中
回购配置:
apt::source { 'mysql':
location => 'http://repo.mysql.com/apt/ubuntu/',
release => $::lsbdistcodename,
repos => 'mysql-8.0',
key => {
id => 'A4A9406876FCBD3C456770C88C718D3B5072E1F5',
server => 'hkp://keyserver.ubuntu.com:80',
},
include => {
src => false,
deb => true,
},
}
Apt::Source['mysql'] ~> Class['apt::update'] -> Class['::mysql::server']
MySQL 声明清单:
$root_pw = 'Str0ng$q1P@$$'
class { '::mysql::server':
package_name => 'mysql-server',
package_ensure => '8.0.18-1ubuntu18.04',
root_password => $root_pw,
remove_default_accounts => false,
create_root_my_cnf => true,
}
错误信息:
Error: Could not update: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold --force-yes install mysql-server=8.0.18-1ubuntu18.04' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
W: --force-yes is deprecated, use one of the options starting with --allow instead.
E: Version '8.0.18-1ubuntu18.04' for 'mysql-server' was not found
Error: /Stage[main]/Mysql::Server::Install/Package[mysql-server]/ensure: change from 'purged' to '8.0.18-1ubuntu18.04' failed: Could not update: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold --force-yes install mysql-server=8.0.18-1ubuntu18.04' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
W: --force-yes is deprecated, use one of the options starting with --allow instead.
E: Version '8.0.18-1ubuntu18.04' for 'mysql-server' was not found