2017-02-25 6 views
1

문제

를로드 할 수 없습니다, 두 번째 환경에서 매니페스트하지 않습니다 모든 모듈을 참조 할 수있는 것 같습니다. 내가 뭔가 잘못하고 있기 때문에 이런 일이 일어나고 있다고 확신하지만, 나는 무엇을 해결할 수 없다.이전 사용자 정의 인형 모듈, 그것은 지금은 다른 환경에서 두 매니페스트, 각각에 매니페스트 인형을 분할 한 종속성을

[email protected]:~$ puppet --version 
4.9.2 

내가 인형을 사용 배우고

요약. 내가 작성한 세 개의 사용자 정의 모듈은 모두 완벽하게 작동합니다. 내 과정을 두 단계로 나누고 싶었습니다 :

  1. 하나의 퍼핏 매니페스트는 내 의존성이 모두 설치된 이미지를 만듭니다.
  2. 이전에 빌드 된 이미지를 기본으로 사용하여 내 프로젝트를 설치하는 초. 이 단계는 voxpupuli/nginx에 따라 다릅니다.

이렇게하면이 상자에서 실행할 새 프로젝트를 추가 할 때마다 모든 종속성을 다시 설치할 필요가 없습니다.

voxpupuli/nginx을 참조하는 내 맞춤 모듈을 별도의 인형 환경으로 옮겼습니다. 이제는 nginx 모듈에 대한 모든 지식을 잃어버린 것처럼 보입니다.

리팩터링

전에

/puupet-env/dev/manifests/site.pp :

$repoPath = "/var/repos" 
$sitePath = "/var/www" 

class { 'userconfig': } 

class {'dependencies': 
    require => Class['userconfig'], 
    repoPath => $repoPath, 
    sitePath => $sitePath, 
} 

class { 'sitebuilder': 
    repoPath => $repoPath, 
    sitePath => $sitePath, 
} 

/puupet-env/base/manifests/site.pp 리팩터링

후 :

$repoPath = "/var/repos" 
$sitePath = "/var/www" 

class { 'userconfig': } 

class {'dependencies': 
    require => Class['userconfig'], 
    repoPath => $repoPath, 
    sitePath => $sitePath, 
} 

/puupet-env/deploy/manifests/site.pp :

$repoPath = "/var/repos" 
$sitePath = "/var/www" 

class { 'sitebuilder': 
    repoPath => $repoPath, 
    sitePath => $sitePath, 
} 

는 패커 꼭두각시 매니페스트

실행, 나는 하나 개의 포장에 /puupet-env/base/manifests/site.pp와 신선한 이미지를 빌드 설정하고, /puupet-env/deploy/manifests/site.pp와 그 이미지의 상단을 기반으로 두 번째 설정을 가지고있다. 방랑와

은, 난 그냥 내 Vagrantfile에 이런 짓을 :

config.vm.define "dev", primary:true do |dev| 
    config.vm.provision "shell", path: "provision.sh" 

config.vm.provision "puppet" do |puppet| 
    puppet.environment_path = "puppet-env" 
    puppet.environment = "base" 
    puppet.module_path = "modules" 
end 

config.vm.provision "puppet" do |puppet| 
    puppet.environment_path = "puppet-env" 
    puppet.environment = "deploy" 
    puppet.module_path = "modules" 
end 

오류 메시지

나는 방랑 또는 패커와 디지털 오션 상자에서이 작업을 실행하면 나도 같은 오류 메시지가 표시됩니다.

