AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题

问题[puppet-agent](server)

Martin Hope
Jorge Mauricio
Asked: 2022-02-28 14:28:23 +0800 CST

用于 docker 镜像验证的 Puppet manifest 配置

  • 1

我对 devops/ci/cd 很陌生,所以请耐心等待。

目前,我正在为 docker 图像验证设置一个 puppet manifest 配置。让我尝试布局它:

我有一个具有以下配置的 puppet master 服务器:

  • Puppetmaster 版本:5.5.10-4ubuntu3
  • 两台服务器都是linux 20.04
  • 全部托管在 AWS 上

/etc/puppet/code/environments/production/manifests/site.pp

node default {
    include 'docker'
    docker::image { 'jorgemauriciodev/ubuntu-dockerfile-dev-v1': }
}

每次在 .pp 中尝试新的验证命令时,我都会使用以下命令重新启动 puppet master 服务器:sudo systemctl restart puppet-master

我在我的两台服务器(代理和主服务器)上都安装了一个名为 garethr-docker 的模块。

在从/代理服务器上,我有这个镜像 docker 镜像存在并正在运行:jorgemauriciodev/ubuntu-dockerfile-dev-v1 第一步,我只想检查我的从属服务器中是否存在该镜像。稍后,我将确定它正在运行或使用 Dockerfile 构建。

在从/代理服务器上,我运行:sudo puppet agent –test

我收到以下错误消息:

错误:无法从远程服务器检索目录:服务器上的错误 500:服务器错误:评估错误:评估函数调用时出错,找不到类 ::docker 用于 ip-123-123-123-123.us-east- 2.compute.internal(文件:/etc/puppet/code/environments/production/manifests/site.pp,行:2,列:5)在节点 ip-123-123-123-123.us-east-2 .compute.internal 警告:未在失败的目录上使用缓存错误:无法检索目录;跳过跑步

有人知道我对 puppet 清单文件有什么问题吗?

编辑1:

我做了一些建议的更改。现在,我的文件有一个不同的名称并更改了内容:/etc/puppet/code/environments/production/manifests/init.pp

include 'docker'
class { 'docker':
  version => 'latest',
}
docker::image { 'jorgemauriciodev/ubuntu-dockerfile-dev-v1': }

仍然返回相同的错误消息。

这是完整的消息:

/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/util.rb:315: warning: deprecated Object#=~ is called on Puppet::Transaction::Report; it always returns nil
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/util.rb:315: warning: deprecated Object#=~ is called on Puppet::Transaction::Report; it always returns nil
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/util.rb:315: warning: deprecated Object#=~ is called on Puppet::Transaction::Report; it always returns nil
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/indirector/request.rb:272: warning: URI.unescape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
Info: Retrieving plugin
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/util.rb:315: warning: deprecated Object#=~ is called on Puppet::Transaction::Report; it always returns nil
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/indirector/request.rb:272: warning: URI.unescape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
Info: Retrieving locales
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/util.rb:315: warning: deprecated Object#=~ is called on Puppet::Transaction::Report; it always returns nil
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/indirector/request.rb:272: warning: URI.unescape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, Could not find class ::docker for ip-172-31-21-116.us-east-2.compute.internal (file: /etc/puppet/code/environments/production/manifests/init.pp, line: 1, column: 1) on node ip-172-31-21-116.us-east-2.compute.internal
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
/usr/lib/ruby/vendor_ruby/puppet/file_system/uniquefile.rb:126: warning: $SAFE will become a normal global variable in Ruby 3.0
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/file_system/uniquefile.rb:126: warning: $SAFE will become a normal global variable in Ruby 3.0

编辑2:

我使用以下命令在主服务器和从/代理服务器上安装了更多模块:

sudo puppet module install puppetlabs-docker --version 4.1.2

它仍然向我返回一条错误消息,但现在似乎它是一个不同的消息。所以,现在可能是一个语法问题。

这是消息的重要部分。

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Class[Docker] is already declared; cannot redeclare (file: /etc/puppet/code/environments/production/manifests/init.pp, line: 3) (file: /etc/puppet/code/environments/production/manifests/init.pp, line: 3, column: 1) on node ip-123-123-123-123.us-east-2.compute.internal
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

