apache - Vagrant 1.2.2 未运行 Puppet Manifest

标签 apache vagrant puppet

vagrant up 生成的虚拟机似乎工作正常。但我似乎无法让 vagrant 以最简单的配置向其中添加 apache (网络服务器)。我正在使用 puppet 。

我已确保vagrant destroy,然后vagrant up。在 vagrant ssh 上,apache 不存在(没有 apachectl,没有 httpd)。

详细信息如下:

环境:

bash-3.2$ vagrant --version
Vagrant version 1.2.2
bash-3.2$ uname -a
Darwin foo.com 12.3.0 Darwin Kernel Version 12.3.0: Sun Jan  6 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64 x86_64
bash-3.2$ 
bash-3.2$ pwd
/Users/bar/cbalz
bash-3.2$ ls -ail
total 24
1500058 drwxr-xr-x   7 bar  staff   238 Aug  6 16:27 .
 379691 drwxr-xr-x+ 37 bar  staff  1258 Aug  6 11:29 ..
1500065 drwxr-xr-x   3 bar  staff   102 Aug  6 11:23 .vagrant
1500631 -rw-r--r--   1 bar  staff  4948 Aug  6 16:25 Vagrantfile
1500619 -rw-r--r--   1 bar  staff    33 Aug  6 13:34 index.html
1500107 drwxr-xr-x   3 bar  staff   102 Aug  6 16:28 manifests
1500704 drwxr-xr-x   2 bar  staff    68 Aug  6 14:24 www
bash-3.2$ 

foo:cbalz bar$ ls -ail manifests
total 8
1500107 drwxr-xr-x  3 bar  staff  102 Aug  6 16:28 .
1500058 drwxr-xr-x  7 bar  staff  238 Aug  6 16:27 ..
1500806 -rw-r--r--  1 bar  staff  405 Aug  6 16:28 precise64.pp
foo:cbalz bar$

Vagrant 文件:

foo:cbalz bar$ more Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
# ...
config.vm.box = "precise64"
# ...
# Customization:
Vagrant::Config.run do |config|
  config.vm.box = "precise64"

  # Enable the Puppet provisioner
  config.vm.provision :puppet do |puppet|
     puppet.manifests_path = "/Users/bar/cbalz/manifests"
     puppet.manifest_file  = "precise64.pp"
     puppet.options = "--verbose --debug"
  end
end
# ...
end

Puppet list 文件:

foo:cbalz bar$ cat manifests/precise64.app 
# Basic Puppet Apache manifest

class apache {
  exec { 'apt-get update':
    command => '/usr/bin/apt-get update'
  }

  package { "apache2":
    ensure => present,
  }

  service { "apache2":
    ensure => running,
    require => Package["apache2"],
  }
  # ...
 }

设置:

$ vagrant destroy; vagrant up
Are you sure you want to destroy the 'default' VM? [y/N] y
[default] Forcing shutdown of VM...
[default] Destroying VM and associated drives...
Bringing machine 'default' up with 'virtualbox' provider...
[default] Importing base box 'precise64'...
[default] Matching MAC address for NAT networking...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[default] Fixed port collision for 22 => 2222. Now on port 2203.
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2203 (adapter 1)
[default] Booting VM...
[default] Waiting for VM to boot. This can take a few minutes.
[default] VM booted and ready for use!
[default] Configuring and enabling network interfaces...
[default] Mounting shared folders...
[default] -- /vagrant

运行:

$ vagrant ssh
Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic x86_64)

 * Documentation:  https://help.ubuntu.com/
Welcome to your Vagrant-built virtual machine.
Last login: Fri Sep 14 06:23:18 2012 from 10.0.2.2
;vagrant@precise64:~$ apachectl
The program 'apachectl' is currently not installed.  You can install it by typing:
sudo apt-get install apache2.2-common
vagrant@precise64:~$ httpd
No command 'httpd' found, did you mean:
 Command 'xttpd' from package 'xtide' (universe)
httpd: command not found
vagrant@precise64:~$ 

最佳答案

尝试删除

Vagrant::Config.run do |config| config.vm.box =“precise64”

来自 Vagrantfile,配置如下所示:

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
# ...
  config.vm.box = "precise64"

  # Enable the Puppet provisioner
  config.vm.provision :puppet do |puppet|
    puppet.manifests_path = "/Users/bar/cbalz/manifests"
    puppet.manifest_file  = "precise64.pp"
    puppet.options = "--verbose --debug"
  end
# ...
end

关于apache - Vagrant 1.2.2 未运行 Puppet Manifest,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18092456/

相关文章:

apache - 安装 LetsEncrypt 证书后 VirtualHost 导致 ERR_TOO_MANY_REDIRECTS

apache - 限制Apache2中的并发连接数

php - WAMPserver - 为什么堆栈安装了 2 个 php.ini 文件?

mysql - 使用 vagrant 导入数据库 mysql。没有这样的文件或目录

ubuntu - Nginx:Ubuntu 上的 nginx 权限被拒绝

puppet - 使用 Puppet 配置 ulimit

php - 如何使用 url 重写将 url 重定向到父目录

vagrant - vagrant 中的同步文件夹未实时同步

xml - 如何在 puppet 中使用 augeas 创建格式良好的 xml?

docker - Puppet 中的 SSL 证书验证失败