Google Compute Engineでpostgresqlクックブックを使ってインストールしようとすると失敗する。
原因はapt-get update
の実行が抑制されていて、あらかじめapt-get update
を実行しておくとできる。
レシピファイルで何とかしたい場合は以下のようにする。
include_recipe 'postgresql::server'
execute('apt-get update').run_action(:run)
解説
クックブックをみていくとaptクックブックに定義されているexecute 'apt-get update'
の実行を抑制する処理が入っている。
if platform_family?('ubuntu', 'debian')
e = execute 'apt-get update' do
action :nothing
end
e.run_action(:run) unless ::File.exists?('/var/lib/apt/periodic/update-success-stamp')
end
/var/lib/apt/periodic/update-success-stamp
がある場合、無条件でapt-get update
が実行されなくなってしまっている。
自分のレシピファイルで再度上書きすることで対処している。