除了这条消息,它仍然向我返回那些警告,但列表要大得多。但是,我认为目前这不是问题。

ubuntu puppet devops puppetmaster puppet-agent
  • 1 个回答
  • 103 Views
Martin Hope
bdetweiler
Asked: 2021-07-14 12:39:47 +0800 CST

Puppet - 我可以选择性地通知服务吗?

  • 0

我有一个 Puppet 脚本,可以根据if/else块在不同环境中以不同方式处理事情。但是我在底部有一堆适用于所有环境的通用文件资源块。目前,那些块notify => Service['my-service'],但对于生产,我希望它不通知。我只希望它更新文件,而不是启动或停止任何服务。

我最初的想法是,我可以将服务存储到一个变量中并在每个部分中设置它吗?

例子:

if ($env == 'dev') {
  $myService = Service['my-service']
} elsif ($env == 'prod') {
  $myService = Service['dummy-service']
}

file { "myfile.xml":
      ensure  => file,
      content =>
        template("mytemplate.erb"),
      require => Package['my-service'],
      notify  => $myService
}

我不确定这是否有效,但如果有效,我可以将什么用于虚拟服务?

puppet puppet-agent erb
  • 1 个回答
  • 320 Views
Martin Hope
macosta
Asked: 2020-01-29 06:04:23 +0800 CST

将 puppet 代理连接到 master 的问题

  • 0

尝试基于可用于测试目的的最新 puppet/agents 构建基础架构。

因此,我一直在尝试在节点上运行 puppet 代理,但我目前遇到以下错误,puppet master 目前正在全新安装的 Foreman 1.24(EC2 实例)上运行,并且似乎可以正常运行代理,没有任何问题,关于特工的不同故事。

我能够从主机上的节点(代理)访问并签署证书,但除了收到错误之外别无他法。

root@puppetagent02:~# puppet agent -t
Warning: Unable to fetch my node definition, but the agent run will continue:
Warning: SSL_connect returned=1 errno=0 state=error: certificate verify failed (unable to get issuer certificate): [unable to get issuer certificate for /CN=Puppet CA: puppetmaster.domain.com]
Info: Retrieving pluginfacts
Error: /File[/var/cache/puppet/facts.d]: Failed to generate additional resources using 'eval_generate': SSL_connect returned=1 errno=0 state=error: certificate verify failed (unable to get issuer certificate): [unable to get issuer certificate for /CN=Puppet CA: puppetmaster.domain.com]
Error: /File[/var/cache/puppet/facts.d]: Could not evaluate: Could not retrieve file metadata for puppet:///pluginfacts: SSL_connect returned=1 errno=0 state=error: certificate verify failed (unable to get issuer certificate): [unable to get issuer certificate for /CN=Puppet CA: puppetmaster.domain.com]
Info: Retrieving plugin
Error: /File[/var/cache/puppet/lib]: Failed to generate additional resources using 'eval_generate': SSL_connect returned=1 errno=0 state=error: certificate verify failed (unable to get issuer certificate): [unable to get issuer certificate for /CN=Puppet CA: puppetmaster.domain.com]
Error: /File[/var/cache/puppet/lib]: Could not evaluate: Could not retrieve file metadata for puppet:///plugins: SSL_connect returned=1 errno=0 state=error: certificate verify failed (unable to get issuer certificate): [unable to get issuer certificate for /CN=Puppet CA: puppetmaster.domain.com]
Error: Could not retrieve catalog from remote server: SSL_connect returned=1 errno=0 state=error: certificate verify failed (unable to get issuer certificate): [unable to get issuer certificate for /CN=Puppet CA: puppetmaster.domain.com]
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
Error: Could not send report: SSL_connect returned=1 errno=0 state=error: certificate verify failed (unable to get issuer certificate): [unable to get issuer certificate for /CN=Puppet CA: puppetmaster.domain.com]
root@puppetagent02:~#
puppet puppetmaster puppet-agent puppet-foreman
  • 1 个回答
  • 379 Views
