Chef、Puppet 等是否能够指向现有的 Linux 服务器并吸收 100% 构建服务器操作系统/包版本/自定义文件/等所需的“东西”,包括构建顺序?
(我猜不是,但相信我是从去年听到的一个演讲中相信这一点的。)
这里绝对的木偶初学者。我的人偶清单出现了有趣的行为,我很想知道我做错了什么。例如,假设我正在使用以下有序类配置实例:
class { 'update_system': } ->
class { 'facter': } ->
class { 'user_sshkey': user => 'ubuntu', type => 'rsa', } ->
class { 'tmux': user => 'ubuntu', } ->
class { 'vim': user => 'ubuntu', } ->
class { 'bashrc': user => 'ubuntu' } ->
notify {"Configuring DB role":} ->
class { 'postgresql': }
Run Code Online (Sandbox Code Playgroud)
当我使用 --debug 开关运行清单时,通过查看通知语句,我可以看到类按以下顺序执行:
1. update_system starts
2. a cron type inside of postgresql class (the very **last** class in that ordered list above) is executed …Run Code Online (Sandbox Code Playgroud) class mymodule::scripts::os_check {
case $operatingsystem {
/(?i-mx:centos)/: { notify("You are using CentOS")}
/(?i-mx:.*)/: { notify("You are using non-CentOS OS") }
}
}
Run Code Online (Sandbox Code Playgroud)
为什么这运行没有错误,但不显示通知(在操作系统事实 == CentOS 的服务器上)?
我使用 puppet apply os-check.pp 作为独立脚本运行它,只看到目录运行通知。
DevOps 工具生态系统让我感到困惑。服务器编排/管理空间中的每个人都在使用自己的专有格式,而不是在任何地方都可以使用的 shell 脚本。Ansible 有他们的 YAML 剧本,Puppet 有它的类/图语言,salt like ansible 有某种 YAML 格式,chef 是一个嵌入式 Ruby DSL。在所有这些方法中,我最喜欢厨师,因为它可以做最简单的事情。所以我想,当您使用这些工具之一时,一个好处是可以更好地了解队列,但这与实际配置和供应组件正交。
我不太明白为什么每个人都试图用 YAML 重新发明 shell 脚本,因为通常ssh -t我需要用一些 shell 脚本库来完成工作。这些脚本通常打包为独立的 tar 文件,并且小而简单,可以根据需要进行混合和匹配。除了bash几乎可以在任何地方工作之外,它们具有零依赖性。那么为什么像这样的简单解决方案对于 ansible、puppet、chef 等来说还不够好?通过用bash其他格式替换脚本,所有这些解决方案有什么好处?
我想知道,puppetmaster进程和agent进程如何使用网络相互交互。我的意思是,究竟是什么发生,当master进程发送命令从舱单agent过程,同样来自agent于master与错误代码?他们正在使用以下命令创建自己的包
`exec {"command"}`
Run Code Online (Sandbox Code Playgroud)
或者可能创建包含整个清单的包然后发送它们?
尝试设置自定义订阅以使 remediator.rb 在 puppet 的 sensu 模块中工作。
类 sensuJenkinsMasterClient {
类{'感':
purge_config => 真,
rabbitmq_password => '',
rabbitmq_host => 'sensu-master',
#Need for remediator 需要 fqdn
订阅 => ['sensu-default', 'centosJenkinsMaster', '"${::fqdn}'],
use_embedded_ruby => true, #set 下 /etc/default/sensu
}
}
我试图将一台服务器的 timedatectl 从 CST 更改为 EST。但每次我进行更改时,木偶都会覆盖更改并在几分钟后将其恢复到原来的位置。我怎样才能阻止这种情况发生在该特定服务器上?所以我的改变仍然存在。谢谢
我最近安装了一个 puppetmaster,我试图用嵌套资源配置一个 puppet 类。例如。
class base {
user { 'testuser':
name => 'test',
ensure => present,
comment => 'Test User',
expiry => '2014-06-30',
gid => '100',
groups => 'wheel',
password_max_age => "60",
managehome => true,
shell => "/bin/bash",
password => '*password*',
exec {
"usermod -p '${password}' ${user}":
onlyif => "egrep -q '^${user}:[*!]' /etc/shadow",
require => User[$user],
},
}
}
Run Code Online (Sandbox Code Playgroud)
问题是我不断收到语法错误:
[root@puppetclient ~]# puppet agent -t \\
Info: Retrieving plugin
Error: Could not retrieve catalog from remote server: Error 400 on …Run Code Online (Sandbox Code Playgroud) Puppet master 和 agent 系统是否有相同的操作系统版本?
例如:我的 Puppet Master 版本是 ubuntu:18 而 Puppet 代理版本是 ubuntu:16
这到底是怎么回事puppet我的Ubuntu节点上?它似乎要求su安装东西的权限,我不知道它为什么这样做。
我该怎么做才能让它发挥作用?
jay@scooter:~$ puppetd --test --server rizzo
info: Caching catalog for scooter
info: Applying configuration version '1331938939'
err: /Stage[main]//Node[scooter]/Package[apache2]/ensure: change from purged to present failed: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install apache2' returned 100: E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
Run Code Online (Sandbox Code Playgroud) puppet ×10
linux ×3
chef ×2
ubuntu ×2
ansible ×1
chef-solo ×1
facter ×1
networking ×1
puppetmaster ×1
sensu ×1