7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/rspec-system-puppet/helpers/puppet_install.rb', line 7
def execute
node = opts[:node]
facts = node.facts
if facts['osfamily'] == 'Debian'
log.info("Remove 'mesg n' from profile to stop noise")
shell :c => "sed -i 's/^mesg n/# mesg n/' /root/.profile", :n => node
end
log.info "Starting installation of puppet from PL repos"
if facts['osfamily'] == 'RedHat'
if facts['operatingsystem'] == 'Fedora'
shell :c => 'sed -i "0,/RE/s/enabled=0/enabled=1/" /etc/yum.repos.d/fedora-updates-testing.repo', :n => node
else
if facts['operatingsystemrelease'] =~ /^6\./
shell :c => 'rpm -ivh http://yum.puppetlabs.com/el/6/products/x86_64/puppetlabs-release-6-7.noarch.rpm', :n => node
else
shell :c => 'rpm -ivh http://yum.puppetlabs.com/el/5/products/x86_64/puppetlabs-release-5-7.noarch.rpm', :n => node
end
end
shell :c => 'yum install -y puppet', :n => node
elsif facts['osfamily'] == 'Debian'
shell :c => "wget http://apt.puppetlabs.com/puppetlabs-release-#{facts['lsbdistcodename']}.deb", :n => node
shell :c => "dpkg -i puppetlabs-release-#{facts['lsbdistcodename']}.deb", :n => node
shell :c => 'apt-get update', :n => node
shell :c => 'apt-get install -y puppet', :n => node
end
log.info("Preparing modules dir")
shell :c => 'mkdir -p /etc/puppet/modules', :n => node
pp = <<-EOS
host { 'puppet':
ip => '127.0.0.1',
}
EOS
puppet_apply :code => pp, :n => node
file = Tempfile.new('hierayaml')
begin
file.write(<<-EOS)
---
:logger: noop
EOS
file.close
rcp(:sp => file.path, :dp => '/etc/puppet/hiera.yaml', :d => node)
ensure
file.unlink
end
{}
end
|