Martin Hope
LINUX G33NYUS
Asked: 2016-12-14 15:40:50 +0800 CST

Puppet 客户端不会自动拉取更改

  • -1

我有一台配置、启用和运行 puppet 客户端的计算机,但它不会自行从主服务器中提取更改。如果我这样做,puppet agent -t它会很好地进行更改。我应该检查哪些日志以找出它为什么不能自行拉动?

puppet puppet-agent
  • 1 个回答
  • 596 Views
Martin Hope
Kiran
Asked: 2016-11-10 17:46:57 +0800 CST

如何将 Windows 服务器配置为 Puppet 代理服务器?

  • 1

如何将 Windows 服务器配置为 Puppet 代理服务器?

我在 CentOS 7 上运行 Puppet Enterprise 4.x,在 Windows Server 2012 上运行 Puppet Agent 3.7.4。我第一次尝试设置它。我知道从 Puppet Master 服务器到 Puppet Agent 服务器没有被阻止的端口。

当我运行puppet agent -t x.x.x.x命令时(从以管理员身份打开的 Windows PowerShell 窗口),我收到此错误:

警告:无法获取我的节点定义... xxxx 与服务器证书不匹配...无法使用“eval_generate”生成其他资源...与服务器证书不匹配:预期其中之一...

puppet.conf 文件看起来不错。在 Puppet Master 服务器上,我运行“puppet cert list --all”显示 Puppet 代理服务器已签名。

我可以从 Puppet Master ping Puppet Agent 服务器。我可以从 Puppet Agent ping Puppet Master 服务器。Puppet 的 GUI 显示一条消息“运行 Puppet 已被禁用,因为节点管理器无法连接到 .”。

为什么我在运行 Puppet 代理命令时会出现上述错误?

windows linux puppet certificate puppet-agent
  • 2 个回答
  • 626 Views
Martin Hope
Zama Ques
Asked: 2016-07-18 22:07:12 +0800 CST

迁移到 Puppet 4.5.2

  • 1

我们正在迁移到更高版本的 puppet。

新版本:

# puppet --version
4.5.2

现有版本:

#puppet-3.8.7

我们现有的site.pp如下:

#A default site.pp to do a quick test run
import "../classes/*"
import "../nodes/*"
   file { 'testfile':
       path => '/home/test/testfile',
       ensure => present,
       mode => 0755,
       content => "A test file to check a different manifestdir" ,
      }
 Exec { path => ["/bin" , "/sbini/", "/usr/bin" , "/usr/sbin/"]  }

现在由于我们正在迁移到Puppet 4,我认为下面的导入功能包含多个 pp 文件将在这里不起作用Puppet 4

import "../classes/*"
import "../nodes/*" 

如果我没记错的话,我可以将 classes 和 nodes 目录下的所有清单复制到下面的清单目录

/apps/puppetlabs/code/environments/production/manifests/site.pp          

请建议如何将清单更新到 Puppet 的更高版本或没有兼容性问题?

puppet rhel6 puppet-agent
  • 2 个回答
  • 1228 Views
Martin Hope
M. Glatki
Asked: 2016-07-08 00:35:57 +0800 CST

r10k:与 git 的正确合并工作流程

  • 4

我目前正在以无主模式运行 Puppet。我正在使用r10k进行模块和环境部署。

简化版:r10k 控制存储库有两个分支:测试和生产。生产中的更改将自动分发到生产服务器。对某些登台服务器的测试进行了更改。

现在,如果我在测试中进行更改,有时我也必须更改 r10k 控制存储库。一个常见的例子是Puppetfile,目前在生产中看起来像这样:

forge 'forge.puppetlabs.com'

# Forge modules
mod 'puppetlabs/stdlib'
mod 'puppetlabs/concat'
mod 'saz/ssh'

# Custom modules
mod 'ownmodule1',
        :git => 'https://git.example.org/configuration/ownmodule1.git',
        :ref => 'production'
mod 'ownmodule2',
        :git => 'https://git.example.org/configuration/ownmodule2.git',
        :ref => 'production'

