using puppet to import keys

2,287 views
Skip to first unread message

Tim Dunphy

unread,
Feb 26, 2011, 9:55:23 PM2/26/11
to puppet...@googlegroups.com
hello list!

I am attempting to import some repo keys into my puppet clients with
the following lines in one of my manifests:

$commands = ["cd /etc/yum.repos.d/","wget
http://apt.sw.be/RPM-GPG-KEY.dag.txt","wget
http://rpms.famillecollet.com/RPM-GPG-KEY-remi","wget
http://download.fedora.redhat.com/pub/epel/RPM-GPG-KEY-EPEL","rpm
--import RPM-GPG-KEY.dag.txt","rpm --import RPM-GPG-KEY-remi","rpm
--import RPM-GPG-KEY-EPEL"]

$tidylist = ["/etc/yum.repos.d/RPM-GPG-KEY.dag.txt","/etc/yum.repos.d/RPM-GPG-KEY-remi","/etc/yum.repos.d/RPM-GPG-KEY-EPEL"]


exec { "repo keys":
command => $commands
}

tidy { "$tidylist":
age => '0s'
}

But when I do this I get the following result:

[root@LCENT02:~] #puppetd --test
info: Caching catalog for lcent02.summitnjhome.com
err: Could not run Puppet configuration client: 'cd /etc/yum.repos.d/'
is both unqualifed and specified no search path at
/etc/puppet/manifests/os/centos.pp:15

Can someone point me in the right direction to get this to work?

thanks!
tim
--
GPG me!!

gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B

Patrick

unread,
Feb 26, 2011, 10:31:47 PM2/26/11
to puppet...@googlegroups.com
1) What you are doing won't work because all exec commands are executed independently, not sequentially.  Because of this, the "cd" command would have no effect.  There's a "current_working_directory" parameter or something similar that will give you that effect.
2) Unless you manually set the path parameter, all commands must use the absolute path.  So "wget" should probably be "/usr/bin/wget".

Exec type reference:

3) Also, after you get that working, remember that if you don't use creates, onlyif, unless, or refreshonly is used.
4) At the very least, make sure you read the whole first paragraph of the exec type reference.  (The paragraph using the word "idempotent")

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To post to this group, send email to puppet...@googlegroups.com.
To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.


Reply all
Reply to author
Forward
0 new messages