Puppet

通過 puppet 模組的 PostgreSQL 9.5 無法在 Ubuntu Trusty 上安裝

  • April 25, 2016

嘗試使用 Puppet 在 Ubuntu Trusty 上安裝 PostgreSQL 9.5,使用我能找到的所有文件,具有以下簡單的類結構:

 class { 'postgresql::globals':
   manage_package_repo => true,
   version             => '9.5'
 }
 ->
 class { 'postgresql::server':
   ip_mask_allow_all_users => '0.0.0.0/0',
   listen_addresses        => '*',
   postgres_password       => '',
   encoding                => 'UTF-8',
   locale                  => 'en_US.UTF-8',
 }

我遇到以下致命錯誤:

==> default: Debug: Automatically imported postgresql::server::database_grant from postgresql/server/database_grant into production
==> default: Error: validate_re(): "B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8" does not match ["\\A(0x)?[0-9a-fA-F]{8}\\Z", "\\A(0x)?[0-9a-fA-F]{16}\\Z"] at /tmp/vagrant-puppet/modules-964288a1df1d89c6bf2b0015dc43c600/apt/manifests/key.pp:60 on node vagrant.local
==> default: Error: validate_re(): "B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8" does not match ["\\A(0x)?[0-9a-fA-F]{8}\\Z", "\\A(0x)?[0-9a-fA-F]{16}\\Z"] at /tmp/vagrant-puppet/modules-964288a1df1d89c6bf2b0015dc43c600/apt/manifests/key.pp:60 on node vagrant.local

我試過了

添加package_name => 'postgresql-9.5'::globals,無濟於事。

在絕望的行為中,甚至:

 exec {'Add postgresql 9.5 key':
   command => '/usr/bin/wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo /usr/bin/apt-key add -',
   user    => 'root'
 }
 ->
 exec {'Add postgresql 9.5 apt':
   command  => '/bin/echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" >> /etc/apt/sources.list.d/postgresql.list',
   user     => 'root'
 }
 ->
 exec {'apt-get update':
   command  => '/usr/bin/apt-get update',
   user     => 'root'
 }
 ->
 class { 'postgresql::globals':
 ...

我注意到這B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8對應於 postgresql 9.3:似乎某些內容沒有以正確的順序更新。

原來這是由於一個非常過時的apt木偶模組。

根據文件將模組更新為apt 2.2.2以匹配postgresql 4.7.1(我已經擁有)。

引用自:https://serverfault.com/questions/772861