Untested code for week 1
This commit is contained in:
parent
1d1ee39ca7
commit
41f635afaa
8 changed files with 137 additions and 0 deletions
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
modules/*
|
||||
.tmp/
|
||||
modules/
|
2
.librarian/puppet/config
Normal file
2
.librarian/puppet/config
Normal file
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
LIBRARIAN_PUPPET_DESTRUCTIVE: "false"
|
6
Puppetfile
Normal file
6
Puppetfile
Normal file
|
@ -0,0 +1,6 @@
|
|||
forge "http://forge.puppetlabs.com"
|
||||
|
||||
mod 'camptocamp/augeas', '0.0.1'
|
||||
mod 'puppetlabs/apache', '0.10.0'
|
||||
mod 'saz/ssh', '1.2.0'
|
||||
|
18
Puppetfile.lock
Normal file
18
Puppetfile.lock
Normal file
|
@ -0,0 +1,18 @@
|
|||
FORGE
|
||||
remote: http://forge.puppetlabs.com
|
||||
specs:
|
||||
camptocamp/augeas (0.0.1)
|
||||
puppetlabs/apache (0.10.0)
|
||||
puppetlabs/concat (>= 1.0.0)
|
||||
puppetlabs/stdlib (>= 2.4.0)
|
||||
puppetlabs/concat (1.1.0-rc1)
|
||||
puppetlabs/stdlib (>= 3.0.0)
|
||||
puppetlabs/stdlib (4.1.0)
|
||||
saz/ssh (1.2.0)
|
||||
puppetlabs/stdlib (>= 2.2.1)
|
||||
|
||||
DEPENDENCIES
|
||||
camptocamp/augeas (= 0.0.1)
|
||||
puppetlabs/apache (= 0.10.0)
|
||||
saz/ssh (= 1.2.0)
|
||||
|
36
bootstrap.sh
Normal file
36
bootstrap.sh
Normal file
|
@ -0,0 +1,36 @@
|
|||
#!/bin/bash
|
||||
|
||||
# TO BE RUN AS ROOT
|
||||
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
|
||||
echo "This script must be run as root"
|
||||
exit
|
||||
fi
|
||||
|
||||
# SET TIMESTAMP
|
||||
echo "America/New_York" | tee /etc/timezone
|
||||
dpkg-reconfigure --frontend noninteractive tzdata
|
||||
|
||||
# UPGRADE ALL CURRENT PACKAGES
|
||||
apt-get upgrade -y && apt-get dist-upgrade -y
|
||||
|
||||
# INSTALL GIT
|
||||
apt-get install git
|
||||
|
||||
# INSTALL PUPPET
|
||||
wget http://apt.puppetlabs.com/puppetlabs-release-precise.deb
|
||||
dpkg -i puppetlabs-release-precise.deb
|
||||
apt-get update
|
||||
apt-get install puppet -y
|
||||
|
||||
gem install librarian-puppet
|
||||
|
||||
# CLONE PUPPET REPOSITORY
|
||||
cd /tmp
|
||||
git clone https://github.com/atomaka/tc362.git puppet
|
||||
|
||||
# INSTALL MODULES
|
||||
cd puppet
|
||||
librarian-puppet install
|
||||
|
||||
# RUN MANIFEST
|
||||
puppet manifest apply manifests/site.pp --modulepath=modules/
|
24
files/index.html
Normal file
24
files/index.html
Normal file
|
@ -0,0 +1,24 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Hello World</title>
|
||||
<style>
|
||||
h1 {
|
||||
position: relative;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
|
||||
margin: 0;
|
||||
|
||||
text-align: center;
|
||||
color: white;
|
||||
background: black;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Hello World!</h1>
|
||||
</body>
|
||||
</html>
|
1
files/keys/atomaka
Normal file
1
files/keys/atomaka
Normal file
|
@ -0,0 +1 @@
|
|||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDRwQ+1wZ4rSIQyAOG/G+4c9tKO4h716hQEiD95hw44TIQ4rdU1xqStEdV+vLgHpk/vFDC1gNlesRGh/PynEObPIbUdAypnSIg6qfLGCD0HcyGqU6dxzynQ8tgA23qLLMxGMG7kPjxSk3LVY6u+I/KHqArJjDqXcns7kN26LimJt4azHBI165Z7q+xuOtgDApdRecyvkIcjrl1oveHjOnVTZl1l78fqr1nTmvHkkeWGHxdM2IE2eFxGEpb6yyjNzxpX8JsFFXJiuq+fa+1Xj7dA3QZjV+BWUfhj2LSoOfWRgxy4oUhxfbDbOC+pBFWEKA1lDnRZ+nBIw1nXmF7hpBOx atomaka@gmail.com
|
47
manifests/site.pp
Normal file
47
manifests/site.pp
Normal file
|
@ -0,0 +1,47 @@
|
|||
# USERS
|
||||
user { 'atomaka':
|
||||
ensure => 'present',
|
||||
groups => ['sudo'],
|
||||
managehome => true,
|
||||
shell => '/bin/zsh',
|
||||
require => Package['zsh'],
|
||||
}
|
||||
file { '/home/atomaka/.ssh':
|
||||
ensure => directory,
|
||||
owner => 'atomaka',
|
||||
group => 'atomaka',
|
||||
mode => '0700',
|
||||
require => User['atomaka'],
|
||||
}
|
||||
file { '/home/atomaka/.ssh/authorized_keys':
|
||||
ensure => present,
|
||||
owner => 'atomaka',
|
||||
group => 'atomaka',
|
||||
mode => '0600',
|
||||
content => file('/tmp/puppet/files/keys/atoamka'),
|
||||
require => File['/home/atomaka/.ssh'],
|
||||
}
|
||||
|
||||
# PACKAGES
|
||||
package { 'mosh': }
|
||||
package { 'zsh': }
|
||||
|
||||
# CLASSES
|
||||
include augeas
|
||||
|
||||
class { 'ssh::server':
|
||||
require => Class['augeas'],
|
||||
}
|
||||
class { 'apache': }
|
||||
|
||||
# CONFIGURATIONS
|
||||
ssh::server::configline { 'PermitRootLogin': value => 'no' }
|
||||
ssh::server::configline { 'PasswordAuthentication': value => 'no' }
|
||||
ssh::server::configline { 'AllowUsers/1': value => 'atomaka' }
|
||||
|
||||
# FILES
|
||||
file { '/var/www/index.html':
|
||||
ensure => present,
|
||||
content => file('/tmp/puppet/files/index.html'),
|
||||
require => Class['apache'],
|
||||
}
|
Loading…
Reference in a new issue