First create a new module folder named for example sshd and inside it folder manifests. Then create init.pp file inside manifests with
$ sudo nano init.pp
inside init.pp write this:
class sshd {
package { 'openssh-server':
ensure => "installed",
}
file { '/etc/ssh/sshd_config':
content => template("/home/xubuntu/Templates/sshd_template.erb"),
require => Package["openssh-server"],
notify => Service["ssh"],
}
service { 'ssh':
ensure => 'running',
enable => 'true',
require => Package["openssh-server"],
hasstatus => 'false',
status => "/etc/init.d/ssh status|grep running",
}
}
Then create new template file in /home/xubuntu/Templates/sshd_template.erb inside the .erb file put your own sshd config file.
Run puppet with: $ sudo puppet apply -e "include sshd"
Ei kommentteja:
Lähetä kommentti