Puppet 中模組之間的檔案衝突

Puppet 中模組之間的檔案衝突

我遇到了一個問題,我確信這是一個簡單的解決方案,但我似乎找不到任何可以正確解釋該行為的資源。我正在建立一個新的 nginx puppet 模組,用於自動化 git 伺服器部署。

我正在使用標準 nginx 設定並嘗試替換 ngnix.conf 檔案。

我調用基類,然後請求文件不存在,然後再放置我的設定所需的設定檔。

      class { 'nginx': }

      $nginx_default_files_to_remove = 
       [ 
       "/etc/nginx/conf.d/default.conf",
       "/etc/nginx/default.d/php.conf", 
       "/etc/nginx/nginx.conf" 
       ]

      file { [ $nginx_default_files_to_remove ]: 
      ensure => 'absent', 
      require => Class["nginx"]
      }

當我在代理程式上執行 puppet 模組時,這會導致產生以下錯誤:

Error 400 on SERVER: Duplicate declaration: File[/etc/nginx/nginx.conf] is 
already declared in file /etc/puppet/modules/nginx/manifests/config.pp:331; 
cannot redeclare at /etc/puppet/modules/sf_nginx/manifests/git.pp:18 

據我了解,puppet 能夠刪除和替換標準設定檔。我這裡哪裡出錯了?

答案1

根據 yoonix 的評論,我修改了我的模組以刪除重複的檔案並使其按我想要的方式運作。

相關內容