【问题标题】:Very simple Vagrant setup with either Chef or Puppet使用 Chef 或 Puppet 的非常简单的 Vagrant 设置
【发布时间】:2023-12-31 01:43:02
【问题描述】:
我正在尝试让一个非常基本的 Vagrant 设置正常工作,它基本上执行以下操作:
创建一个新的 Precise64 VM 并安装一个包列表(简单的东西——我只需要 git、python、pip、virtualenv、virtualenvwrapper 和 postgres)。让它运行一个简单的 shell 脚本也很好,但我不是绝对需要它。
我已经能够让 Vagrant 启动 Precise64 VM,但很难同时使用 Puppet 和 Chef 进行配置。 Puppet 或 Chef(哪个更容易)安装软件包(即运行 sudo apt-get install)的基本语法是什么?
【问题讨论】:
标签:
chef-infra
vagrant
puppet
chef-solo
【解决方案1】:
对于 puppet(来自 puppet docs),您可以对 Ubuntu 上的 openssh 包执行类似操作:
# /root/examples/ssh.pp
package { 'openssh-server':
ensure => present,
before => File['/etc/ssh/sshd_config'],
}
file { '/etc/ssh/sshd_config':
ensure => file,
mode => 600,
source => '/root/examples/sshd_config',
}
service { 'sshd':
ensure => running,
enable => true,
subscribe => File['/etc/ssh/sshd_config'],
}
你可以用这样的东西来测试它:
puppet apply --debug --noop /root/examples/ssh.pp