gpt4 book ai didi

Puppet user manifest does any effect on puppetclient(木偶用户清单对PupetClient有任何影响)

转载 作者:bug小助手 更新时间:2023-10-25 23:52:14 34 4
gpt4 key购买 nike



On VirtualBox I have 2 servers:

在VirtualBox上,我有两台服务器:


1)hostname: puppetmaster 192.168.100.8

1)主机名:木偶大师192.168.100.8


2)hostname: pupetclient 192.168.100.9

2)主机名:pupetclient 192.168.100.9


on both servers puppet is running

在两台服务器上都运行着木偶


I used docu from ubuntu to install it:

我使用ubuntu的docu安装了它:


https://ubuntu.com/server/docs/tools-puppet

Https://ubuntu.com/server/docs/tools-puppet


servers are ubuntu 20.04

服务器为ubuntu 20.04


I run pupetclient and master noticed certificate and I signed it

我运行了PupetClient和大师注意到的证书,我签署了它


servers can ping each other.

服务器之间可以相互ping通。


Master:

师父:


cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 puppetmaster.example.com puppetmaster
192.168.100.9 puppetclient.example.com puppetclient

Client:

客户端:


cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 puppetclient.example.com puppetclient
192.168.100.8 puppetmaster.example.com puppetmaster puppet

At the begining I created the simples code to create a user:

一开始,我创建了用于创建用户的简单代码:


root@puppetmaster:/etc/puppet/code/environments# cd ../../
root@puppetmaster:/etc/puppet# tree
.
|-- auth.conf
|-- code
| `-- environments
| `-- production
| `-- modules
| |-- mymodule
| | |-- files
| | | `-- test.txt
| | `-- manifests
| | |-- init.pp
| | `-- site.pp
| `-- user
| `-- manifests
| |-- init.pp
| `-- site.pp
|-- hiera.yaml
`-- puppet.conf

cat puppet.conf
[main]
ssldir = /var/lib/puppet/ssl

[master]
vardir = /var/lib/puppet
cadir = /var/lib/puppet/ssl/ca
dns_alt_names = puppet

cat code/environments/production/modules/user/manifests/init.pp
class user {
user { 'testuser123':
ensure => present,
comment => 'bogo user',
home => '/home/testuser123',
managehome => true
}
}

root@puppetmaster:/etc/puppet# cat code/environments/production/modules/user/manifests/site.pp
node 'puppetclient.example.com' {
include user
}

sudo puppet apply /etc/puppet/code/environments/production/modules/user/manifests/init.pp
/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
Notice: Compiled catalog for puppetmaster.example.com in environment production in 0.01 seconds
/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/file_system/uniquefile.rb:126: warning: $SAFE will become a normal global variable in Ruby 3.0
Notice: Applied catalog in 0.01 seconds
/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:315: warning: deprecated Object#=~ is called on Puppet::Transaction::Report; it always returns nil
/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/file_system/uniquefile.rb:126: warning: $SAFE will become a normal global variable in Ruby 3.0

user@puppetclient:/home$ sudo puppet agent --test
[sudo] password for user:
/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
Info: Caching catalog for puppetclient.example.com
/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/util.rb:461: warning: URI.escape is obsolete
Info: Applying configuration version '1694262084'
/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/file_system/uniquefile.rb:126: warning: $SAFE will become a normal global variable in Ruby 3.0
Notice: Applied catalog in 0.01 seconds
/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

and it is nothing, where is error? On puppetclient server there is no new user :(

这不算什么,错误在哪里?在puppetClient服务器上没有新用户:(


更多回答
优秀答案推荐


where is error? On puppetclient server there is no new user



Based on its name and the fact that it contains a node declaration, you seem to intend /etc/puppet/code/environments/production/modules/user/manifests/site.pp to be a site manifest. It is not one. Nor is /etc/puppet/code/environments/production/modules/mymodule/manifests/site.pp

根据其名称和它包含节点声明的事实,您似乎打算将/etc/puppet/code/environments/production/modules/user/manifests/site.pp作为站点清单。它不是一个。/etc/puppet/code/environments/production/modules/mymodule/manifests/site.pp也不是


By default, the starting point for catalog compilation for a given environment -- that is, its site manifest -- is the collection of manifest files residing directly in the manifests/ folder of the environment itself. In your case, that would be /etc/puppet/code/environments/production/manifests, which you do not show even existing. Create that folder, making sure that it has correct permissions, and move the contents of your two site.pp files there. (You probably want to merge them into one file.)

默认情况下,给定环境的目录编译的起点--即其站点清单--是直接驻留在环境本身的清单/文件夹中的清单文件的集合。在您的情况下,这将是/etc/puppet/code/environments/production/manifests,,您甚至没有显示它的存在。创建该文件夹,确保它具有正确的权限,并将两个site.pp文件的内容移到那里。(您可能希望将它们合并到一个文件中。)


更多回答

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com