Puppet 推送文件测试


创建模块目录结构

[root@lost1 modules]# tree /etc/puppet/modules/
/etc/puppet/modules/
└── push
    ├── files
    │   └── puppet-test
    ├── manifests
    │   └── init.pp
    └── templates
4 directories, 2 files

编写 init.pp 文件

class push{
  package{ 'setup':
    ensure => present,
  }
  file{ '/data/test/puppet-test':
    ensure  => present,
    owner   => 'root',
    group   => 'root',
    mode    => '0644',
    source  => "puppet://$puppetserver/modules/push/puppet-test",
    require => Package['setup'],
  }
}

编写 site.pp

$puppetserver = 'lost1.com'
node 'lost1.com'{
  include  push
}
node 'lost2.com'{
  include  push
}
node 'lost3.com'{
  include  push
}

测试模块

[root@lost2 test]# puppet agent --test
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Caching catalog for lost2.com
Info: Applying configuration version '1456293592'
Notice: /Stage[main]/Push/File[/data/test/puppet-test]/ensure: defined content as '{md5}82700d4eb5d064cf23512045f29f2b38'
Notice: Finished catalog run in 0.26 seconds
[root@lost2 test]# 
[root@lost2 test]# cat puppet-test 
This is puppet test
[root@lost2 test]# 
分享:

评论