-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Puppet version 4.3.1 has been successfully built and tested for Linux on z Systems. The following instructions can be used for RHEL 7.1/6.6 and SLES 12/11.
General Notes:
i) When following the steps below please use a standard permission user unless otherwise specified.
ii) A directory /<source_root>/
will be referred to in these instructions, this is a temporary writeable directory anywhere you'd like to place it.
-
Install following dependencies
For RHEL6 & RHEL7:
sudo yum install -y gcc-c++ readline-devel tar openssl unzip libyaml-devel PackageKit-cron openssl-devel make git wget sqlite-devel glibc-common
For SLES11 & SLES12:
````
sudo zypper install -y gcc-c++ readline-devel tar openssl unzip openssl-devel make git wget sqlite-devel glibc-locale
- Download and install Ruby
cd /<source_root>/ wget http://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.2.tar.gz tar -xvf ruby-2.2.2.tar.gz cd ruby-2.2.2 ./configure && make && sudo make install
3. Download and install RubyGems
````
cd /<source_root>/
wget http://production.cf.rubygems.org/rubygems/rubygems-2.2.2.tgz
tar -xvf rubygems-2.2.2.tgz
cd rubygems-2.2.2
sudo /usr/local/bin/ruby setup.rb
- Install bundler
cd /<source_root>/ sudo /usr/local/bin/gem install bundler rake-compiler
5. Install Puppet
````
cd /<source_root>/
sudo /usr/local/bin/gem install puppet -v 4.3.1
- Locate the $confdir by command
confdir=`puppet master --configprint confdir`
The output gives the directory. If such directory does not exist, create one.
````
mkdir -p $confdir
- Create necessary directories and files in $confdir
mkdir $confdir/modules mkdir $confdir/manifests cd $confdir touch puppet.conf wget https://raw.githubusercontent.com/puppetlabs/puppet/master/conf/auth.conf
8. Create other necessary directories
````
mkdir -p $confdir/opt/puppetlabs/puppet
mkdir -p $confdir/var/log/puppetlabs
- Create "puppet" user and group
sudo useradd -d /home/puppet -m -s /bin/bash puppet sudo /usr/local/bin/puppet resource group puppet ensure=present
```Note```: Set a user specified password for puppet user .Running **sudo passwd puppet** will prompt for new password
10. Add the following parameters to $confdir/puppet.conf (assuming hostname of the master machine is master.myhost.com)
````
[main]
logdir = $confdir/var/log/puppetlabs
basemodulepath = $confdir/modules
server = master.myhost.com
user = puppet
group = puppet
pluginsync = false
[master]
certname = master.myhost.com
autosign = true
- The Puppet master runs on TCP port 8140. This port needs to be open on your master’s firewall (and any intervening firewalls and network devices), and your agent must be able to route and connect to the master. To do this, you need to have an appropriate firewall rule on your master, such as the following rule for the Netfilter firewall
iptables -A INPUT -p tcp -m state --state NEW --dport 8140 -j ACCEPT
## Puppet Agent Installation
1. Install following dependencies
For RHEL6 & RHEL7:
````
sudo yum install -y gcc-c++ readline-devel tar openssl unzip libyaml-devel PackageKit-cron openssl-devel make git wget sqlite-devel glibc-common
For SLES11 & SLES12: ```` sudo zypper install -y gcc-c++ readline-devel tar openssl unzip openssl-devel make git wget sqlite-devel glibc-locale
2. Download and install Ruby
````
cd /<source_root>/
wget http://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.2.tar.gz
tar -xvf ruby-2.2.2.tar.gz
cd ruby-2.2.2
./configure && make && sudo make install
- Download and install RubyGems
cd /<source_root>/ wget http://production.cf.rubygems.org/rubygems/rubygems-2.2.2.tgz tar -xvf rubygems-2.2.2.tgz cd rubygems-2.2.2 sudo /usr/local/bin/ruby setup.rb
4. Install bundler
````
cd /<source_root>/
sudo /usr/local/bin/gem install bundler rake-compiler
- Install Puppet
cd /<source_root>/ sudo /usr/local/bin/gem install puppet -v 4.3.1
6. Locate the $confdir by command
````
confdir=`puppet agent --configprint confdir`
The output gives the directory. If such directory does not exist, create one. ```` mkdir -p $confdir
7. Create necessary directories and files in $confdir
````
cd $confdir
mkdir -p $confdir/opt/puppetlabs/puppet
mkdir -p $confdir/var/log/puppetlabs
touch puppet.conf
- Add the following parameters to $confdir/puppet.conf (assuming hostname of the master machine is master.myhost.com and hostname of the agent machine is agent.myhost.com)
[main] logdir = $confdir/var/log/puppetlabs basemodulepath = /etc/puppetlabs/puppet/modules server = master.myhost.com user = puppet group = puppet pluginsync = false [agent] certname = agent.myhost.com report = true pluginsync = false
9. Add an entry in /etc/hosts file with ipaddress and hostname of master node
````
sudo vi /etc/hosts
<master ipaddress> <master hostname>
- Run the master application on master machine (assuming with hostname master.myhost.com)
puppet master --verbose --no-daemonize
The --verbose option outputs verbose logging and the --no-daemonize option keeps the daemon in the foreground and redirects output to standard output. You can also add the --debug option to produce more verbose debug output from the daemon.
2. On the agent application (assuming the hostname of the agent is agent.myhost.com)
````
puppet agent --test
Note: The following errors might be seen after execution of the above step
Info: Retrieving pluginfacts
Error: /File[/opt/puppetlabs/puppet/cache/facts.d]: Could not evaluate: Could not retrieve information from environment production source(s) puppet:///pluginfacts
Info: Retrieving plugin
Error: /File[/opt/puppetlabs/puppet/cache/lib]: Could not evaluate: Could not retrieve information from environment production source(s) puppet://master.myhost.com/plugins
This is because you don't have any plugins to syn yet, and the pluginsyn property is set to be true by default. So solutions are:
1) Disable the setting in the agent's 'puppet.conf' file by setting pluginsyn=false. Or
2) Create at least one plugin
For testing, run the tests from the source code.
- Switch user to puppet, clone Puppet git repository in /home/puppet and execute "bundle install" to install the required gems
su puppet cd /home/puppet git clone --branch 4.3.1 git://github.com/puppetlabs/puppet cd puppet bundle install --path .bundle/gems/
2. Edit file_spec.rb to support the testcases in environment
````
cd /home/puppet/puppet
Change the below line at number 59 in spec/unit/indirector/file_bucket_file/file_spec.rb
````
end.to raise_error(Puppet::FileBucket::BucketError, /Got passed new contents/)
Replace it with
````
should compile.and_raise_error(Puppet::FileBucket::BucketError, /Got passed new contents/)
end
- Running the test cases
Few testcases need to be executed as root user and others as puppet user.
- Execute testcases as root user:
_* Unit testcases, except ssl, face, indirector, network related testcases, should be executed as root user._
_* The integration testcases for provider and type should be executed as root user._
_* ```Note```: Run the below commands as root user.You can switch to root user by running **exit**, if you are currently switched to puppet user._
1. Create a shell script
For example,` rootuser_tests.sh `
````
cd /home/puppet/puppet
touch rootuser_tests.sh
chmod +x rootuser_tests.sh
````
2. Add the following content to the shell script
````
#!/bin/bash
set -e
echo "Running Unit testcases as root user"
declare -a unittests1
unittests1=$(ls spec/unit|egrep -v "ssl|face|indirector|network")
unittest_list1=($unittests1)
for i in "${unittest_list1[@]}"
do
bundle exec rspec "spec/unit/$i"
done
echo "Running Integration testcases as root user"
declare -a integration1
integration1=$(ls spec/integration|egrep "provider|type")
integration_list1=($integration1)
for j in "${integration_list1[@]}"
do
bundle exec rspec --exclude-pattern ./spec/integration/provider/service/systemd_spec.rb 1. 1. 1. 1. 1. 1. "spec/integration/$j"
done
````
3. Run the shell script
````
export LC_ALL="en_US.UTF8"
./rootuser_tests.sh
````
- Execute testcases as puppet user
_* ssl, face, indirector, network related unit testcases should be executed as puppet user._
_* The integration testcases except provider and type related testcases should be executed as puppet user._
_* data_binding.rb file is not executed as it does not involve any testcases to be invoked directly._
1. Create a shell script
For example `puppetuser_tests.sh`
````
cd /home/puppet/puppet
touch puppetuser_tests.sh
chmod +x puppetuser_tests.sh
````
2. Add the following content to the script
````
#!/bin/bash
set -e
echo "Running Unit testcases as puppet user"
declare -a unittests2
unittests2=$(ls spec/unit|egrep "ssl|face|indirector|network")
unittest_list2=($unittests2)
for i in "${unittest_list2[@]}"
do
bundle exec rspec "spec/unit/$i"
done
echo "Running Integration testcases as puppet user"
declare -a integration2
integration2=$(ls spec/integration|egrep -v "data_binding.rb|provider|type")
integration_list2=($integration2)
for j in "${integration_list2[@]}"
do
bundle exec rspec "spec/integration/$j"
done
````
- Switch user to puppet
su puppet
````
- Run the shell script
./puppetuser_tests.sh
````
https://puppetlabs.com/