diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2b97414 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +modules/* +.tmp/ +modules/ diff --git a/.librarian/puppet/config b/.librarian/puppet/config new file mode 100644 index 0000000..8906163 --- /dev/null +++ b/.librarian/puppet/config @@ -0,0 +1,2 @@ +--- + LIBRARIAN_PUPPET_DESTRUCTIVE: "false" \ No newline at end of file diff --git a/Puppetfile b/Puppetfile new file mode 100644 index 0000000..3727900 --- /dev/null +++ b/Puppetfile @@ -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' + diff --git a/Puppetfile.lock b/Puppetfile.lock new file mode 100644 index 0000000..609d6e9 --- /dev/null +++ b/Puppetfile.lock @@ -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) + diff --git a/bootstrap.sh b/bootstrap.sh new file mode 100644 index 0000000..2cfe74f --- /dev/null +++ b/bootstrap.sh @@ -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/ diff --git a/files/index.html b/files/index.html new file mode 100644 index 0000000..1e5a698 --- /dev/null +++ b/files/index.html @@ -0,0 +1,24 @@ + + + + + Hello World + + + + +

Hello World!

+ + diff --git a/files/keys/atomaka b/files/keys/atomaka new file mode 100644 index 0000000..bf1cf57 --- /dev/null +++ b/files/keys/atomaka @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDRwQ+1wZ4rSIQyAOG/G+4c9tKO4h716hQEiD95hw44TIQ4rdU1xqStEdV+vLgHpk/vFDC1gNlesRGh/PynEObPIbUdAypnSIg6qfLGCD0HcyGqU6dxzynQ8tgA23qLLMxGMG7kPjxSk3LVY6u+I/KHqArJjDqXcns7kN26LimJt4azHBI165Z7q+xuOtgDApdRecyvkIcjrl1oveHjOnVTZl1l78fqr1nTmvHkkeWGHxdM2IE2eFxGEpb6yyjNzxpX8JsFFXJiuq+fa+1Xj7dA3QZjV+BWUfhj2LSoOfWRgxy4oUhxfbDbOC+pBFWEKA1lDnRZ+nBIw1nXmF7hpBOx atomaka@gmail.com diff --git a/manifests/site.pp b/manifests/site.pp new file mode 100644 index 0000000..2a6127e --- /dev/null +++ b/manifests/site.pp @@ -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'], +}