forked from onlineTrainingguy/DevOpsNotes
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Puppet installation
146 lines (106 loc) · 2.92 KB
/
Puppet installation
1
2
3
4
5
6
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
PUPPET INSTALLATION
PUPPET INSTALLATION ON UBUNTU
Installing Puppet Master
Step 1: Run the following commands for installing Puppet Master
$ sudo apt-get update
$ sudo apt-get install wget
$ wget https://apt.puppetlabs.com/puppet-release-bionic.deb
$ sudo dpkg -i puppet-release-bionic.deb
$ sudo apt-get update
$ sudo apt-get install puppet-master
$ sudo systemctl status puppet-master.service
Add the following lines in the puppet-master configuration file
Next open port 8140 on the Puppet Master’s firewall
$ sudo nano /etc/default/puppet-master
JAVA_ARGS="-Xms512m Xmx512m"
$ sudo systemctl restart puppet-master
$ sudo ufw allow 8140/tcp
Installing Puppet Agent
Step 2: Run the following commands for installing Puppet Agent
$ sudo apt-get update
$ sudo apt-get install wget
$ wget https://apt.puppetlabs.com/puppet-release-bionic.deb
$ sudo dpkg -i puppet-release-bionic.deb
$ sudo apt-get install puppet
$ sudo nano /etc/hosts
add ip address of the master
$ sudo systemctl start puppet
$ sudo systemctl enable puppet
Step 3: Make changes to the hosts file which exists in /etc/hosts. And add the Puppet
Master IP address along with the name “puppet”
$ sudo nano /etc/hosts
Step 4: Create the following directory path:
$ sudo mkdir -p /etc/puppet/code/environments/production/manifests
Configuring Puppet Slave
Step 1: Add the entry for Puppet Master in /etc/hosts
Step 2: Finally start the Puppet agent by using the following command. Also, enable the
service, so that it starts when the computer starts
$ sudo systemctl start puppet
$ sudo systemctl enable puppet
On Master
$ sudo puppet cert list
Step 2: Finally, sign the listed certificate using the following command:
$ sudo puppet cert sign --all
On master machine create /etc/puppet/code/environments/production/manifests/site.pp
node default{
package {'nginx':
ensure => installed,
}
file { '/tmp/status.txt':
content => 'installed',
mode => '0644',
}
}
Goto client machine and run the command
puppet agent --test
---Variable
node default{
package {'nginx':
ensure => installed,
}
$test = "ok"
file { '/tmp/status.txt':
content => $test,
mode => '0644',
}
}
---------------
Loops
-------------
node default{
$packages = ['apache2','mysql-server']
package {$packages:
ensure => installed,
}
}
----create user
node default{
user { 'raman':
ensure => present,
uid => '1101',
shell => '/bin/bash',
}
}
--Create user with class
class user {
user { 'test':
ensure => present,
}
}
node default{
class {user:}
}
---Create user with the parameter
class user_account ($username){
user { $username:
ensure => present,
uid => '1011',
shell => '/bin/bash',
home => "/home/$username",
}
}
node default {
class { user_account:
username => "raman",
}
}