commit
84e7e9d23b
9 changed files with 208 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"
|
7
Puppetfile
Normal file
7
Puppetfile
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
forge "http://forge.puppetlabs.com"
|
||||||
|
|
||||||
|
mod 'camptocamp/augeas', '0.0.1'
|
||||||
|
mod 'puppetlabs/apache', '0.10.0'
|
||||||
|
mod 'saz/ssh', '1.2.0'
|
||||||
|
mod 'saz/sudo', '2.4.3'
|
||||||
|
|
20
Puppetfile.lock
Normal file
20
Puppetfile.lock
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
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)
|
||||||
|
saz/sudo (2.4.3)
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
camptocamp/augeas (= 0.0.1)
|
||||||
|
puppetlabs/apache (= 0.10.0)
|
||||||
|
saz/ssh (= 1.2.0)
|
||||||
|
saz/sudo (= 2.4.3)
|
||||||
|
|
49
bootstrap.sh
Normal file
49
bootstrap.sh
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# BOOSTRAP SCRIPT
|
||||||
|
# Can take a single param to allow a specific branch to be installed
|
||||||
|
BRANCH=$1
|
||||||
|
|
||||||
|
# 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 -y
|
||||||
|
|
||||||
|
# INSTALL RUBYGEMS
|
||||||
|
apt-get install rubygems -y
|
||||||
|
|
||||||
|
# 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
|
||||||
|
rm -rf puppet
|
||||||
|
git clone https://github.com/atomaka/tc362.git puppet
|
||||||
|
cd puppet
|
||||||
|
|
||||||
|
if [ "$BRANCH" != "" ]; then
|
||||||
|
git fetch
|
||||||
|
git checkout $BRANCH
|
||||||
|
fi
|
||||||
|
|
||||||
|
# INSTALL MODULES
|
||||||
|
librarian-puppet install
|
||||||
|
|
||||||
|
# RUN MANIFEST
|
||||||
|
puppet apply manifests/site.pp --modulepath=modules/
|
69
files/index.html
Normal file
69
files/index.html
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Hello World</title>
|
||||||
|
<style>
|
||||||
|
html {
|
||||||
|
height: 100%;
|
||||||
|
background: gray;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
width: 500px;
|
||||||
|
min-height: 100%;
|
||||||
|
|
||||||
|
margin: auto;
|
||||||
|
padding: 5px;
|
||||||
|
|
||||||
|
background: black;
|
||||||
|
|
||||||
|
color: white;
|
||||||
|
font-size: 10pt;
|
||||||
|
font-family: "Lucida Console", Monaco, monospace
|
||||||
|
}
|
||||||
|
|
||||||
|
.time {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.username {
|
||||||
|
color: green;
|
||||||
|
}
|
||||||
|
.server {
|
||||||
|
color: yellow;
|
||||||
|
}
|
||||||
|
.pwd {
|
||||||
|
color: dodgerblue;
|
||||||
|
}
|
||||||
|
.bad-prompt {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
.good-prompt {
|
||||||
|
color: green;
|
||||||
|
}
|
||||||
|
.cursor {
|
||||||
|
width: 8px;
|
||||||
|
height: 15px;
|
||||||
|
display: inline-block;
|
||||||
|
|
||||||
|
background: white;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div>
|
||||||
|
[<span class="time">16:01:42</span>]
|
||||||
|
<span class="username">atomaka</span>@<span class="server">162.243.226.212</span>
|
||||||
|
<span class="pwd">~</span><br/>
|
||||||
|
|<span class="good-prompt">-></span> Hello World<br/>
|
||||||
|
zsh: command not found: Hello
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
[<span class="time">16:02:10</span>]
|
||||||
|
<span class="username">atomaka</span>@<span class="server">162.243.226.212</span>
|
||||||
|
<span class="pwd">~</span><br/>
|
||||||
|
|<span class="bad-prompt">-></span> <span class="cursor"> </span>
|
||||||
|
</div>
|
||||||
|
</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
|
53
manifests/site.pp
Normal file
53
manifests/site.pp
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
# 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/atomaka'),
|
||||||
|
require => File['/home/atomaka/.ssh'],
|
||||||
|
}
|
||||||
|
|
||||||
|
# PACKAGES
|
||||||
|
package { 'mosh': }
|
||||||
|
package { 'zsh': }
|
||||||
|
|
||||||
|
# CLASSES
|
||||||
|
include augeas
|
||||||
|
include sudo
|
||||||
|
|
||||||
|
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' }
|
||||||
|
|
||||||
|
sudo::conf { 'sudo':
|
||||||
|
priority => 10,
|
||||||
|
content => "%sudo ALL=(ALL) NOPASSWD: ALL\n",
|
||||||
|
}
|
||||||
|
|
||||||
|
# FILES
|
||||||
|
file { '/var/www/index.html':
|
||||||
|
ensure => present,
|
||||||
|
content => file('/tmp/puppet/files/index.html'),
|
||||||
|
require => Class['apache'],
|
||||||
|
}
|
4
week1/hello.txt
Normal file
4
week1/hello.txt
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
162.243.226.212
|
||||||
|
|
||||||
|
The rest of the week 1 lab assignment can be found in branch
|
||||||
|
atomaka/feature/week1 and tagged Week 1.
|
Loading…
Reference in a new issue