==> dev: Warning: Unknown variable: '::nginx::config::spdy'. at /tmp/vagrant-puppet/modules-1cc77f85ff62eba00eccf0589f6e3b98/nginx/manifests/resource/vhost.pp:219:35 
==> dev: Warning: Unknown variable: '::nginx::config::http2'. at /tmp/vagrant-puppet/modules-1cc77f85ff62eba00eccf0589f6e3b98/nginx/manifests/resource/vhost.pp:220:35 
==> dev: Warning: Unknown variable: '::nginx::config::proxy_read_timeout'. at /tmp/vagrant-puppet/modules-1cc77f85ff62eba00eccf0589f6e3b98/nginx/manifests/resource/vhost.pp:223:35 
==> dev: Warning: Unknown variable: '::nginx::config::proxy_connect_timeout'. at /tmp/vagrant-puppet/modules-1cc77f85ff62eba00eccf0589f6e3b98/nginx/manifests/resource/vhost.pp:224:35 
==> dev: Warning: Unknown variable: '::nginx::config::proxy_set_header'. at /tmp/vagrant-puppet/modules-1cc77f85ff62eba00eccf0589f6e3b98/nginx/manifests/resource/vhost.pp:225:35 
==> dev: Warning: Unknown variable: '::nginx::config::proxy_hide_header'. at /tmp/vagrant-puppet/modules-1cc77f85ff62eba00eccf0589f6e3b98/nginx/manifests/resource/vhost.pp:226:35 
==> dev: Warning: Unknown variable: '::nginx::config::conf_dir'. at /tmp/vagrant-puppet/modules-1cc77f85ff62eba00eccf0589f6e3b98/nginx/manifests/resource/vhost.pp:236:38 
==> dev: Warning: Unknown variable: 'nginx::config::conf_dir'. at /tmp/vagrant-puppet/modules-1cc77f85ff62eba00eccf0589f6e3b98/nginx/manifests/resource/vhost.pp:239:38 
==> dev: Warning: Unknown variable: '::nginx::config::global_owner'. at /tmp/vagrant-puppet/modules-1cc77f85ff62eba00eccf0589f6e3b98/nginx/manifests/resource/vhost.pp:283:35 
==> dev: Warning: Unknown variable: '::nginx::config::global_group'. at /tmp/vagrant-puppet/modules-1cc77f85ff62eba00eccf0589f6e3b98/nginx/manifests/resource/vhost.pp:284:35 
==> dev: Warning: Unknown variable: '::nginx::config::global_mode'. at /tmp/vagrant-puppet/modules-1cc77f85ff62eba00eccf0589f6e3b98/nginx/manifests/resource/vhost.pp:285:35 
==> dev: Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Function Call, "" is not an Array. 
It looks to be a String at /tmp/vagrant-puppet/modules-1cc77f85ff62eba00eccf0589f6e3b98/nginx/manifests/resource/vhost.pp:387:3 at /tmp/vagrant-puppet/modules-1cc77f85ff62eba00eccf0589f6e3b98/sitebuilder/manifests/builder.pp:18 on node vagranttest 

누구든지 내가 뭘 잘못하고 있다고 말할 수 있습니까? 나는 꼭두각시에 대해 무언가를 이해하지 못하기 때문에 이런 일이 일어나는 것 같아요.

빌더.PP

define sitebuilder::builder (
    $domain, 
    $port, 
    $sitePath, 
    $repoPath, 
    $remoteUrl, 
    $location = false, 
    $command = "npm start", 
) { 

    if $location { 
    # Create location. 
    nginx::resource::location{ $domain: 
     proxy => "http://localhost:$port/", 
     vhost => $location 
    } 
    } 
    else { 
    # Create vhost file. 
    nginx::resource::vhost { $domain: 
     listen_port => 80, 
     proxy => "http://localhost:$port/" , 
    } 

    } 

    # Set up git to receive a push. 
    githook::githook { $title: 
    repoPath => $repoPath, 
    repoName => $title, 
    sitePath => $sitePath, 
    command => $command, 
    remoteUrl => $remoteUrl 
    } 

    # Create .env file. 
    file { "/var/www/$title/.env": 
    owner => 'helm108', 
    ensure => present, 
    content => template('sitebuilder/env.erb'), 
    require => Githook::Githook[$title], 
    } 

    # Create manual pull file. 
    file_line { "Append update_repos.sh for $title": 
    path => '/update_repos.sh', 
    line => "cd $repoPath/$title && git fetch origin && git --work-tree=${sitePath}/${title} --git-dir=${repoPath}/${title} checkout -f master", 
    } 
} 
+0

당신이 사용하고있는 꼭두각시의 버전을 확인할 수 있으며, builder.pp의 내용을 추가하십시오. –

+0

4.9.2를 사용하고 있습니다. 내 게시물에 builder.pp를 추가합니다. – terrarum

+0

제 질문에 builder.pp를 추가했습니다. – terrarum

답변

1

것은 당신의 평가 전에 당신의 꼭두각시 파일의 주요의 nginx 클래스

class { 'nginx': } 

의 정의를 추가해야합니다 nginx::resource::vhost

+0

아, 그랬어. 나는 그것이 일단 시스템에있게되고 내 두 번째 매니페스트에 의해 발견되면 이미 정의 되었기 때문에 나는 생각했다. 고마워요! – terrarum

+1

꼭 필요한 것은 아니지만, 실제로 두 인격의 프로듀서로 꼭두각시를 두 번 실행하면 첫 번째 목록에서 찾을 수 없습니다. –