2015-12-02 49 views
0

所以看起來我不能再使用Puppets --templatedir作爲我的流浪者設置中的一個參數。看起來在木偶4+被廢棄,但也只是似乎並不想在3.8.2templatedir不再是我的傀儡/流浪者設置的有效參數嗎?

合作,考慮到這一事實,這是在貶低,是沒有通過一個地圖模板我Vagrantfile一個適當的方式?以下應該在一年左右前工作,但不再有效,並且我正在修復和改進它。

# -*- mode: ruby -*- 
# vi: set ft=ruby : 
require 'rubygems' 
require 'git' 


## Base modules 
modules = [ 
    'haproxy', 
    'hiera', 
    'stdlib' 
] 


modules.each do | m | 
    puts "Testing module: #{m}" 

    repo = "git://github.com/ehime/puppet-#{m}.git" 
    dir = "puppet/modules/#{m}" 

    if File.exist?(dir) 
    if File.exist?(dir + "/.git") 
     puts "Loading puppet module #{m} from #{dir}\n" 
     Git.open(dir).pull 
    else 
     puts "Module #{m} does not have a GIT repository, bypassing" 
    end 
    else 
    puts "Fetch puppet module #{m} from #{repo}\n" 
    Git.clone(repo, dir) 
    end 
end 



Vagrant::Config.run do | config | 

    config.vm.box  = 'puppetlabs/centos-7.0-64-puppet' ## name 
    config.vm.box_url = 'puppetlabs/centos-7.0-64-puppet' ## can be a hardened ami etc if needed 


    config.vm.share_folder('templates', '/tmp/vagrant-puppet/templates', 'puppet/templates') 
    config.vm.share_folder('modules', '/etc/puppet/modules',   'puppet/modules') 


    config.vm.define :master do | master | 
    master.vm.host_name = 'master.io' 

    master.vm.provision :puppet, :options => [ '--templatedir /tmp/vagrant-puppet/templates' ] do | puppet | 

     puppet.hiera_config_path = "generic/hiera.yaml" 

     puppet.manifests_path  = "puppet/manifests" 
     puppet.manifest_file  = 'master.pp' 

     puppet.module_path  = "puppet/modules" 

     puppet.facter = { 
     "vagrant" => "1", 
     "server" => "master.io", 
     } 

    end 

    master.vm.provision :shell, :inline => 'yum clean all; yum makecache; yum update' ## generic cleanupuppet... 

    end 

    # Puppet client, configured from Puppet master 
    # Puppet needs to run twice 
    # First run needs to install build and its dependencies, so the plugins work next invocations 
    config.vm.define :client, :options => [ '--templatedir /tmp/vagrant-puppet/templates' ] do | client | 

    client.vm.host_name = 'client.io' 

    client.vm.provision :puppet do | puppet | 

     puppet.manifests_path  = "puppet/manifests" 
     puppet.manifest_file  = 'client.pp' 

    end 
    end 
end 

上述錯誤了與

==> master: Running provisioner: puppet... 
==> master: Running Puppet with master.pp... 
==> master: Error: Could not parse application options: invalid option: --templatedir 
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 

出了錯。

回答

0

創建一個模塊 - my_templates並將模板添加到模塊的模板文件夾中。然後你可以使用模板函數(​​)儘管模板函數也可以從文件的絕對位置加載模板,但是最好創建一個模塊然後添加模板。