Vagrant安装与木偶的码头工人

时间:2017-06-06 10:02:01

标签: docker vagrant puppet

我正在尝试在 trusty64 流浪者图片上安装docker:

Vagrantfile

# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
  config.vm.box = "ubuntu/trusty64"
  config.vm.hostname = "apps.local"
  config.vm.provision "shell", inline: <<-SHELL
    puppet module install garethr-docker
  SHELL

  config.vm.provision "puppet"
end

表现/ default.pp

include 'docker'

docker::image { 'ubuntu':
  image_tag => 'trusty'
}

vagrant up的输出:

==> default: Running provisioner: shell...
    default: Running: inline script
==> default: Notice: Preparing to install into /etc/puppet/modules ...
==> default: Notice: Downloading from https://forge.puppetlabs.com ...
==> default: Notice: Installing -- do not interrupt ...
==> default: /etc/puppet/modules
==> default: └─┬ garethr-docker (v5.3.0)
==> default:   ├── puppetlabs-apt (v3.0.0)
==> default:   ├── puppetlabs-stdlib (v4.17.0)
==> default:   └── stahnma-epel (v1.2.2)
==> default: Running provisioner: puppet...
==> default: Running Puppet with default.pp...
==> default: Warning: Config file /etc/puppet/hiera.yaml not found, using Hiera defaults
==> default: Error: Syntax error at 'Variant'; expected ')' at /etc/puppet/modules/apt/manifests/init.pp:6 on node carcosa.local
==> default: Error: Syntax error at 'Variant'; expected ')' at /etc/puppet/modules/apt/manifests/init.pp:6 on node carcosa.local
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

有人能告诉我我做错了什么吗?

2 个答案:

答案 0 :(得分:4)

puppetlabs-apt module的最新版本仅支持最新版本的puppet

Latest version is compatible with:
 - Puppet Enterprise 2016.5.x, 2016.4.x
 - Puppet >= 4.7.0 < 5.0.0
 - Ubuntu, Debian

如果你想在你的例子中工作,你需要强制安装puppet 3.x支持的版本(见https://forge.puppet.com/puppetlabs/apt/1.6.0/changelog

以下Vagrantfile将完成工作

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

Vagrant.configure("2") do |config|
  config.vm.box = "ubuntu/trusty64"
  #config.vm.provision "docker"

  config.vm.hostname = "apps.local"
  config.vm.provision "shell", inline: <<-SHELL
    puppet module install puppetlabs-apt --version 2.4.0
    puppet module install garethr-docker
  SHELL

  config.vm.provision "puppet"
end

答案 1 :(得分:3)

如果您的目标只是在VM上安装docker,最简单的方法就是让vagrant安装它。 Vagrant有docker provisioner,如果没有安装,它会尝试安装

这个简单的Vagrantfile

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

Vagrant.configure("2") do |config|
  config.vm.box = "ubuntu/trusty64"
  config.vm.provision "docker"
end

将在trusty64上安装docker - 如果您想使用docker图像等,则配置器具有许多优点......