Merge pull request #2 from atomaka/atomaka/feature/week2

Week 2 Lab
This commit is contained in:
Andrew Tomaka 2014-01-22 08:35:50 -08:00
commit 592f20c2de
4 changed files with 96 additions and 20 deletions

View file

@ -4,15 +4,7 @@
<meta charset="utf-8"> <meta charset="utf-8">
<title>Hello World</title> <title>Hello World</title>
<style> <style>
html {
height: 100%;
background: gray;
}
body { body {
width: 500px;
min-height: 100%;
margin: auto; margin: auto;
padding: 5px; padding: 5px;
@ -54,14 +46,14 @@
<body> <body>
<div> <div>
[<span class="time">16:01:42</span>] [<span class="time">16:01:42</span>]
<span class="username">atomaka</span>@<span class="server">162.243.226.212</span> <span class="username">atomaka</span>@<span class="server">tc362.atomaka.com</span>
<span class="pwd">~</span><br/> <span class="pwd">~</span><br/>
|<span class="good-prompt">-&gt;</span> Hello World<br/> |<span class="good-prompt">-&gt;</span> Hello World<br/>
zsh: command not found: Hello zsh: command not found: Hello
</div> </div>
<div> <div>
[<span class="time">16:02:10</span>] [<span class="time">16:02:10</span>]
<span class="username">atomaka</span>@<span class="server">162.243.226.212</span> <span class="username">atomaka</span>@<span class="server">tc362.atomaka.com</span>
<span class="pwd">~</span><br/> <span class="pwd">~</span><br/>
|<span class="bad-prompt">-&gt;</span> <span class="cursor">&nbsp;</span> |<span class="bad-prompt">-&gt;</span> <span class="cursor">&nbsp;</span>
</div> </div>

View file

@ -1,10 +1,16 @@
# GROUPS
group { 'web':
ensure => present,
}
# USERS # USERS
# atomaka, with SSH key
user { 'atomaka': user { 'atomaka':
ensure => 'present', ensure => present,
groups => ['sudo'], groups => ['sudo', 'web'],
managehome => true, managehome => true,
shell => '/bin/zsh', shell => '/bin/zsh',
require => Package['zsh'], require => [ Package['zsh'], Group['web'] ]
} }
file { '/home/atomaka/.ssh': file { '/home/atomaka/.ssh':
ensure => directory, ensure => directory,
@ -21,6 +27,15 @@ file { '/home/atomaka/.ssh/authorized_keys':
content => file('/tmp/puppet/files/keys/atomaka'), content => file('/tmp/puppet/files/keys/atomaka'),
require => File['/home/atomaka/.ssh'], require => File['/home/atomaka/.ssh'],
} }
# jeff, with password
user { 'jeff':
ensure => present,
groups => ['web'],
managehome => true,
shell => '/bin/bash',
password => '$6$.AURF9sE09Q$..S10CFY7G.AVXzSW//w6GoV6yPzBzdvyUl8a7oyYbW/XzBU.o6AdHxTgTkCSWb64zmN3QoKovoUyLJhE/MFP/',
require => Group['web'],
}
# PACKAGES # PACKAGES
package { 'mosh': } package { 'mosh': }
@ -33,21 +48,61 @@ include sudo
class { 'ssh::server': class { 'ssh::server':
require => Class['augeas'], require => Class['augeas'],
} }
class { 'apache': }
class { 'apache':
default_vhost => false,
}
# CONFIGURATIONS # CONFIGURATIONS
ssh::server::configline { 'Port': value => '22984' }
ssh::server::configline { 'PermitRootLogin': value => 'no' } ssh::server::configline { 'PermitRootLogin': value => 'no' }
ssh::server::configline { 'PasswordAuthentication': value => 'no' } ssh::server::configline { 'PasswordAuthentication': value => 'yes' }
ssh::server::configline { 'AllowUsers/1': value => 'atomaka' } ssh::server::configline { 'AllowUsers/1': value => 'atomaka' }
ssh::server::configline { 'AllowUsers/2': value => 'jeff' }
sudo::conf { 'sudo': sudo::conf { 'sudo':
priority => 10, priority => 10,
content => "%sudo ALL=(ALL) NOPASSWD: ALL\n", content => "%sudo ALL=(ALL) NOPASSWD: ALL\n",
} }
# FILES apache::vhost { 'tc362.atomaka.com':
file { '/var/www/index.html': default_vhost => true,
ensure => present, port => '80',
content => file('/tmp/puppet/files/index.html'), docroot => '/var/www/tc362.atomaka.com',
require => Class['apache'], docroot_owner => 'atomaka',
docroot_group => 'web',
}
# FILES
file { '/var/www/tc362.atomaka.com':
ensure => directory,
owner => 'atomaka',
group => 'web',
mode => '2775',
before => Apache::Vhost['tc362.atomaka.com'],
}
file { '/var/www/tc362.atomaka.com/index.html':
ensure => present,
owner => 'atomaka',
group => 'web',
mode => '0664',
content => file('/tmp/puppet/files/index.html'),
require => File['/var/www/tc362.atomaka.com'],
}
file { '/home/atomaka/web':
ensure => link,
owner => 'atomaka',
group => 'atomaka',
target => '/var/www/tc362.atomaka.com',
require => [ User['atomaka'], File['/var/www/tc362.atomaka.com'] ],
}
file { '/home/jeff/web':
ensure => link,
owner => 'jeff',
group => 'jeff',
target => '/var/www/tc362.atomaka.com',
require => [ User['jeff'], File['/var/www/tc362.atomaka.com'] ],
} }

28
update.sh Normal file
View file

@ -0,0 +1,28 @@
#!/bin/bash
# UPDATE SCRIPT - on a more clever day, I might merge this with bootstrap.sh
# 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
# 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/

1
week2/ip.txt Normal file
View file

@ -0,0 +1 @@
162.243.226.212