【问题标题】:Puppet 3.6.2 breaks Puppetlabs Apache on CentOS 6.5 on first run, installs on second runPuppet 3.6.2 在第一次运行时在 CentOS 6.5 上破坏了 Puppetlabs Apache,在第二次运行时安装
【发布时间】:2014-07-04 17:57:33
【问题描述】:

我正在使用 Puppet 3.4.0 附带的 CentOS 6.5 机器。我有必要的依赖项,stdlib 和 concat。这是我用来安装 Apache 模块的代码:

class { 'apache':
  default_mods        => false,
  default_confd_files => false,
}

这在 3.4.0 上运行良好。但是,当我像这样运行 yum update 时:

exec { "yum_update":
  command => "yum -y update",
  path    => "/usr/bin",
  timeout => 0,
  before => Package["httpd"] 
}

它安装了 puppet 3.6.2,但出现大量错误,而 Apache 没有安装...

Stderr from the command:

Warning: Config file /vagrant/hiera.yamlm not found, using Hiera defaults
Error: /Stage[main]/Concat::Setup/File[/var/lib/puppet/concat/bin/concatfragments.sh]: Could not evaluate: undefined method `exist?' for Puppet::FileSystem:Module Could not retrieve file metadata for puppet:///modules/concat/concatfragments.sh: undefined method `exist?' for Puppet::FileSystem:Module
Error: Could not back up /etc/httpd/conf/httpd.conf: Unsupported checksum type "md5"
Error: Could not back up /etc/httpd/conf/httpd.conf: Unsupported checksum type "md5"
Error: /Stage[main]/Apache/File[/etc/httpd/conf/httpd.conf]/content: change from {md5}27a5c8d9e75351b08b8ca1171e8a0bbd to {md5}87926a96450a8af968c3b0c9675b373c failed: Could not back up /etc/httpd/conf/httpd.conf: Unsupported checksum type "md5"
Error: /Stage[main]/Apache/Concat[/etc/httpd/conf/ports.conf]/File[/var/lib/puppet/concat/_etc_httpd_conf_ports.conf/fragments]: Failed to generate additional resources using 'eval_generate': undefined method `exist?' for Puppet::FileSystem:Module
Warning: /Stage[main]/Apache/Concat[/etc/httpd/conf/ports.conf]/Exec[concat_/etc/httpd/conf/ports.conf]: Skipping because of failed dependencies
Error: /Stage[main]/Apache/Concat[/etc/httpd/conf/ports.conf]/Exec[concat_/etc/httpd/conf/ports.conf]: Failed to call refresh: Could not find command '/var/lib/puppet/concat/bin/concatfragments.sh'
Error: /Stage[main]/Apache/Concat[/etc/httpd/conf/ports.conf]/Exec[concat_/etc/httpd/conf/ports.conf]: Could not find command '/var/lib/puppet/concat/bin/concatfragments.sh'
Warning: /Stage[main]/Apache/Concat[/etc/httpd/conf/ports.conf]/File[/etc/httpd/conf/ports.conf]: Skipping because of failed dependencies
Error: /Stage[main]/Apache/File[/etc/httpd/conf.d]: Failed to generate additional resources using 'eval_generate': undefined method `exist?' for Puppet::FileSystem:Module
Warning: /Stage[main]/Apache::Service/Service[httpd]: Skipping because of failed dependencies
Error: Report processor failed: undefined method `exist?' for Puppet::FileSystem:Module

...第一次。再次运行 vagrant provision 只会导致弃用警告,并且当我 ssh 进入时,安装的 apache 正在运行。

我知道 hiera 没什么大不了的,虽然我把 --hiera_config /vagrant/hiera.yamlm 放在了我的 Vagrant 文件中,所以我不确定它为什么还在那里。

我尝试在谷歌上搜索很多这些错误,并且我看到了一些错误报告,但似乎没有直接解决这个问题。当我看到大量这样的错误时,我通常会认为缺少依赖项,但我无法弄清楚我可能在这里缺少什么。非常感谢您的帮助!

【问题讨论】:

标签: apache puppet centos6 yum


【解决方案1】:

从 Puppet 中更新 Puppet 很好,但不要指望同一个代理进程在事后做任何有用的事情。

对于后台进程,这通常需要重新启动服务,如果通过 cron 运行,您会在下一个时间间隔获得一个新的代理进程。

在配置(早期阶段)期间进行版本升级听起来是个坏主意。

也许您可以在 Puppet 之前独立运行 yum update

【讨论】:

  • 有趣,谢谢!我正在考虑将更新作为最后一项任务。
【解决方案2】:

据我所知,我可以在一定程度上帮助你。 在这里,你可以在 centos 中使用这个用于 apache2(httpd) 的 puppet manifest。

在您的清单文件夹中创建 2 个 .pp 文件(init.pp、install.pp) 使用 nano、vi 或 vim 打开 init.pp 文件...并在 init.pp 中写入以下内容

class httpd {
    include httpd::install
} 

之后打开 install.pp 文件并编写以下脚本。

class httpd::install {
    package { 'httpd':
        ensure => installed,
    }

    service { 'httpd':   
        ensure => running,
        hasrestart => true,
        hasstatus  => true,
        require    => Package['httpd'],
    }

   exec { "yum_update" :
       command => "yum update",
       path    => "/usr/local/bin:/usr/bin",
       timeout => 180,
       before => Package['httpd'], 
   } 

在 site.pp 中运行这个:

node 'ur node here with fqdn' 
{   
    include httpd
}

使用puppet agent --test 运行。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-01-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多