Push message from Windows Agent to Unix (puppet Master)

92 views
Skip to first unread message

Harshita Sinha

unread,
Dec 19, 2013, 5:41:56 AM12/19/13
to puppet...@googlegroups.com, Harshita Sinha
Hi All,
I refered the link http://www.copperykeenclaws.com/setting-up-puppet-on-windows/#comment-1201 to make Windows Agent introduce to Unix Puppet master.
I have attached screenshot, but not sure if the connectivity has been established . As I got no error , I presume so.

I followed http://docs.puppetlabs.com/references/stable/type.html#file so that I make sure I have done the "site.pp" settings properly to push the file from windows to unix. Not sure if its fine, because I neither see the file copied nor I see any thing in log files.

I have attached screenshot to ensure that connectivity is done, and also the site.pp file that I run from the master.

Awaiting your reply, 

Many thanks,
Harshita
site.pp
connectivity-windows-unix-master-agent.png

Jeff Bachtel

unread,
Dec 19, 2013, 10:40:53 AM12/19/13
to puppet...@googlegroups.com, Harshita Sinha
Your default node definition does not define any resources. filebucket does not itself define a file, it defines a location where files are backed up to.

If you're just beginning with Puppet, then the method for using a filebucket to distribute file content is not something you really want to be doing.


Instead do something like:

From the command line:

echo -e "\n[harshita]\npath /root/harshita\nallow *" >> /etc/puppet/fileserver.conf
service puppetmaster restart

then add a resource to your default node definition such as

file { 'D:\Puppet\Anshita.txt':
  source => 'puppet:///harshita/Anshita.txt',
  mode   => '0644',
}

This will ensure the creation of D:\Puppet\Anshita.txt, sourced from /root/harshita/Anshita.txt . Note that the unix user puppet must have read access to that file and directory.

Jeff
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/e66dc07c-90cf-4e48-9bd8-56f3b1f74cdf%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Harshita Sinha

unread,
Dec 20, 2013, 12:55:46 AM12/20/13
to Jeff Bachtel, puppet...@googlegroups.com
Dear Jeff,

