exec in master transfer files to the node

205 views
Skip to first unread message

Nikolaos Hatzopoulos

unread,
Jul 30, 2012, 1:21:00 PM7/30/12
to puppet...@googlegroups.com
How you exec something in the master produce a file and
this files you transfer it to your node?

--Nikos

David Schmitt

unread,
Jul 31, 2012, 3:07:51 AM7/31/12
to puppet...@googlegroups.com
On 30.07.2012 19:21, Nikolaos Hatzopoulos wrote:
> How you exec something in the master produce a file and
> this files you transfer it to your node?

take a look at the template(), inline_template() and generate() function:

http://docs.puppetlabs.com/references/stable/function.html


Best Regards, David

Nikolaos Hatzopoulos

unread,
Jul 31, 2012, 2:09:35 PM7/31/12
to puppet...@googlegroups.com
        exec { "sshkeygen":
                path    => "/usr/bin:/usr/sbin:/bin",
                creates => [ "puppet:///myuser/files/$username/id_rsa" , "puppet:///myuser/files/$username/id_rsa.pub" ],
                command => generate("/bin/bash","/etc/puppet/manifests/myusers/sshkeygen.bash" )
        }


this command does not work!! why?

err: Could not retrieve catalog from remote server: wrong header line format
warning: Not using cache on failed catalog
err: Could not retrieve catalog; skipping run

--Nikos



--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.


David Schmitt

unread,
Aug 1, 2012, 3:28:38 AM8/1/12
to puppet...@googlegroups.com
On 31.07.2012 20:09, Nikolaos Hatzopoulos wrote:
> exec { "sshkeygen":
> path => "/usr/bin:/usr/sbin:/bin",
> creates => [ "puppet:///myuser/files/$username/id_rsa"
> , "puppet:///myuser/files/$username/id_rsa.pub" ],
> command =>
> generate("/bin/bash","/etc/puppet/manifests/myusers/sshkeygen.bash" )
> }
>
>
> this command does not work!! why?
>
> err: Could not retrieve catalog from remote server: wrong header line format
> warning: Not using cache on failed catalog
> err: Could not retrieve catalog; skipping run

At least the following things are wrong/do not work as you seem to
expect it:

* The generate() function is run on the master while compiling the
catalog.
* The exec then tries to execute the stdout of the script on the
client.
* The "creates" parameter avoids running the command when the
specified files exist. This only checks local files and not
puppet:/// urls.

Best Regards, David



Nikolaos Hatzopoulos

unread,
Aug 7, 2012, 11:36:03 AM8/7/12
to puppet...@googlegroups.com
I use this inside the class


generate("/bin/bash","/etc/puppet/manifests/myusers/sshkeygen.bash")

and I am generating a key inside the server but the permission of the folder
must be: user: puppet group: puppet

--Nikos





Best Regards, David



Reply all
Reply to author
Forward
0 new messages