Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stellarsquall committed Dec 21, 2018
1 parent bd7b3db commit 7532bca
Show file tree
Hide file tree
Showing 24 changed files with 480 additions and 0 deletions.
16 changes: 16 additions & 0 deletions 07-4 Adding A Template/begin/workstation/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.vagrant
Berksfile.lock
*~
*#
.#*
\#*#
.*.sw[a-z]
*.un~

# Bundler
Gemfile.lock
bin/*
.bundle/*

.kitchen/
.kitchen.local.yml
21 changes: 21 additions & 0 deletions 07-4 Adding A Template/begin/workstation/.kitchen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
driver:
name: vagrant

provisioner:
name: chef_zero

verifier:
name: inspec

platforms:
- name: centos-6.7

suites:
- name: default
run_list:
- recipe[workstation::default]
verifier:
inspec_tests:
- test/recipes
attributes:
3 changes: 3 additions & 0 deletions 07-4 Adding A Template/begin/workstation/Berksfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source "https://supermarket.chef.io"

metadata
4 changes: 4 additions & 0 deletions 07-4 Adding A Template/begin/workstation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# workstation

TODO: Enter the cookbook description here.

95 changes: 95 additions & 0 deletions 07-4 Adding A Template/begin/workstation/chefignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Put files/directories that should be ignored in this file when uploading
# or sharing to the community site.
# Lines that start with '# ' are comments.

# OS generated files #
######################
.DS_Store
Icon?
nohup.out
ehthumbs.db
Thumbs.db

# SASS #
########
.sass-cache

# EDITORS #
###########
\#*
.#*
*~
*.sw[a-z]
*.bak
REVISION
TAGS*
tmtags
*_flymake.*
*_flymake
*.tmproj
.project
.settings
mkmf.log

## COMPILED ##
##############
a.out
*.o
*.pyc
*.so
*.com
*.class
*.dll
*.exe
*/rdoc/