自定义模块的配置在测试分支上可能如下所示:

mod 'ownmodule1',
        :git => 'https://git.example.org/configuration/ownmodule1.git',
        :ref => 'testing'
mod 'ownmodule2',
        :git => 'https://git.example.org/configuration/ownmodule2.git',
        :ref => 'testing'

现在,测试中的提交可能如下所示:

+mod 'ownmodule3,
+        :git => 'https://git.example.org/configuration/ownmodule3.git',
+        :ref => 'testing'

如果我将其合并到production并且不小心,ownmodule3将与testing分支一起添加到production中,这可能是致命的。当所有测试都成功时,这也可以防止自动合并。

如何修改我的存储库或工作流程以防止意外合并分支特定更改?

puppet git puppet-agent r10k
  • 2 个回答
  • 633 Views
Martin Hope
Zama Ques
Asked: 2016-07-01 02:23:57 +0800 CST

Puppet 服务器/代理上的不同清单位置

  • 1

我的 Puppet 服务器环境设置如下

[master]
vardir = /opt/puppetlabs/server/data/puppetserver
logdir = /data/log/puppetlabs/puppetserver
rundir = /var/run/puppetlabs/puppetserver
pidfile = /var/run/puppetlabs/puppetserver/puppetserver.pid
codedir = /data/puppetlabs/code

#  puppet master --configprint manifest
/data/puppetlabs/code/environments/production/manifests

在代理上如下

server = jw-host
environment = production

但是 --configprint 在代理节点上显示不同的位置

# puppet master --configprint manifest
/etc/puppetlabs/code/environments/production/manifests

它没有更改为 /data,因为我的清单没有得到应用。

版本如下

 # puppetserver  --version
  puppetserver version: 2.4.0
 # puppet  --version
  4.5.2

这里有什么问题?

puppet puppetmaster puppet-agent
  • 1 个回答
  • 446 Views
Martin Hope
Utegrad
Asked: 2016-04-12 13:28:15 +0800 CST

重复的 Ansible 任务

  • 0

我一直在熟悉 Ansible 和 Puppet,它们可用作配置和配置管理工具。我可能不会误解 Anisble 的使用方式,但我认为 Ansible 确保定期重复配置一致的唯一方法是使用 cron 作业定期运行剧本,如果我想坚持社区来源。如果我购买 Ansible Tower,看起来我可以在那里安排剧本。

相比之下,当使用 Puppet 代理时,代理会定期与 Puppet Master 签入,如果发生变化而偏离 Puppet Master 上定义的内容,代理会将其放回 Puppet Master 上定义的内容。如果我不需要购买商业支持,我可以使用 Puppet 的社区版来做到这一点。

除了使用 cron 作业之外,购买和使用 Ansible Tower 是否是使用计划作业运行 Ansible playbook 的传统方式?

puppet ansible puppetmaster puppet-agent
  • 1 个回答
  • 1074 Views
Martin Hope
030
Asked: 2015-01-08 07:47:38 +0800 CST

如何禁用每 30 分钟发生一次的自动计划 Puppet 运行?

  • 10

目标

目的是禁用每 30 分钟发生一次的自动 Puppet-agent 运行。可以更改 interval,但应该完全禁用自动 Puppet-agent 运行。


尝试一

根据本文档,应该可以通过配置以下内容来禁用自动 Puppet-agent 运行:

/etc/puppet/puppet.conf

[agent]
daemonize=false

结果是

Notice: Run of Puppet configuration client already in progress; 
skipping  (/var/lib/puppet/state/agent_catalog_run.lock exists)

如果以默认运行间隔 30 分钟手动运行 puppet。


尝试二

user@hostname:~$ sudo puppet agent --disable

结果是

user@hostname:~$ sudo puppet agent -t
Notice: Skipping run of Puppet configuration client; 
administratively disabled (Reason: 'reason not specified');
Use 'puppet agent --enable' to re-enable.

尝试三

此文档是在谷歌搜索此问答的问题后找到的,但提供的信息没有回答问题。

puppet-agent
  • 7 个回答
  • 34255 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve