Update cookbooks and add wordpress cookbook

This commit is contained in:
Greg Karékinian
2016-02-19 18:09:49 +01:00
parent 9ba973e3ac
commit 820b0ab3f8
606 changed files with 22421 additions and 14084 deletions

View File

@@ -2,7 +2,7 @@
# Cookbook Name:: bluepill
# Provider:: service
#
# Copyright 2010, Opscode, Inc.
# Copyright 2010-2015, Chef Software, Inc.
# Copyright 2012, Heavy Water Operations, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -31,31 +31,30 @@ action :enable do
config_file = ::File.join(node['bluepill']['conf_dir'],
"#{new_resource.service_name}.pill")
unless @current_resource.enabled
converge_by("enable #{ @new_resource }") do
converge_by("enable #{@new_resource}") do
link "#{node['bluepill']['init_dir']}/#{new_resource.service_name}" do
to node['bluepill']['bin']
only_if { ::File.exists?(config_file) }
only_if { ::File.exist?(config_file) }
end
template_suffix = case node['platform_family']
when "rhel", "fedora", "freebsd" then node['platform_family']
when 'rhel', 'fedora', 'freebsd' then node['platform_family']
when 'debian' then 'lsb'
else nil
end
template "#{node['bluepill']['init_dir']}/bluepill-#{new_resource.service_name}" do
source "bluepill_init.#{template_suffix}.erb"
cookbook "bluepill"
owner "root"
cookbook 'bluepill'
owner 'root'
group node['bluepill']['group']
mode "0755"
mode '0755'
variables(
:service_name => new_resource.service_name,
:config_file => config_file
)
service_name: new_resource.service_name,
config_file: config_file
)
end if template_suffix
service "bluepill-#{new_resource.service_name}" do
action [ :enable ]
action [:enable]
end
end
end
@@ -63,14 +62,14 @@ end
action :load do
unless @current_resource.running
converge_by("load #{ @new_resource }") do
converge_by("load #{@new_resource}") do
shell_out!(load_command)
end
end
end
action :reload do
converge_by("reload #{ @new_resource }") do
converge_by("reload #{@new_resource}") do
shell_out!(stop_command) if @current_resource.running
shell_out!(load_command)
end
@@ -78,7 +77,7 @@ end
action :start do
unless @current_resource.running
converge_by("start #{ @new_resource }") do
converge_by("start #{@new_resource}") do
shell_out!(start_command)
end
end
@@ -86,7 +85,7 @@ end
action :disable do
if @current_resource.enabled
converge_by("disable #{ @new_resource }") do
converge_by("disable #{@new_resource}") do
file "#{node['bluepill']['conf_dir']}/#{new_resource.service_name}.pill" do
action :delete
end
@@ -99,7 +98,7 @@ end
action :stop do
if @current_resource.running
converge_by("stop #{ @new_resource }") do
converge_by("stop #{@new_resource}") do
shell_out!(stop_command)
end
end
@@ -107,7 +106,7 @@ end
action :restart do
if @current_resource.running
converge_by("restart #{ @new_resource }") do
converge_by("restart #{@new_resource}") do
Chef::Log.debug "Restarting #{new_resource.service_name}"
shell_out!(restart_command)
Chef::Log.debug "Restarted #{new_resource.service_name}"
@@ -154,20 +153,18 @@ def determine_current_status!
end
def service_running?
begin
if shell_out(status_command).exitstatus == 0
@current_resource.running true
Chef::Log.debug("#{new_resource} is running")
end
rescue Mixlib::ShellOut::ShellCommandFailed, SystemCallError
@current_resource.running false
nil
if shell_out(status_command).exitstatus == 0
@current_resource.running true
Chef::Log.debug("#{new_resource} is running")
end
rescue Mixlib::ShellOut::ShellCommandFailed, SystemCallError
@current_resource.running false
nil
end
def service_enabled?
if ::File.exists?("#{node['bluepill']['conf_dir']}/#{new_resource.service_name}.pill") &&
::File.symlink?("#{node['bluepill']['init_dir']}/#{new_resource.service_name}")
if ::File.exist?("#{node['bluepill']['conf_dir']}/#{new_resource.service_name}.pill") &&
::File.symlink?("#{node['bluepill']['init_dir']}/#{new_resource.service_name}")
@current_resource.enabled true
else
@current_resource.enabled false