Difference between revisions of "Puppet"

From ArchWiki
Jump to: navigation, search
(change category to Category:Configuration management)
 
(54 intermediate revisions by 18 users not shown)
Line 1: Line 1:
[[Category:System administration]]
+
[[Category:Configuration management]]
{{Stub|This wiki entry is a work-in-progress.}}
+
[[ja:Puppet]]
 +
{{Related articles start}}
 +
{{Related|Puppet Dashboard}}
 +
{{Related|Puppet Server}}
 +
{{Related articles end}}
 +
 
 
From [https://puppetlabs.com/puppet/what-is-puppet/ Puppet web site]:
 
From [https://puppetlabs.com/puppet/what-is-puppet/ Puppet web site]:
:''Puppet is IT automation software that helps system administrators manage infrastructure throughout its lifecycle, from provisioning and configuration to patch management and compliance. Using Puppet, you can easily automate repetitive tasks, quickly deploy critical applications, and proactively manage change, scaling from 10s of servers to 1000s, on-premise or in the cloud.''
+
:Puppet is IT automation software that helps system administrators manage infrastructure throughout its lifecycle, from provisioning and configuration to patch management and compliance. Using Puppet, you can easily automate repetitive tasks, quickly deploy critical applications, and proactively manage change, scaling from 10s of servers to 1000s, on-premise or in the cloud.
 +
 
 +
== Installation ==
 +
 
 +
{{pkg|puppet}} is available in the official repositories.
 +
 
 +
If you want to install from Puppet's git repo, {{AUR|puppet-git}} is available through the [[AUR]].
 +
 
 +
If you want to install a puppet master you can install the {{AUR|puppetserver}} package from the AUR the documentation for which is on the page [[Puppet server]].
 +
 
 +
== Configuration ==
  
= Installation =
+
Puppet's main configuration file is {{ic|puppet.conf}} which is located at {{ic|/etc/puppetlabs/puppet/puppet.conf}}.
  
Puppet packages are available in AUR. Install either puppet or puppet-git. The maintainer of the puppet AUR packages is not interested in shipping patches to minimize work as well as avoid confusion as to where bugs should go. So I will collect my patches here.
+
There are 3 sections to place settings depending if it is a master/agent: {{ic|[main]}}, {{ic|[agent]}} and {{ic|[master]}}.
  
= Configuration =
+
Bare minimum of settings are:
 +
* server: The hostname of the puppet server. Default: {{ic|puppet}}
 +
* report: Most users should set this to true.
 +
* pluginsync: Most users should set this to true.
 +
* certname: The certified name of the machine (unique identifier). Default: {{ic|fqdn}}
  
Puppet will look for your configuration in {{ic|<nowiki>/etc/puppet/manifests/site.pp</nowiki>}}.
+
Puppet will look for node configuration in {{ic|/etc/puppetlabs/code/environments/production/manifests/site.pp}}.
  
== Facter ==
+
After starting puppet by daemon/cron/standalone, it will generate
 +
certificates in {{ic|/etc/puppetlabs/puppet/ssl/}} directory.
 +
You need to accept this certificate in the puppet master with:
 +
{{ic|sudo puppet cert sign <name>}}.
 +
 
 +
Notes on ''bindaddress'' for puppet master.
 +
 
 +
The default value for ''bindaddress'' is "0.0.0.0", which makes puppet listen on IPv4 only: {{ic|1=bindaddress = 0.0.0.0}}
  
Facter is a package that gathers facts about the system it runs on. Use with {{ic|<nowiki>puppet facts find facter</nowiki>}}.
+
To make puppet master listen on IPv6, set the ''binaddress'' value to: {{ic|1=bindaddress = ::}}
  
Facter requires both {{ic|<nowiki>ifconfig</nowiki>}} as well as {{ic|<nowiki>ip</nowiki>}} to gather network related facts.
+
To make puppet listen on both interface, set the value to: {{ic|1=bindaddress = *}}
  
=== Puppet 3.1.0 ===
+
== Facter ==
  
Unfortunately {{ic|<nowiki>ifconfig</nowiki>}} in arch is too new for puppet. This is a ugly patch to work around the problem:
+
Facter is a companion program of puppet that gathers facts about the system it runs on.<br>
diff -urN facter-1.6.17-orig/lib/facter/util/ip.rb facter-1.6.17/lib/facter/util/ip.rb
+
commands:  
--- facter-1.6.17-orig/lib/facter/util/ip.rb    2013-02-25 08:48:04.000000000 +0100
+
  # puppet facts find facter
  +++ facter-1.6.17/lib/facter/util/ip.rb 2013-02-26 17:56:27.801252980 +0100
+
  # facter -p
  @@ -135,6 +135,8 @@
 
        output = Facter::Util::IP.ifconfig_interface(interface)
 
      when 'Linux'
 
        ifconfig_output = Facter::Util::IP.ifconfig_interface(interface)
 
+      ifconfig_output.gsub!(/inet ([0-9]+\.)/, 'inet addr:\1')
 
+      ifconfig_output.gsub!(/inet6 ([a-fA-F0-9]+:)/, 'inet6 addr: \1')
 
        if interface =~ /^ib/ then
 
          real_mac_address = get_infiniband_macaddress(interface)
 
          output = ifconfig_output.sub(%r{(?:ether|HWaddr)\s+((\w{1,2}:){5,}\w{1,2})}, "HWaddr #{real_mac_address}")
 
  
Apply in {{ic|<nowiki>/usr/lib/ruby/gems/1.9.1/gems</nowiki>}}.
+
{{Note|Facter is installed by default as a dependency of {{pkg|puppet}}.}}
  
==Packages==
+
== Puppet Resources ==
 +
===Packages===
  
"Pacman" is supported by puppet. Installing packages works out of the box with puppet 3.1.0 and the git packages.
+
"Pacman" is supported by puppet. Installing packages works out of the box since puppet 3.1.0.
  
==Services==
+
===Services===
  
===Puppet 3.1.0===
+
Since puppet 3.2.1 systemd on archlinux is fully supported.<br>
 +
The systemd provider in Puppet today only uses two commands for the service enable state:<br>
 +
  systemctl is-enabled <unit>, checking return code for the current enable state<br>
 +
  systemctl enable/disable <unit> to change it.
  
Puppet has trouble with systemd on arch linux. This diff fixes it:
+
Otherwise service running will use:
--- puppet-3.1.0-orig/lib/puppet/provider/service/systemd.rb    2013-02-25 08:49:29.000000000 +0100
+
   # systemctl start/stop/restart <unit>
+++ puppet-3.1.0/lib/puppet/provider/service/systemd.rb 2013-02-26 16:59:36.828276309 +0100
 
@@ -3,9 +3,10 @@
 
   Puppet::Type.type(:service).provide :systemd, :parent => :base do
 
    desc "Manages `systemd` services using `/bin/systemctl`."
 
 
 
-  commands :systemctl => "/bin/systemctl"
 
+  commands :systemctl => "/usr/bin/systemctl"
 
 
 
    #defaultfor :osfamily => [:redhat, :suse]
 
+  defaultfor :osfamily => [:archlinux]
 
 
 
    def self.instances
 
      i = []
 
  
Apply in {{ic|<nowiki>/usr/lib/ruby/gems/1.9.1/gems</nowiki>}}.
+
Using the full unit name unit.service is supported.
  
= See also =
+
==PuppetDB ==
* [[Puppet Dashboard]] - Software based on or using puppet in this wiki.
+
PuppetDB is the fast, scalable, and reliable data warehouse for Puppet.<br>
 +
It caches data generated by Puppet, and gives you advanced features at awesome speed with a powerful API.<br>
 +
Puppetdb is in aur install {{AUR|puppetdb}} and {{AUR|puppetdb-terminus}} <br>
 +
[More information: https://github.com/puppetlabs/puppetdb]

Latest revision as of 17:43, 20 October 2018

From Puppet web site:

Puppet is IT automation software that helps system administrators manage infrastructure throughout its lifecycle, from provisioning and configuration to patch management and compliance. Using Puppet, you can easily automate repetitive tasks, quickly deploy critical applications, and proactively manage change, scaling from 10s of servers to 1000s, on-premise or in the cloud.

Installation

puppet is available in the official repositories.

If you want to install from Puppet's git repo, puppet-gitAUR is available through the AUR.

If you want to install a puppet master you can install the puppetserverAUR package from the AUR the documentation for which is on the page Puppet server.

Configuration

Puppet's main configuration file is puppet.conf which is located at /etc/puppetlabs/puppet/puppet.conf.

There are 3 sections to place settings depending if it is a master/agent: [main], [agent] and [master].

Bare minimum of settings are:

  • server: The hostname of the puppet server. Default: puppet
  • report: Most users should set this to true.
  • pluginsync: Most users should set this to true.
  • certname: The certified name of the machine (unique identifier). Default: fqdn

Puppet will look for node configuration in /etc/puppetlabs/code/environments/production/manifests/site.pp.

After starting puppet by daemon/cron/standalone, it will generate certificates in /etc/puppetlabs/puppet/ssl/ directory. You need to accept this certificate in the puppet master with: sudo puppet cert sign <name>.

Notes on bindaddress for puppet master.

The default value for bindaddress is "0.0.0.0", which makes puppet listen on IPv4 only: bindaddress = 0.0.0.0

To make puppet master listen on IPv6, set the binaddress value to: bindaddress = ::

To make puppet listen on both interface, set the value to: bindaddress = *

Facter

Facter is a companion program of puppet that gathers facts about the system it runs on.
commands:

# puppet facts find facter
# facter -p
Note: Facter is installed by default as a dependency of puppet.

Puppet Resources

Packages

"Pacman" is supported by puppet. Installing packages works out of the box since puppet 3.1.0.

Services

Since puppet 3.2.1 systemd on archlinux is fully supported.
The systemd provider in Puppet today only uses two commands for the service enable state:

 systemctl is-enabled <unit>, checking return code for the current enable state
systemctl enable/disable <unit> to change it.

Otherwise service running will use:

 # systemctl start/stop/restart <unit>

Using the full unit name unit.service is supported.

PuppetDB

PuppetDB is the fast, scalable, and reliable data warehouse for Puppet.
It caches data generated by Puppet, and gives you advanced features at awesome speed with a powerful API.
Puppetdb is in aur install puppetdbAUR and puppetdb-terminusAUR
[More information: https://github.com/puppetlabs/puppetdb]