Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Progress on level 5

  • Loading branch information...
commit 0bdb06ecb9a5a19389106de11fcbb6effafaa84b 1 parent 31dee51
Dan Jackson authored
33 Vagrantfile
... ... @@ -1,27 +1,26 @@
1 1 # -*- mode: ruby -*-
2 2 # vi: set ft=ruby :
3 3
  4 +# Helper method to do all common Vagrant config for a given level number
  5 +def configure(vm_config, number)
  6 + vm_config.vm.network :hostonly, "192.168.33.10#{number}"
  7 + vm_config.vm.host_name = "level0#{number}-1.stripe-ctf.com"
  8 +
  9 + vm_config.vm.provision :puppet do |puppet|
  10 + puppet.manifests_path = "puppet"
  11 + puppet.module_path = "puppet/modules"
  12 + puppet.manifest_file = "site.pp"
  13 + end
  14 +end
  15 +
4 16 Vagrant::Config.run do |config|
5 17 config.vm.box = "stripe-ctf-base"
6 18 config.vm.box_url = "https://www.dropbox.com/s/qhdb95prfjqh2r9/stripe-ctf-base-v2.box"
7 19
8   - config.vm.define :level2 do |level2_config|
9   - level2_config.vm.network :hostonly, "192.168.33.102"
10   - level2_config.vm.host_name = "level02-1.stripe-ctf.com"
11   -
12   - level2_config.vm.provision :puppet do |puppet|
13   - puppet.manifests_path = "puppet"
14   - puppet.module_path = "puppet/modules"
15   - puppet.manifest_file = "site.pp"
16   - end
  20 + config.vm.define :level2 do |box_config|
  21 + configure(box_config, "2")
17 22 end
18   -
19   - config.vm.define :level5 do |level5_config|
20   - level5_config.vm.network :hostonly, "192.168.33.105"
21   -
22   - level5_config.vm.provision :puppet do |puppet|
23   - puppet.manifests_path = "puppet/manifests"
24   - puppet.manifest_file = "level05.pp"
25   - end
  23 + config.vm.define :level5 do |box_config|
  24 + configure(box_config, "5")
26 25 end
27 26 end
5 puppet/modules/stripectf2/manifests/level02.pp
@@ -7,6 +7,11 @@
7 7 enable => true,
8 8 hasrestart => true,
9 9 }
  10 +
  11 + # Disable the default apache2 site
  12 + stripectf2::apache2_site {'000-default':
  13 + ensure => 'absent',
  14 + }
10 15
11 16 file {$destination:
12 17 ensure => 'directory',
64 puppet/modules/stripectf2/manifests/level05.pp
... ... @@ -1,39 +1,33 @@
1   -package { 'bundler':
2   - ensure => 'latest',
3   - provider => 'gem',
4   -}
5   -
6   -file {'/level5':
7   - ensure => 'directory',
8   -}
  1 +class stripectf2::level05 (
  2 + $destination,
  3 + $source,
  4 +) {
  5 + file {$destination:
  6 + ensure => 'directory',
  7 + recurse => true,
  8 + purge => true,
  9 + force => true,
  10 + mode => '0755',
  11 + owner => 'vagrant',
  12 + group => 'vagrant',
  13 + source => $source,
  14 + }
9 15
10   -file {'/level5/production':
11   - ensure => 'present',
12   - content => '',
13   -}
14   -
15   -file {'/level5/srv.rb':
16   - ensure => 'present',
17   - source => '/vagrant/levels/5/srv.rb',
18   -}
  16 + # This file tells our service to run in production mode
  17 + file {"${destination}/production":
  18 + ensure => 'present',
  19 + content => '',
  20 + require => File[$destination]
  21 + }
19 22
20   -file {'/level5/Gemfile':
21   - ensure => 'present',
22   - source => '/vagrant/levels/5/Gemfile',
23   -}
24   -
25   -file {'/level5/Gemfile.lock':
26   - ensure => 'present',
27   - source => '/vagrant/levels/5/Gemfile.lock',
28   -}
29   -
30   -file {'/level5/password.txt':
31   - ensure => 'present',
32   - content => 'some-password',
33   -}
  23 + stripectf2::random_password {"${destination}/password.txt":
  24 + require => File[$destination],
  25 + }
34 26
35   -service {'srv.rb':
36   - ensure => 'running',
37   - start => 'cd /level5 && bundle install && ./srv.rb &',
38   - provider => 'base',
  27 + service {'srv.rb':
  28 + ensure => 'running',
  29 + start => "cd ${destination} && bundle install && ./srv.rb &",
  30 + provider => 'base',
  31 + require => File[$destination]
  32 + }
39 33 }
7 puppet/nodes/level05.pp
... ... @@ -0,0 +1,7 @@
  1 +node 'level05-1.stripe-ctf.com' {
  2 + class {'stripectf2::level05':
  3 + destination => '/levels/05',
  4 + source => '/vagrant/levels/5',
  5 + require => File['/levels'],
  6 + }
  7 +}
4 puppet/site.pp
@@ -17,8 +17,4 @@
17 17 group => 'vagrant',
18 18 }
19 19
20   -# Disable the default apache2 site
21   -stripectf2::apache2_site {'000-default':
22   - ensure => 'absent',
23   -}
24 20

0 comments on commit 0bdb06e

Please sign in to comment.
Something went wrong with that request. Please try again.