# Testing #
###########
.watchr
.rspec
spec/*
spec/fixtures/*
test/*
features/*
Guardfile
Procfile

# SCM #
#######
.git
*/.git
.gitignore
.gitmodules
.gitconfig
.gitattributes
.svn
*/.bzr/*
*/.hg/*
*/.svn/*

# Berkshelf #
#############
Berksfile
Berksfile.lock
cookbooks/*
tmp

# Cookbooks #
#############
CONTRIBUTING

# Strainer #
############
Colanderfile
Strainerfile
.colander
.strainer

# Vagrant #
###########
.vagrant
Vagrantfile

# Travis #
##########
.travis.yml
8 changes: 8 additions & 0 deletions 07-4 Adding A Template/begin/workstation/metadata.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name 'workstation'
maintainer 'The Authors'
maintainer_email '[email protected]'
license 'all_rights'
description 'Installs/Configures workstation'
long_description 'Installs/Configures workstation'
version '0.2.1'

16 changes: 16 additions & 0 deletions 07-4 Adding A Template/begin/workstation/recipes/default.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#
# Cookbook Name:: workstation
# Recipe:: default
#
# Copyright (c) 2015 The Authors, All Rights Reserved.


#
# The default recipe is the recipe that the cookbook is know most for
# accomplishing. It is often the practice to use this file to include specific
# recipes that perform a specific task.
#
# @see http://docs.chef.io/recipes.html#include-recipes
#

include_recipe 'workstation::setup'
24 changes: 24 additions & 0 deletions 07-4 Adding A Template/begin/workstation/recipes/setup.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#
# Cookbook Name:: workstation
# Recipe:: setup
#
# Copyright (c) 2015 The Authors, All Rights Reserved.

package 'nano'
# or package 'vim-enhanced'

package 'ntp'

package 'git' do
action :install
end

file '/etc/motd' do
content "This server is the property of Chef
HOSTNAME: #{node['hostname']}
IPADDRESS: #{node['ipaddress']}
CPU: #{node['cpu']['0']['mhz']}
MEMORY: #{node['memory']['total']}
"
action :create
end
2 changes: 2 additions & 0 deletions 07-4 Adding A Template/begin/workstation/spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
require 'chefspec'
require 'chefspec/berkshelf'
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#
# Cookbook Name:: workstation
# Spec:: default
#
# Copyright (c) 2015 The Authors, All Rights Reserved.

require 'spec_helper'

describe 'workstation::default' do

context 'When all attributes are default, on an unspecified platform' do

let(:chef_run) do
runner = ChefSpec::ServerRunner.new
runner.converge(described_recipe)
end

it 'installs tree' do
expect(chef_run).to install_package('tree')
end

it 'creates an /etc/motd' do
expect(chef_run).to create_template('/etc/motd')
end

end
end
5 changes: 5 additions & 0 deletions 07-4 Adding A Template/begin/workstation/templates/motd.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
This server is the property of Chef
HOSTNAME: <%= node['hostname'] %>
IPADDRESS: <%= node['ipaddress'] %>
CPU: <%= node['cpu']['0']['mhz'] %>
MEMORY: <%= node['memory']['total'] %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# # encoding: utf-8

# Inspec test for recipe apache::default

# The Inspec reference, with examples and extensive documentation, can be
# found at https://docs.chef.io/inspec_reference.html

unless os.windows?
# This is an example test, replace with your own test.
describe user('root'), :skip do
it { should exist }
end
end

# This is an example test, replace it with your own test.
describe port(80), :skip do
it { should_not be_listening }
end

16 changes: 16 additions & 0 deletions 07-4 Adding A Template/end/workstation/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.vagrant
Berksfile.lock
*~
*#
.#*
\#*#
.*.sw[a-z]
*.un~

# Bundler
Gemfile.lock
bin/*
.bundle/*

.kitchen/
.kitchen.local.yml
21 changes: 21 additions & 0 deletions 07-4 Adding A Template/end/workstation/.kitchen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
driver:
name: vagrant

provisioner:
name: chef_zero

verifier:
name: inspec

platforms:
- name: centos-6.7

suites:
- name: default
run_list:
- recipe[workstation::default]
verifier:
inspec_tests:
- test/recipes
attributes:
3 changes: 3 additions & 0 deletions 07-4 Adding A Template/end/workstation/Berksfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source "https://supermarket.chef.io"

metadata
4 changes: 4 additions & 0 deletions 07-4 Adding A Template/end/workstation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# workstation

TODO: Enter the cookbook description here.

95 changes: 95 additions & 0 deletions 07-4 Adding A Template/end/workstation/chefignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Put files/directories that should be ignored in this file when uploading
# or sharing to the community site.
# Lines that start with '# ' are comments.

# OS generated files #
######################
.DS_Store
Icon?
nohup.out
ehthumbs.db
Thumbs.db

# SASS #
########
.sass-cache

# EDITORS #
###########
\#*
.#*
*~
*.sw[a-z]
*.bak
REVISION
TAGS*
tmtags
*_flymake.*
*_flymake
*.tmproj
.project
.settings
mkmf.log

## COMPILED ##
##############
a.out
*.o
*.pyc
*.so
*.com
*.class
*.dll
*.exe
*/rdoc/

# Testing #
###########
.watchr
.rspec
spec/*
spec/fixtures/*
test/*
features/*
Guardfile
Procfile

# SCM #
#######
.git
*/.git
.gitignore
.gitmodules
.gitconfig
.gitattributes
.svn
*/.bzr/*
*/.hg/*
*/.svn/*

# Berkshelf #
#############
Berksfile
Berksfile.lock
cookbooks/*
tmp

# Cookbooks #
#############
CONTRIBUTING

# Strainer #
############
Colanderfile
Strainerfile
.colander
.strainer

# Vagrant #
###########
.vagrant
Vagrantfile

# Travis #
##########
.travis.yml
Loading

0 comments on commit 7532bca

Please sign in to comment.