Rex 你使用file,pkg 和服务函数
管理文件在远程机器上
选项
ensure -- 定义文件的状态,正确的参数是存在,不存在,目录
task "ftpfile", sub {
file "/tmp",
ensure => "present",
source => "a1.sh",
};
absent: 删除文件
present:创建文件
task "ftpfile", sub {
file "/tmp/a1.sh",
ensure => "present",
source => "a1.sh",
};
source - The local file that should be uploaded to the remote server.
应该上传到远端机器的本地文件
file "/etc/ntpd.conf",
ensure => "present",
source => "files/ntpd.conf",
owner => "root",
group => "root",
mode => 644,
on_change => sub {
service ntpd => "restart";
};