Nous avons déja vu comment installer puppet sur CentOS 7/RHEL 7, dans cet article nous allons lister les 10 commandes puppet le plus utilisées.
1- Vérifier la version puppet:
[root@puppet-master ~]# /opt/puppetlabs/bin/puppet --version 4.10.12
2- Diagnostique de la connexion de l’agent puppet:
Pour vérifier s’il y a des soucis de connexion au niveau de l’agent utiliser l’option –DEBUG :
[root@puppet-agent ~]# puppet agent -t --DEBUG Debug: Applying settings catalog for sections main, agent, ssl Debug: Caching environment 'production' (ttl = 0 sec) Debug: Evicting cache entry for environment 'production' Debug: Caching environment 'production' (ttl = 0 sec) Debug: Evicting cache entry for environment 'production' Debug: Caching environment 'production' (ttl = 0 sec) Debug: Evicting cache entry for environment 'production' Debug: Caching environment 'production' (ttl = 0 sec) Debug: Using settings: adding file resource 'confdir': 'File[/etc/puppetlabs/puppet]{:path=>"/etc/puppetlabs/puppet", :ensure=>:directory, :loglevel=>:debug, :links=>:follow, :backup=>false}' Debug: Using settings: adding file resource 'codedir': 'File[/etc/puppetlabs/code]{:path=>"/etc/puppetlabs/code", :ensure=>:directory, :loglevel=>:debug, :links=>:follow, :backup=>false}' Debug: Evicting cache entry for environment 'production' Debug: Caching environment 'production' (ttl = 0 sec) Debug: Failed to load library 'cfpropertylist' for feature 'cfpropertylist' Debug: Evicting cache entry for environment 'production' Debug: Caching environment 'production' (ttl = 0 sec) Debug: Evicting cache entry for environment 'production' Debug: Caching environment 'production' (ttl = 0 sec) Debug: Facter: searching for custom fact "operatingsystem". Debug: Facter: searching for operatingsystem.rb in /opt/puppetlabs/puppet/cache/lib/facter. Debug: Facter: searching for operatingsystem.rb in /opt/puppetlabs/puppet/cache/facts. Debug: Facter: searching for operatingsystem.rb in /opt/puppetlabs/puppet/cache/lib/facter. Debug: Facter: searching for operatingsystem.rb in /opt/puppetlabs/puppet/cache/facts.
S’il y a des soucis vous aurez un message comme ci-dessous :
[root@puppet-master ~]# /opt/puppetlabs/bin/puppet agent -t --DEBUG Debug: Applying settings catalog for sections main, agent, ssl Debug: Caching environment 'production' (ttl = 0 sec) Debug: Evicting cache entry for environment 'production' Debug: Caching environment 'production' (ttl = 0 sec) Debug: Evicting cache entry for environment 'production' Debug: Caching environment 'production' (ttl = 0 sec) Debug: Evicting cache entry for environment 'production' Debug: Caching environment 'production' (ttl = 0 sec) Debug: Using settings: adding file resource 'confdir': 'File[/etc/puppetlabs/puppet]{:path=>"/etc/puppetlabs/puppet", :ensure=>:directory, :loglevel=>:debug, :links=>:follow, :backup=>false}' Debug: Using settings: adding file resource 'codedir': 'File[/etc/puppetlabs/code]{:path=>"/etc/puppetlabs/code", :ensure=>:directory, :loglevel=>:debug, :links=>:follow, :backup=>false}' . . . . Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Could not find node statement with name 'default' or 'puppet-master, puppet-master.localdomain' on node puppet-master Warning: Not using cache on failed catalog Error: Could not retrieve catalog; skipping run Debug: Dynamically-bound server lookup failed, falling back to report_server setting Debug: Dynamically-bound port lookup failed; falling back to report_port setting
3- Forcer la synchronisation :
Au lieu de respecter le délai « runinterval‘ , l’ensemble des mises à jour peuvent être exécutées manuellement grâce à la commande ci-dessous :
[root@puppet-agent ~]# puppet agent -t Info: Using configured environment 'production' Info: Retrieving pluginfacts Info: Retrieving plugin Info: Caching catalog for puppet-agent Info: Applying configuration version '1619614488' Notice: Applied catalog in 0.14 seconds
4- Voir les demandes de signatures de certificats en attente:
[root@puppet-master ~]# puppet cert list "puppet-agent" (SHA256) 1F:6C:C2:57:5B:4A:B9:0B:68:E3:4C:BD:1B:44:69:2F:59:3E:72:1B:E8:EF:9B:4E:F0:DA:1E:00:F4:13:D7:F9
5- Supprimer un certificats en attente :
[root@puppet-master ~]# puppet cert clean puppet-agent
6- Signer la certificat d’un agent puppet:
[root@puppet-master ~]# puppet cert sign puppet-agent Signing Certificate Request for: "puppet-agent" (SHA256) 1F:6C:C2:57:5B:4A:B9:0B:68:E3:4C:BD:1B:44:69:2F:59:3E:72:1B:E8:EF:9B:4E:F0:DA:1E:00:F4:13:D7:F9 Notice: Signed certificate request for puppet-agent Notice: Removing file Puppet::SSL::CertificateRequest puppet-agent at '/etc/puppetlabs/puppet/ssl/ca/requests/puppet-agent.pem'
7- Lister les modules installé :
[root@puppet-master ~]# puppet module list /etc/puppetlabs/code/environments/production/modules ├── dalen-dnsquery (v3.0.0) ├── jgazeley-nagios (v0.4.0) ├── puppet-selinux (v1.6.1) ├── puppetlabs-apache (v1.3.0) ├── puppetlabs-concat (v4.2.1) ├── puppetlabs-firewall (v1.15.3) ├── puppetlabs-stdlib (v4.25.1) ├── puppetlabs-vcsrepo (v2.4.0) ├── saz-sudo (v4.2.0) └── stahnma-epel (v1.3.1) /etc/puppetlabs/code/modules (no modules installed) /opt/puppetlabs/puppet/modules (no modules installed)
8- Installer un module :
[root@puppet-master ~]# puppet module install garethr-docker Notice: Preparing to install into /etc/puppetlabs/code/environments/production/modules … Notice: Downloading from https://forgeapi.puppet.com … Notice: Installing -- do not interrupt … /etc/puppetlabs/code/environments/production/modules └─┬ garethr-docker (v5.3.0) ├── puppetlabs-apt (v3.0.0) ├── puppetlabs-stdlib (v4.25.1) └── stahnma-epel (v1.3.1)
9- Chercher un module :
[root@puppet-master ~]# puppet module search docker Notice: Searching https://forgeapi.puppet.com …
10- Désinstaller un module :
[root@puppet-master ~]# puppet module uninstall garethr-docker Notice: Preparing to uninstall 'garethr-docker' … Removed 'garethr-docker' (v5.3.0) from /etc/puppetlabs/code/environments/production/modules
How to download and install Kali Linux
Kill – Arrêter les processus sous linux
Remove Apache completely on CentOS
Netstat : Les 14 commandes les plus utilisées
Fail2Ban : How to protect Linux services