wget https://apt.puppetlabs.com/puppetlabs-release-pc1-xenial.deb sudo dpkg -i puppetlabs-release-pc1-xenial.deb sudo apt update
sudo apt install puppetserver
client-auth: want ssl-host: 0.0.0.0 ssl-port: 8140
sudo apt install puppet-agent
[main] server = puppetmaster.example.com ca_server = puppet-master01.example.com
puppetlabs.services.ca.certificate-authority-service/certificate-authority-service
dns_alt_names = puppet-master01,puppet-master01.example.com,puppetmaster,puppetmaster.example.com
aspetrenko@puppet-master01:~$ sudo -i puppet cert generate puppet-master01.example.com --dns_alt_names=puppet-master01,puppet-master01.example.com,puppetmaster,puppetmaster.example.com Notice: puppet-master01.example.com.pem has a waiting certificate request Notice: Signed certificate request for puppet-master01.example.com.pem Notice: Removing file Puppet::SSL::CertificateRequest puppet-master01.example.com.pem at '/etc/puppetlabs/puppet/ssl/ca/requests/puppet-master01.example.com.pem.pem' Notice: Removing file Puppet::SSL::CertificateRequest puppet-master01.example.com.pem at '/etc/puppetlabs/puppet/ssl/certificate_requests/puppet-master01.example.com.pem.pem'
sudo systemctl start puppetserver.service
# To enable the CA service, leave the following line uncommented #puppetlabs.services.ca.certificate-authority-service/certificate-authority-service # To disable the CA service, comment out the above line and uncomment the line below puppetlabs.services.ca.certificate-authority-disabled-service/certificate-authority-disabled-service
dns_alt_names = puppet-master02,puppet-master02.example.com,puppetmaster,puppetmaster.example.com
aspetrenko@puppet-master02:~$ sudo -i puppet agent --test --waitforcert 60 Info: Creating a new SSL key for puppet-master02.example.com Info: Caching certificate for ca Info: csr_attributes file loading from /etc/puppetlabs/puppet/csr_attributes.yaml Info: Creating a new SSL certificate request for puppet-master02.example.com Info: Certificate Request fingerprint (SHA256): 16:67:D9:84:A3:50:B6:43:35:08:FE:BA:05:77:7C:C5:E7:3E:A5:D6:D1:00:BE:11:63:AB:6E:93:B7:37:0A:33 Info: Caching certificate for ca Info: Caching certificate for puppet-master02.example.com Info: Caching certificate_revocation_list for ca
aspetrenko@puppet-master01:~$ sudo -i puppet cert sign puppet-master02.example.com --allow-dns-alt-names Signing Certificate Request for: "puppet-master02.example.com" (SHA256) 16:67:D9:84:A3:50:B6:43:35:08:FE:BA:05:77:7C:C5:E7:3E:A5:D6:D1:00:BE:11:63:AB:6E:93:B7:37:0A:33 (alt names: "DNS:puppet-master02", "DNS:puppet-master02.example.com", "DNS:puppetmaster", "DNS:puppetmaster.example.com") ** Notice: Signed certificate request for puppet-master02.example.com Notice: Removing file Puppet::SSL::CertificateRequest puppet-master02.example.com at '/etc/puppetlabs/puppet/ssl/ca/requests/puppet-master02.example.com.pem'
Info: Using configured environment 'production' Info: Retrieving pluginfacts Info: Retrieving plugin Info: Caching catalog for puppet-master02.example.com Info: Applying configuration version '1477917008' Info: Creating state file /opt/puppetlabs/puppet/cache/state/state.yaml Notice: Applied catalog in 0.02 seconds
aspetrenko@puppet-master01:~$ sudo -i puppet cert list -a + "puppet-master01.example.com" (SHA256) 1A:15:76:96:33:6E:F9:DA:9F:C3:8D:9E:FC:98:BA:FB:10:CF:FA:27:54:2C:F2:55:8D:B9:AA:6C:52:FA:9F:C1 (alt names: "DNS:puppet-master01", "DNS:puppet-master01.example.com", "DNS:puppetmaster", "DNS:puppetmaster.example.com") + "puppet-master02.example.com" (SHA256) 80:1B:2C:49:E3:16:C6:37:B5:FC:E2:40:6B:49:B8:9A:95:91:C1:76:9C:79:3D:D5:0A:81:29:1D:E6:C3:B6:52 (alt names: "DNS:puppet-master02", "DNS:puppet-master02.example.com", "DNS:puppetmaster", "DNS:puppetmaster.example.com")
sudo systemctl start puppetserver.service
sudo apt install git rubygems sudo gem install r10k
sudo usermod -a -G puppet r10k
sudo mkdir -p /var/cache/r10k sudo chown -R r10k:puppet /var/cache/r10k sudo chmod 2775 /var/cache/r10k
sudo mkdir -p /etc/puppetlabs/r10k sudo chown -R puppet:puppet /etc/puppetlabs sudo chmod -R g+w /etc/puppetlabs
# location for cached repos :cachedir: '/var/cache/r10k' git: provider: 'shellgit' # git repositories containing environments :sources: :base: remote: 'gitolite3@sgl-git.example.com:puppet-environments' # gitolite3 # remote: '/srv/puppet.git' # shared # remote: 'ssh://aspetrenko@puppet-master01/srv/puppet.git' # ssh basedir: '/etc/puppetlabs/code/environments/'
host sgl-git.example.com HostName sgl-git.example.com IdentityFile /home/r10k/.ssh/r10k User gitolite3
it makes it easier to compile it, and it doesn’t have any legal support. You will need to shellgit or recompile your own libssh2-1 package to use OpenSSL on these distributions.
Libssh2 / src / libgcrypt.c. Elsewhere, libssh2 v 1.6.0 works without complaint. If updating, it’s not necessary to use private git repos.
sudo apt install make cmake pkg-config libssh2-1-dev ruby-dev rubygems libevent-pthreads-2.0-5 openssl libssl-dev libz-dev libhttp-parser-dev
sudo apt install debhelper dh-autoreconf chrpath devscripts
sudo apt install make cmake pkg-config ruby-dev rubygems libevent-pthreads-2.0-5 openssl libssl-dev libz-dev libhttp-parser-dev
dget http://archive.ubuntu.com/ubuntu/pool/universe/libs/libssh2/libssh2_1.7.0-1.dsc dpkg-source -x ./libssh2_1.7.0-1.dsc
cd libssh2-1.7.0/ dch -i
* Backport from yakkety
* Recompile with openssl support
dch -r
sed -i 's/libgcrypt20-dev/libssl-dev/g' debian/control
./configure --with-openssl --without-libgcrypt dpkg-buildpackage -rfakeroot
sudo apt remove libssh2-1-dev
sudo dpkg -i libssh2-1_1.7.0-1ubuntu1_amd64.deb libssh2-1-dbg_1.7.0-1ubuntu1_amd64.deb libssh2-1-dev_1.7.0-1ubuntu1_amd64.deb
sudo gem install r10k rugged
# location for cached repos :cachedir: '/var/cache/r10k' git: provider: 'rugged' private_key: '/home/r10k/.ssh/r10k' # git repositories containing environments :sources: :base: remote: 'ssh://gitolite3@sgl-git.example.com/puppet-environments' basedir: '/etc/puppetlabs/code/environments/'
aspetrenko@aspetrenko-pc:~/sgl-git$ git clone gitolite3@sgl-git.example.com:puppet-environments Cloning into 'puppet-environments'... warning: You appear to have cloned an empty repository. Checking connectivity... done.
aspetrenko@aspetrenko-pc:~/sgl-git$ scp -r aspetrenko@puppet-master01:/etc/puppetlabs/code/environments/production/* /home/aspetrenko/sgl-git/puppet-environments/
aspetrenko@aspetrenko-pc:~/sgl-git$ cd puppet-environments/ aspetrenko@aspetrenko-pc:~/sgl-git/puppet-environments$ git symbolic-ref HEAD refs/heads/production
aspetrenko@aspetrenko-pc:~/sgl-git/puppet-environments$ git add --all aspetrenko@aspetrenko-pc:~/sgl-git/puppet-environments$ git commit -a -m "Initial commit" aspetrenko@aspetrenko-pc:~/sgl-git/puppet-environments$ git push --set-upstream origin production
aspetrenko@sgl-git:~$ sudo cat /media/data/repositories/puppet-environments.git/hooks/post-receive #!/bin/bash umask 0002 while read oldrev newrev ref do branch=$(echo $ref | cut -d/ -f3) echo echo "--> Deploying ${branch}..." echo ssh -i /var/lib/gitolite3/.ssh/gitolite3 r10k@puppet-master01 "r10k deploy environment $branch -p" ssh -i /var/lib/gitolite3/.ssh/gitolite3 r10k@puppet-master02 "r10k deploy environment $branch -p" # sometimes r10k gets permissions wrong too find /etc/puppetlabs/code/environments/$branch/modules -type d -exec chmod 2775 {} \; 2> /dev/null find /etc/puppetlabs/code/environments/$branch/modules -type f -exec chmod 664 {} \; 2> /dev/null done
aspetrenko@sgl-git:~$ sudo chmod 0775 /media/data/repositories/puppet-environments.git/hooks/post-receive
aspetrenko@aspetrenko-pc:~/sgl-git/puppet-environments$ touch manifests/.keep aspetrenko@aspetrenko-pc:~/sgl-git/puppet-environments$ git add manifests/.keep aspetrenko@aspetrenko-pc:~/sgl-git/puppet-environments$ git commit manifests/.keep -m "Test commit" [production 72bd288] Test commit 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 manifests/.keep
aspetrenko@aspetrenko-pc:~/sgl-git/puppet-environments$ git push -u origin production
Librarian-puppet takes control of the modules / directory, and will always reinstall (if not available) the modules described in Puppetfile, so you do not need to store and monitor the status of the modules / directory in Git.
Librarian-puppet is the manager (aka Bundler for gem) for your puppet infrastructure. You can use librarian-puppet to manage Puppet modules, regardless of where the modules are stored in Puppet Forge, in a Git repository, or in a local folder.
Librarian-puppet can resolve dependencies described in Modulefile or metadata.json.
Forge modules can be installed from Puppetlabs Forge or internal Forge storage such as Pulp.
Git-modules can be installed from a branch, a tag or a specific commit. Modules can be installed from GitHub using tarballs, without the need to install Git. Modules can be installed from a directory in the local file system. Module dependencies can be resolved transparently without the need to list all modules explicitly.
aspetrenko@aspetrenko-pc:~/sgl-git/puppet-environments$ sudo gem install librarian-puppet
aspetrenko@aspetrenko-pc:~/sgl-git/puppet-environments$ git rm -rf modules
aspetrenko@aspetrenko-pc:~/sgl-git/puppet-environments$ librarian-puppet init
aspetrenko@aspetrenko-pc:~/sgl-git/puppet-environments$ cat Puppetfile #!/usr/bin/env ruby #^syntax detection forge "https://forgeapi.puppetlabs.com" # use dependencies defined in metadata.json # metadata # use dependencies defined in Modulefile # modulefile # A module from the Puppet Forge mod 'puppetlabs-stdlib' mod 'puppetlabs-ntp' mod 'puppetlabs-puppetdb' mod 'puppetlabs-firewall' # For puppetlabs-puppetdb mod 'puppetlabs-inifile' # For puppetlabs-puppetdb mod 'puppetlabs-postgresql' # For puppetlabs-puppetdb mod 'puppetlabs-apt' # For puppetlabs-puppetdb mod 'puppetlabs-concat' # For puppetlabs-puppetdb
aspetrenko@aspetrenko-pc:~/sgl-git/puppet-environments$ touch modules/.keep
git add --all git commit -a -m "librarian-puppet init" git push -u origin production
Source: https://habr.com/ru/post/316482/
All Articles