Here is how to transfer files from puppet master to agent.
Reference
http://manuel.kiessling.net/2014/03/26/building-manageable-server-infrastructures-with-puppet-part-2/
There are one master and one agent in my environment.
192.168.11.12 puppet-master
192.168.11.13 puppet-agent01
puppet-master
# 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
|
agent
# 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
root@puppet-master:~#
|
You can define this directory in /etc/puppet/fileserver.conf
on the master
root@puppet-master:~# grep -v ^# /etc/puppet/fileserver.conf
[files]
path /etc/puppet/files
allow *
[plugins]
|
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:~#
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:~#
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 192.168.11.13 -> 192.168.11.12 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 192.168.11.12 -> 192.168.11.13 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 192.168.11.13 -> 192.168.11.12 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.