-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
103 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# | ||
# Cookbook:: lampserver | ||
# Recipe:: lamp | ||
# | ||
# Copyright:: 2021, The Authors, All Rights Reserved. | ||
# recipe => lampserver::lamp | ||
|
||
# sudo apt update | ||
# https://docs.chef.io/resources/apt_update/ | ||
|
||
apt_update 'update packages' do | ||
ignore_failure true | ||
action :update | ||
end | ||
|
||
# sudo apt install apache2 -y | ||
# We can use apt_package resource or common package resource | ||
|
||
package 'apache2' do | ||
action :install | ||
end | ||
|
||
# sudo apt install php libapache2-mod-php php-mysql php-cli -y | ||
php_packages = %w(php libapache2-mod-php php-mysql php-cli) | ||
|
||
php_packages.each do |php_package| | ||
package php_package do | ||
action :install | ||
end | ||
end | ||
|
||
|
||
# echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/info.php | ||
|
||
file '/var/www/html/info.php' do | ||
content '<?php phpinfo(); ?>' | ||
action :create | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
require 'chefspec' | ||
require 'chefspec/berkshelf' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# | ||
# Cookbook:: . | ||
# Spec:: lamp | ||
# | ||
# Copyright:: 2021, The Authors, All Rights Reserved. | ||
|
||
require 'spec_helper' | ||
|
||
describe '.::lamp' do | ||
context 'When all attributes are default, on Ubuntu 20.04' do | ||
# for a complete list of available platforms and versions see: | ||
# https://github.com/chefspec/fauxhai/blob/master/PLATFORMS.md | ||
platform 'ubuntu', '20.04' | ||
|
||
it 'converges successfully' do | ||
expect { chef_run }.to_not raise_error | ||
end | ||
end | ||
|
||
context 'When all attributes are default, on CentOS 8' do | ||
# for a complete list of available platforms and versions see: | ||
# https://github.com/chefspec/fauxhai/blob/master/PLATFORMS.md | ||
platform 'centos', '8' | ||
|
||
it 'converges successfully' do | ||
expect { chef_run }.to_not raise_error | ||
end | ||
end | ||
end |
16 changes: 16 additions & 0 deletions
16
May21/cookbooks/lampserver/test/integration/default/lamp_test.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# InSpec test for recipe .::lamp | ||
|
||
# The Chef InSpec reference, with examples and extensive documentation, can be | ||
# found at https://docs.chef.io/inspec/resources/ | ||
|
||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters