what about importing the key beforehand
rpm --import keyfile
That's what I do. But when I try to install a package from that (passenger) repository manually, yum wants my confirmation:
# curl --fail -sSLo /etc/yum.repos.d/passenger.repo https://oss-binaries.phusionpassenger.com/yum/definitions/el-passenger.repo
# grep gpgkey /etc/yum.repos.d/passenger.repo gpgkey=https://packagecloud.io/gpg.key gpgkey=https://packagecloud.io/gpg.key
# rpm --import 'https://packagecloud.io/gpg.key'
# yum install passenger Loaded plugins: fastestmirror passenger/7/x86_64/signature | 836 B 00:00:00 Retrieving key from https://packagecloud.io/gpg.key Importing GPG key 0xD59097AB: Userid : "packagecloud ops (production key) ops@packagecloud.io" Fingerprint: 418a 7f2f b0e1 e6e7 eabf 6fe8 c2e7 3424 d590 97ab From : https://packagecloud.io/gpg.key
When I do it from a script, it fails.
Regards, Yuri