Thanks for your guidance.
Basically I want to achieve sending files from Windows to unix.
I make my local Windows machine as Windows Agent with (puppet enterprise 3.2.4 (Puppet Enterprise 3.0.1).
I use Puppetlabs provided machine VM, learn.localdomain which contains -puppet enterprise 3.2.4 (Puppet Enterprise 3.0.1-rc0-35-g3435b04)

I followed your steps above as you had guided in the email
step 1:  from unix puppet command line, echo -e "\n[harshita]\npath /root/harshita\nallow *" >> /etc/puppetlabs/puppet/fileserver.conf
step 2:  service pe-puppet restart (In unix VM)
step 3:  Added the code file { 'D:\Puppet\Anshita.txt':
  source => 'puppet:///harshita/Anshita.txt',   (But my doubt is that my source is windows location )
  mode   => '0644',

Should I not do the other way around like,
file { 'puppet:///harshita/Anshita.txt':
  source => ' D:\Puppet\Anshita.txt',   (Specifying Windows is my Source , the location from where I want to send Anshita.txt)
  mode   => '0644',


in site.pp . Am I correct ? I am doubtful here.

step 4: From Windows, I initiate Start -> ProgramFiles -> Puppet Enterprise -> Run Puppet Agent.

I get the error below attached in the screenshot.

Unix logs - > /var/log/pe-puppet , I checked here for logs , but nothing significant.
Windows logs - > C:\ProgramData\PuppetLabs\puppet\var\log , nothing significant .

Inline image 1

Your Guidance is important for me to proceed :)

Thanks and Regards,
Harshita
+91-9711099504
image.png

Harshita Sinha

unread,
Dec 20, 2013, 7:03:22 AM12/20/13
to Jeff Bachtel, puppet...@googlegroups.com, Harshita Sinha
Hi Jeff and All,
I also found one more thing regarding windows path, http://docs.puppetlabs.com/windows/writing.html
But since I am stuck with this issue https://mail.google.com/mail/u/0/?tab=wm#inbox/1430f65d503d0cde, I am not in a position to execute my manifest that I wanted to.
This is my manifest that I thought I could execute.

file { 'puppet:///harshita/Anshita.txt':
ensure => present,
mode => 0644,
source => 'D:/Puppet/Anshita.txt',
}

Pls guide me what I should do . Thanks. Your guidance can help me to proceed further from here.


Thanks and Regards,
Harshita
+91-9711099504


On Fri, Dec 20, 2013 at 11:23 AM, Harshita Sinha <hsin...@gmail.com> wrote:
Dear Jeff,

Thanks for your guidance.
Basically I want to achieve sending files from Windows to unix.
I make my local Windows machine as Windows Agent with (puppet enterprise 3.2.4 (Puppet Enterprise 3.0.1).
I use Puppetlabs provided machine VM, learn.localdomain which contains -puppet enterprise 3.2.4 (Puppet Enterprise 3.0.1-rc0-35-g3435b04)

I followed your steps above as you had guided in the email
step 1:  from unix puppet command line, echo -e "\n[harshita]\npath /root/harshita\nallow *" >> /etc/puppetlabs/puppet/fileserver.conf
step 2:  service pe-puppet restart (In unix VM)
step 3:  Added the code file { 'D:\Puppet\Anshita.txt':
  source => 'puppet:///harshita/Anshita.txt',   (But my doubt is that my source is windows location )
  mode   => '0644',

Should I not do the other way around like,
file { 'puppet:///harshita/Anshita.txt':
  source => ' D:\Puppet\Anshita.txt',   (Specifying Windows is my Source , the location from where I want to send Anshita.txt)
  mode   => '0644',


in site.pp . Am I correct ? I am doubtful here.

step 4: From Windows, I initiate Start -> ProgramFiles -> Puppet Enterprise -> Run Puppet Agent.

I get the error below attached in the screenshot.

Unix logs - > /var/log/pe-puppet , I checked here for logs , but nothing significant.
Windows logs - > C:\ProgramData\PuppetLabs\puppet\var\log , nothing significant .

Inline image 1

Your Guidance will be very much essential for me to proceed,
Thanks,
Harshita

Thanks and Regards,
Harshita
+91-9711099504
On Thu, Dec 19, 2013 at 9:10 PM, Jeff Bachtel <jbac...@bericotechnologies.com> wrote:
image.png

Jason Antman

unread,
Dec 20, 2013, 8:07:18 AM12/20/13
to puppet...@googlegroups.com
In short, "that's not how it works." Puppet isn't a backup system.

As to the File resource you have below... have you even read the documentation on the File type? And on puppet resources in general? The amount of information at docs.puppetlabs.com is absolutely amazing. If you plan on using puppet


 "source" is where the file is coming from, but the title/namevar (which you put as 'puppet:///harshita/Anshita.txt') is more or less meaningless. It's the resource name, like a variable name. Also, "puppet:///" is a file *source*. Puppet sends files from the master to the agents; aside from the filebucket (which is used for backing up files that puppet changes, and doesn't have user-set destinations) I'm not aware of any way to make it do that.

-jantman

Jeff Bachtel

unread,
Dec 20, 2013, 9:58:26 AM12/20/13
to Harshita Sinha, puppet...@googlegroups.com
(adding puppet-users@ back in case others have better information on handling filebuckets)


On 12/20/2013 12:53 AM, Harshita Sinha wrote:
Dear Jeff,

Thanks for your guidance.
Basically I want to achieve sending files from Windows to unix.

I missed "push the file from windows to unix" in your original email, my apologies.

In that case, I propose the following (reference http://docs.puppetlabs.com/references/latest/type.html#filebucket)

## site.pp

filebucket { 'main':
  path => false,
}

File { backup => 'main', }

node default {
  file { 'D:\Puppet\Anshita.txt':
    ensure => 'file',
  }
}


This should back up Anshita.txt IF there is a change. I don't know how it will work when the content isn't specified, but if filebucket will work for you at all in this, that will work. Now here is the problem: filebucket, being designed for large deployments, does not simply store the file in a directory on puppetmaster where it's easy to get to, but in /var/lib/puppet/bucket by md5 sum. To retrieve the file you will Instead need to use the puppet filebucket command as

find /var/lib/puppet/bucket/ -name paths | xargs grep Anshita.txt
to get the md5sum of the file, then
puppet filebucket restore /tmp/Anshita.txt (md5sum from previous)

Things to note:
You cannot specify path for the remote filebucket. This is an explicit limitation.
You must still have a file resource in the node definition for your Windows agent, or Puppet will be unaware of the file to back it up.
You do not need to specify your server in the filebucket statement unless it is different than your puppetmaster.
My command for finding the md5 of the file (find...xargs) is for Puppet community edition, not Puppet Enterprise.

Jeff

Harshita Sinha

unread,
Dec 20, 2013, 1:15:20 PM12/20/13
to Jeff Bachtel, puppet...@googlegroups.com

Thanks Jeff.
Just to confirm on terminologies,  is push different from copy ?
I want to copy file from windows D:/puppet/Anshita.txt to Unix in /root/Harshita.
My basic requirement is to copy the war and tar files from windows to Unix when the build is over in windows. Then when the tar is copied to Unix location I want to untar it.

Since I m new to puppet I was experimenting on file transfer . Once I m successful in my experiment I would explore more for automation.

Kindly suggest.
Many thanks
Harshita

Regards Harshita

Jeff Bachtel

unread,
Dec 20, 2013, 3:35:42 PM12/20/13
to Harshita Sinha, puppet...@googlegroups.com
I don't think filebucket/file is really the technique you want here. You might be able to do this with exported file resources, but you should instead consider using cygwin and ssh for this, called from the end of your build job. It will be a far simpler and more performant solution.

Jeff
Reply all
Reply to author
Forward
0 new messages