Last active
January 17, 2017 15:18
-
-
Save sdorsett/fa89f3373b64178a8e0462f90e9eaa4c to your computer and use it in GitHub Desktop.
puppetserver standup on CentOS 6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yum update -y | |
rpm -Uvh https://yum.puppetlabs.com/puppetlabs-release-pc1-el-6.noarch.rpm | |
yum install puppetserver | |
echo 'export PATH=/opt/puppetlabs/puppet/bin/:$PATH' >> /etc/profile | |
source /etc/profile | |
service puppetserver restart | |
chkconfig puppetserver on | |
/opt/puppetlabs/puppet/bin/gem install r10k | |
cd /etc/puppetlabs/puppet | |
### create Puppetfile for pulling down needed puppet modules | |
cat << EOF > /etc/puppetlabs/puppet/Puppetfile | |
moduledir '/etc/puppetlabs/code/environments/production/modules' | |
# simplify github module convention | |
def github(name, options = nil) | |
options ||= {} | |
options[:user] ||= 'puppetlabs' | |
options[:version] ||= :master | |
options[:protocol] ||= 'https' | |
options[:prefix] ||= case options[:user] | |
when 'puppetlabs' | |
'puppetlabs' | |
else | |
'puppet' | |
end | |
options[:repo] ||= case options[:protocol] | |
when 'git' | |
"#{options[:protocol]}@github.com:#{options[:user]}/#{options[:prefix]}-#{name}.git" | |
when 'https' | |
"#{options[:protocol]}://github.com/#{options[:user]}/#{options[:prefix]}-#{name}.git" | |
else | |
raise Error, "Invalid github repo protocol." | |
end | |
if options[:version] == :master | |
# puts name, options[:repo] | |
mod name, :git => options[:repo] | |
else | |
# puts name, options[:repo], options[:version] | |
mod name, :git => options[:repo] , :ref => options[:version] | |
end | |
end | |
github 'java', :user => 'puppetlabs', :prefix => 'puppetlabs' | |
github 'dnsclient', :user => 'ghoneycutt', :prefix => 'puppet-module' | |
github 'stdlib', :user => 'puppetlabs', :prefix => 'puppetlabs' | |
github 'jenkins', :user => 'jenkinsci', :prefix => 'puppet' | |
github 'staging', :user => 'voxpupuli', :prefix => 'puppet' | |
github 'hosts', :user => 'ghoneycutt', :prefix => 'puppet-module' | |
EOF | |
/opt/puppetlabs/puppet/bin/r10k puppetfile install -v | |
### example site.pp to configure /etc/resolv.conf and /etc/hosts: | |
[root@puppet manifests]# cat /etc/puppetlabs/code/environments/production/manifests/site.pp | |
node default { | |
class { 'dnsclient': | |
nameservers => [ '8.8.8.8','8.8.4.4' ], | |
resolver_config_file_ensure => 'present', | |
} | |
class { 'hosts': | |
host_entries => { | |
'jenkins.example.local' => { ip => '192.168.1.101', host_aliases => 'jenkins' }, | |
'puppet.example.local' => { ip => '192.168.1.100', host_aliases => 'puppet' }, | |
'nginx.example.local' => { ip => '192.168.1.102', host_aliases => 'nginx' }, | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment