lost and found ( for me ? )

Ubuntu 14.04 puppet : transfer files from puppet master to agent

Here is how to transfer files from puppet master to agent.


There are one master and one agent in my environment. puppet-master puppet-agent01

# dpkg -l | grep puppet
ii  puppet-common                       3.4.3-1                       all          Centralized configuration management
ii  puppetmaster                        3.4.3-1                       all          Centralized configuration management - master startup and compatibility scripts
ii  puppetmaster-common                 3.4.3-1                       all          Puppet master common scripts

# dpkg -l puppet
ii  puppet         3.4.3-1      all          Centralized configuration managem

Assumes that you have installed the master and the agent.

on the master
/etc/puppet/files is a directory to transfer files to agents.
# ls /etc/puppet/files

You can define this directory in /etc/puppet/fileserver.conf
on the master
root@puppet-master:~# grep -v ^# /etc/puppet/fileserver.conf

 path /etc/puppet/files
 allow *


I added “allow *” in the [files] section to allow agents to get files
restart the master
root@puppet-master:~# /etc/init.d/puppetmaster restart
* Restarting puppet master                                              [ OK ]

create a file on the master
root@puppet-master:~# echo "hello world" > /etc/puppet/files/helloworld.txt
root@puppet-master:~# cat /etc/puppet/files/helloworld.txt
hello world

here is a manifest file.
on the master
root@puppet-master:~# cat /etc/puppet/manifests/site.pp
node "puppet-agent01" {
   file {"/root/helloworld.txt":
       ensure => file,
       owner => "root",
       group => "root",
       mode => 0644,
       source => "puppet://puppet-master/files/helloworld.txt"

on the agent
the agent got the file from the master.
root@puppet-agent01:~# puppet agent --verbose --no-daemonize --onetime
Info: Retrieving plugin
Info: Caching catalog for puppet-agent01.tcv.jp
Info: Applying configuration version '1410190960'
Notice: /Stage[main]/Main/Node[puppet-agent01]/File[/root/helloworld.txt]/ensure: defined content as '{md5}6f5902ac237024bdd0c176cb93063dc4'
Notice: Finished catalog run in 0.22 seconds

root@puppet-agent01:~# cat /root/helloworld.txt
hello world

the agent connected to the master over TCP dst 8140
root@puppet-master:~# tshark -n -r a.pcap -Y '(tcp.port == 8140)'
Running as user "root" and group "root". This could be dangerous.
 1 0.000000000 -> TCP 74 52861 > 8140 [SYN] Seq=0 Win=29200 Len=0 MSS=1460 SACK_PERM=1 TSval=1652154 TSecr=0 WS=128
 2 0.000039000 -> TCP 74 8140 > 52861 [SYN, ACK] Seq=0 Ack=1 Win=28960 Len=0 MSS=1460 SACK_PERM=1 TSval=1653573 TSecr=1652154 WS=128
 3 0.000433000 -> TCP 66 52861 > 8140 [ACK] Seq=1 Ack=1 Win=29312 Len=0 TSval=1652154 TSecr=1653573

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.