4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ansibleでのyum updateがGPG key errorでコケたときの解消法

Posted at

状況

vagrantで用意したcentos7環境に以下のようなansible playbookを流す。

- name: yum update
  yum:
    name: '*'
    state: latest

するとこんなエラーが発生。

warning: /var/cache/yum/x86_64/7Server/puppetlabs-pc1/packages/puppet-agent-1.7.0-1.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID ef8d349f: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puppetlabs-PC1


The GPG keys listed for the "Puppet Labs PC1 Repository el 7 - x86_64" repository are already installed but they are not correct for this package.
Check that the correct key URLs are configured for this repository.


 Failing package is: puppet-agent-1.7.0-1.el7.x86_64
 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puppetlabs-PC1

"Puppet Labs PC1 Repository el 7 - x86_64"は既に入ってるけどキーが違うよ的な?

解決方法

yumモジュールで問題のパッケージを先にinstallすればOKでした。
URLを直接指定することでインストールが可能です。

---
# rpmのインストールを追加
- name: install rpm
  yum: 
    name: https://yum.puppetlabs.com/puppetlabs-release-pc1-el-7.noarch.rpm 
- name: yum update
  yum:
    name: '*'
    state: latest

まとめ

yum updateからハマるとは。。。
ひとまずはansibleライフのはじまり!

参考

http://docs.ansible.com/ansible/latest/yum_module.html
http://qiita.com/dayflower/items/21c64a6f5da155a5ade3
http://qiita.com/teru855/items/cfe4b71bf1af14b9b05a

4
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?