Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

upgraded to vagrant 2.0

  • Loading branch information...
commit 11b3246154d6cf7edc68b1cceb2fb01d26ba6921 1 parent f62739c
@openmason openmason authored
View
41 Vagrantfile
@@ -1,26 +1,38 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
-Vagrant::Config.run do |config|
+Vagrant.configure("2") do |config|
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "precise64"
# Forward a port from the guest to the host, which allows for outside
# computers to access the VM, whereas host only networking does not.
- config.vm.forward_port 80, 8080
-
- # Share an additional folder to the guest VM. The first argument is
- # an identifier, the second is the path on the guest to mount the
- # folder, and the third is the path on the host to the actual folder.
- #config.vm.share_folder "v-root", "/vagrant", "."
- config.vm.share_folder "app", "/home/vagrant/app", "app"
- config.vm.host_name = "dev-nodejs"
-
- # allow for symlinks in the app folder
- config.vm.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/app", "1"]
- config.vm.customize do |vm|
- vm.memory_size = 1024
+ config.vm.network :forwarded_port, guest: 80, host: 8080, auto_correct: true
+
+ #The first parameter is a path to a directory on the host machine. If
+ #the path is relative, it is relative to the project root. The second
+ #parameter must be an absolute path of where to share the folder within
+ #the guest machine. This folder will be created (recursively, if it
+ #must) if it doesn't exist
+ #config.vm.synced_folder "src/", "/srv/website"
+ config.vm.synced_folder "app", "/home/vagrant/app"
+
+ config.vm.provider :virtualbox do |v|
+ # Setting VM name and increasing RAM size
+ v.customize [
+ "modifyvm", :id,
+ "--memory", "1024",
+ "--name" , "devnodejs"
+ ]
+ # Boot with a GUI so you can see the screen. (Default is headless)
+ # v.gui = true
+
+ # without this symlinks can't be created on the shared folder
+ v.customize [
+ "setextradata", :id,
+ "VBoxInternal2/SharedFoldersEnableSymlinksCreate/app", "1"
+ ]
end
# Enable provisioning with chef solo, specifying a cookbooks path, roles
@@ -38,6 +50,7 @@ Vagrant::Config.run do |config|
# add roles
chef.add_role("db_master")
chef.add_role("webserver")
+ chef.add_role("monit")
# add mysite to webserver
chef.add_recipe("mysite")
View
1  cookbooks/monit/LICENSE
@@ -0,0 +1 @@
+Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
View
130 cookbooks/monit/README.md
@@ -0,0 +1,130 @@
+Overview
+========
+
+Chef cookbook for the [monit](http://mmonit.com/monit/) monitoring and
+management tool. This cookbook has been updated to configure services
+defined in a data bag.
+
+This cookbook was forked from [StudyBlue/monit](https://github.com/StudyBlue/monit), version 0.7.
+
+Attributes
+==========
+
+
+* `default[:monit][:services]` - List of items from the _monit_ data bag that describe services monitored by monit. For more info, see *Usage* below.
+* `default[:monit][:logfile]` - The file to which monit logs are written
+* `default[:monit][:notify][:enable]` - enable email notifications
+* `default[:monit][:notify][:email]` - the email to which notifications are sent.
+* `default[:monit][:httpd][:enable]` - enable the http server
+* `default[:monit][:httpd][:port]` - port on which the http server listens
+* `default[:monit][:httpd][:address]` - the address to which the server binds
+* `default[:monit][:httpd][:allow]` - the addresses from which connections are allowed (default `%w{localhost}`)
+* `default[:monit][:httpd][:signature]` - either "enable" or "disable". Determines whether monit shows a signature
+* `default[:monit][:httpd][:basic_auth_accounts]` - An array of `admin:"password"` entries that are used for HTTP Basic Auth. Not the quotes around the password; these are required.
+* `default[:monit][:poll_period]` - the time (in seconds) between poll cycles
+* `default[:monit][:poll_start_delay]` - the amount of time (in seconds) before monit starts polling services.
+* `default[:monit][:mail][:server]` - host on which the smtp mail server runs
+* `default[:monit][:mail][:port]` - The port on which the SMTP server runs (default is 25)
+* `default[:monit][:mail][:username]` - Username for an SMTP account
+* `default[:monit][:mail][:password]` - Password for an SMTP account
+* `default[:monit][:mail][:security]` - Send secure email. Must be one of: SSLV2, SSLV3 or TLSV1
+* `default[:monit][:mail][:checksum]` - SMTP Server certificat checksum (optional)
+* `default[:monit][:mail][:timeout]` - The timeout (in seconds) for sending mail
+* `default[:monit][:mail][:use_node_fqdn]` - Whether or not to use the node's FQDN in as the hostname (default is `false`)
+* `default[:monit][:mail][:format][:subject]` - default subject for emails from monit
+* `default[:monit][:mail][:format][:from]` - email address from which messages are sent
+* `default[:monit][:mail][:format][:message]` - template for messages (see `attributes/default.rb` for details)
+* `default[:monit][:queue][:location]` - base directory where events will be stored
+* `default[:monit][:queue][:slots]` - limit the size of the queue; this is the number of messages that will be held
+
+Usage
+=====
+
+Right now, this cookbook only supports simple process monitoring. To set up process monitors, create a `monit` data bag, and create items that look similar to the following:
+
+This would be `data_bags/monit/monit_services.json`:
+
+ {
+ "id": "monit_services",
+ "postgresql": {
+ "process_name": "postgres",
+ "pidfile": "/var/run/postgresql/9.1-main.pid",
+ "start_command":"/usr/sbin/service postgresql start",
+ "stop_command": "/usr/sbin/service postgresql stop",
+ "check_port": "5432",
+ "check_protocol": "pgsql",
+ "check_times": 2,
+ "within_cycles": 3,
+ "then_action": "restart"
+ },
+ "supervisor": {
+ "process_name": "supervisor",
+ "pidfile": "/var/run/supervisord.pid",
+ "start_command":"/etc/init.d/supervisor start",
+ "stop_command":"/etc/init.d/supervisor stop",
+ "check_socket": "/var/run/supervisor.sock",
+ "check_times": 1,
+ "within_cycles": 2,
+ "then_action": "restart"
+ }
+ }
+
+This item would set up a monitor for the `postgres` and `supervisor` processes. Note that it checks for PostgreSQL using a TCP port while Supervisor uses a Unix socket.
+
+This would result in the following:
+* `/etc/monit/conf.d/postgresql.conf`:
+
+ CHECK PROCESS postgres WITH PIDFILE /var/run/postgresql/9.1-main.pid
+ START PROGRAM "/usr/sbin/service postgresql start"
+ STOP PROGRAM "/usr/sbin/service postgresql stop"
+ IF FAILED PORT 5432 PROTOCOL pgsql 2 TIMES WITHIN 3 CYCLES THEN restart
+
+* `/etc/monit/conf.d/supervisor.conf`:
+
+ CHECK PROCESS supervisor WITH PIDFILE /var/run/supervisord.pid
+ START PROGRAM "/etc/init.d/supervisor start"
+ STOP PROGRAM "/etc/init.d/supervisor stop"
+ IF FAILED unixsocket /var/run/supervisor.sock 1 TIMES WITHIN 2 CYCLES THEN restart
+
+You can then set up a role, and override any of the existing attributes, and specify any data bag items taht will be used to set up service monitoring.
+
+You might have a `monit` role that looks like:
+
+ name "monit"
+ description "Monit role"
+ run_list(
+ "recipe[monit::default]",
+ "recipe[monit::services]"
+ )
+
+ default_attributes(
+ "monit" => {
+ "services" => ["monit_services", ],
+ }
+ )
+
+
+History
+=======
+
+version 0.8.1
+-------------
+ * added additional SMTP configuration
+ * added additional HTTPD configuration
+
+version 0.8
+-----------
+ * added more generic services recipes that pulls configuration data from a data bag
+ * only supporting Ubuntu/Debian
+ * removed postfix/ssh recipes
+
+version 0.7
+-----------
+ * create /etc/monit/conf.d. Thanks Karel Minarik (https://github.com/karmi)
+
+version 0.6
+-----------
+ * Released to github
+ * Defaults no alert on ACTION event.
+ When you manually stop/start a service, alerting me about what I just did isn't useful.
+
View
39 cookbooks/monit/attributes/default.rb
@@ -0,0 +1,39 @@
+default[:monit][:services] = [] # List of items from the "monit" data bag that
+ # describe services monitored by monit.
+default[:monit][:logfile] = "syslog facility log_daemon"
+
+# The following is a list of events for which monit will send notifications:
+default[:monit][:notify][:events] = []
+default[:monit][:notify][:negate_events]= false # if true, will negate the list of notification events
+default[:monit][:notify][:enable] = false # set true to send alerts
+default[:monit][:notify][:email] = "notify@example.com" # address to which alerts are sent
+
+default[:monit][:httpd][:enable] = true
+default[:monit][:httpd][:port] = 3737
+default[:monit][:httpd][:address] = nil # hosts can only connect from this address; monit defaults to "localhost"
+default[:monit][:httpd][:allow] = nil # default: %w{localhost}
+default[:monit][:httpd][:signature] = "enable" # or disable
+default[:monit][:httpd][:basic_auth_accounts] = [] # a list of 'admin:"password"' entries to use for BasicAuth
+ # the quotes around the password are required!
+
+default[:monit][:poll_period] = 60
+default[:monit][:poll_start_delay] = 120
+
+default[:monit][:mail][:server] = "localhost"
+default[:monit][:mail][:port] = "25"
+default[:monit][:mail][:username] = nil
+default[:monit][:mail][:password] = nil
+default[:monit][:mail][:security] = nil # SSLV2, SSLV3 or TLSV1
+default[:monit][:mail][:checksum] = nil # the server certificate checksum
+default[:monit][:mail][:timeout] = "5" # timeout in seconds for the mail server
+default[:monit][:mail][:use_node_fqdn] = false # Use the Node's FQDN for "using hostname"
+default[:monit][:mail][:format][:subject] = "$SERVICE $EVENT"
+default[:monit][:mail][:format][:from] = nil # defaults to "monit@hostname"
+default[:monit][:mail][:format][:message] = <<-EOS
+Monit $ACTION $SERVICE at $DATE on $HOST: $DESCRIPTION.
+Yours sincerely,
+monit
+EOS
+
+default[:monit][:queue][:location] = "/var/monit" # base directory where events will be stored
+default[:monit][:queue][:slots] = nil # limit the size of the queue
View
11 cookbooks/monit/files/ubuntu/monit.default
@@ -0,0 +1,11 @@
+# Defaults for monit initscript
+# sourced by /etc/init.d/monit
+# installed at /etc/default/monit by chef
+
+# You must set this variable to for monit to start
+startup=1
+
+# To change the intervals which monit should run,
+# edit the configuration file /etc/monit/monitrc
+# It can no longer be configured here.
+
View
13 cookbooks/monit/metadata.rb
@@ -0,0 +1,13 @@
+maintainer "Brad Montgomery"
+maintainer_email "bmontgomery@coroutine.com"
+license "MIT"
+description "Configures monit. Originally based off the 37 Signals Cookbook."
+long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
+version "0.8.5"
+
+recipe "monit::default", "install/configure monit"
+recipe "monit::services", "configure services for monit to monitor"
+
+%w{ ubuntu debian }.each do |os|
+ supports os
+end
View
42 cookbooks/monit/recipes/default.rb
@@ -0,0 +1,42 @@
+package "monit"
+
+if platform?("ubuntu")
+ cookbook_file "/etc/default/monit" do
+ source "monit.default"
+ owner "root"
+ group "root"
+ mode 0644
+ end
+end
+
+service "monit" do
+ action [:enable, :start]
+ enabled true
+ supports [:start, :restart, :stop]
+end
+
+directory "/etc/monit/conf.d" do
+ owner 'root'
+ group 'root'
+ mode 0755
+ action :create
+ recursive true
+end
+
+template "/etc/monit/monitrc" do
+ owner "root"
+ group "root"
+ mode 0700
+ source 'monitrc.erb'
+ variables(
+ :logfile => node["monit"]["logfile"],
+ :notify => node["monit"]["notify"],
+ :httpd => node["monit"]["httpd"],
+ :poll_period => node["monit"]["poll_period"],
+ :poll_start_delay => node["monit"]["poll_start_delay"],
+ :mail => node["monit"]["mail"],
+ :queue => node["monit"]["queue"],
+ :config_directory => "/etc/monit/conf.d"
+ )
+ notifies :restart, resources(:service => "monit"), :delayed
+end
View
31 cookbooks/monit/recipes/services.rb
@@ -0,0 +1,31 @@
+include_recipe "monit::default"
+
+#
+# Pulls the appropriate configs from the "monit" data bag.
+# These should be specified in a role.
+#
+
+node['monit']['services'].each do |item_name|
+ search(:monit, "id:#{item_name}") do |services|
+
+ services.each do |service, service_config|
+
+ # Don't use the monitrc definition. Instead,
+ # just write a new template.
+ if service != "id"
+ template "/etc/monit/conf.d/#{service}.conf" do
+ owner "root"
+ group "root"
+ mode 0644
+ source "services.conf.erb"
+ variables(
+ "service" => service,
+ "conf" => service_config
+ )
+ notifies :restart, resources(:service => "monit"), :delayed
+ action :create
+ end
+ end
+ end
+ end
+end
View
54 cookbooks/monit/templates/default/monitrc.erb
@@ -0,0 +1,54 @@
+set daemon <%= @poll_period %> with start delay <%= @poll_start_delay %>
+
+<% unless @logfile.nil? %>set logfile <%= @logfile %><% end %>
+
+set eventqueue
+ basedir <%= @queue[:location] %>
+ <% unless @queue[:slots].nil? %>slots <%= @queue[:slots] %><% end %>
+
+<% unless @mail[:server].nil? %>
+set mailserver <%= @mail[:server] %>
+ <%= "PORT #{@mail[:port]}" unless not @mail[:port] %>
+ <% if @mail[:username] && @mail[:password] -%>
+ USERNAME <%= @mail[:username] %> PASSWORD "<%= @mail[:password] %>"
+ <% end -%>
+ <%= "USING #{@mail[:security]}" unless not @mail[:security] %>
+ <%= "CERTMD5 #{@mail[:checksum]}" unless not @mail[:checksum] %>
+ <%= "with TIMEOUT #{@mail[:timeout]} SECONDS" unless not @mail[:timeout] %>
+ <%= "using HOSTNAME #{@node.fqdn}" unless not @mail[:use_node_fqdn] %>
+
+set mail-format {
+ <% if @mail[:format][:from] %>from: <%= @mail[:format][:from] %>
+ <% else %>from: monit@<%= @node.fqdn %><% end %>
+ subject: <%= @mail[:format][:subject] %>
+ message: <%= @mail[:format][:message].to_s.strip %>
+}
+<% end %>
+
+<% if @notify[:enable] %>
+set alert <%= @notify[:email] %> <%= "NOT" if @notify[:negate_events] -%> ON {
+ <%= @notify[:events].join(", ") %>
+}
+<% end %>
+
+<% if @httpd[:enable] %>
+set httpd port <%= @httpd[:port] %> and
+ <% if @httpd[:address] %>
+ use address <%= @httpd[:address] %>
+ <% end %>
+ <% if @httpd[:allow] %>
+ <% @httpd[:allow].each do |allow| %>
+ allow <%= allow %>
+ <% end %>
+ <% end %>
+ signature <%= @httpd[:signature] %>
+ <% @httpd[:basic_auth_accounts].each do |auth| %>
+ <%#
+ NOTE: auth entries are of the form "username:password", but passwords
+ need to be quoted in the monit config: 'username:"password"'
+ -%>
+ allow <%= auth.split(":").first -%>:"<%= auth.split(":").last -%>"
+ <% end %>
+<% end %>
+
+include <%= @config_directory %>/*.conf
View
4 cookbooks/monit/templates/default/services.conf.erb
@@ -0,0 +1,4 @@
+CHECK PROCESS <%= @conf["process_name"] %> WITH PIDFILE <%= @conf["pidfile"] %>
+ START PROGRAM "<%= @conf["start_command"] %>"
+ STOP PROGRAM "<%= @conf["stop_command"] %>"
+ IF FAILED <% if @conf["check_port"] %>PORT <%= @conf["check_port"] %><% elsif @conf["check_socket"] %>unixsocket <%= @conf["check_socket"] %><% end %><% if @conf["check_protocol"] %> PROTOCOL <%= @conf["check_protocol"] %><% end %><% if @conf["check_times"] && @conf["within_cycles"] %> <%= @conf["check_times"] %> TIMES WITHIN <%= @conf["within_cycles"] %> CYCLES<% end %><% if @conf["then_action"] %> THEN <%= @conf["then_action"] %><% end %>
View
4 cookbooks/nodejs/recipes/install_from_package.rb
@@ -32,7 +32,7 @@
options '--nogpgcheck'
end
- %w{ nodejs nodejs-compat-symlinks npm }.each do |pkg|
+ %w{ nodejs nodejs-compat-symlinks }.each do |pkg|
package pkg
end
when 'ubuntu'
@@ -45,7 +45,7 @@
action :add
end
- %w{ nodejs npm }.each do |pkg|
+ %w{ nodejs }.each do |pkg|
package pkg
end
else
View
2  cookbooks/users/CONTRIBUTING
@@ -15,7 +15,7 @@ modify the version number in the metadata.rb. Also please do not
update the CHANGELOG.md for a new version. Not all changes to a
cookbook may be merged and released in the same versions. Opscode will
handle the version updates during the release process. You are welcome
-to correct typos or otherwise make updates to documentation in the
+to correct typos or otherwise make updates documentation in the
README.
If a contribution adds new platforms or platform versions, indicate
View
26 cookbooks/users/README.md
@@ -13,12 +13,12 @@ Platform
* CentOS, Red Hat, Fedora
* FreeBSD
-A data bag populated with user objects must exist. The default data bag in this recipe is `users`. See USAGE.
+A data bag populated with user objects must exist. The default data bag in this recipe is "users". See USAGE.
Usage
=====
-This cookbook is specific for setting up `sysadmin` group and users for now.
+This cookbook is specific for setting up sysadmin group and users for now.
include_recipe "users::sysadmins"
@@ -26,20 +26,12 @@ Use knife to create a data bag for users.
knife data bag create users
-Create a user in the data_bag/users/ directory.
-
-When using an [Omnibus ruby](http://tickets.opscode.com/browse/CHEF-2848), one can specify an optional password hash. This
-will be used as the user's password.
-
-The hash can be generated with the following command.
-
- openssl passwd -1 "plaintextpassword"
+Create a user.
knife data bag users bofh
{
"id": "bofh",
"ssh_keys": "ssh-rsa AAAAB3Nz...yhCw== bofh",
- "password": "$1$d...HgH0",
"groups": [ "sysadmin", "dba", "devops" ],
"uid": 2001,
"shell": "\/bin\/bash",
@@ -64,7 +56,7 @@ Remove a user, johndoe1.
* Note only user bags with the "action : remove" and a search-able "group" attribute will be purged by the :remove action.
-The default recipe makes use of the `users_manage` Lightweight Resource Provider (LWRP), and looks like this:
+The default recipe makes use of the "users_manage" Lightweight Resource Provider (LWRP), and looks like this:
```
@@ -74,16 +66,16 @@ The default recipe makes use of the `users_manage` Lightweight Resource Provider
end
```
-Note this LWRP searches the `users` data bag for the `sysadmin` group attribute, and adds those users to a Unix security group `sysadmin`. The only required attribute is group_id, which represents the numeric Unix gid and *must* be unique. The default action for the LWRP is `:create` only.
+Note this LWRP searches the "users" data bag for the "sysadmin" group attribute, and adds those users to a Unix security group "sysadmin". The only required attribute is group_id, which represents the numeric Unix gid and *must* be unique. The default action for the LWRP is ":create" only.
If you have different requirements, for example:
* You want to search a different data bag specific to a role such as mail. You may change the data_bag searched.
- - data_bag `mail`
- * You want to search for a different group attribute named `postmaster`. You may change the search_group attribute. This attribute defaults to the LWRP resource name.
- - search_group `postmaster`
+ - data_bag "mail"
+ * You want to search for a different group attribute named "postmaster". You may change the search_group attribute. This attribute defaults to the LWRP resource name.
+ - search_group "postmaster"
* You want to add the users to a security group other than the lightweight resource name. You may change the group_name attribute. This attribute also defaults to the LWRP resource name.
- - group_name `wheel`
+ - group_name "wheel"
Putting these requirements together our recipe might look like this:
View
115 cookbooks/users/providers/manage.rb
@@ -1,5 +1,5 @@
#
-# Cookbook Name:: users
+# Cookbook Name:: users
# Provider:: manage
#
# Copyright 2011, Eric G. Wolfe
@@ -24,92 +24,81 @@ def initialize(*args)
end
action :remove do
- if Chef::Config[:solo]
- Chef::Log.warn("This recipe uses search. Chef Solo does not support search.")
- else
- search(new_resource.data_bag, "groups:#{new_resource.search_group} AND action:remove") do |rm_user|
- user rm_user['id'] do
- action :remove
- end
+ search("#{new_resource.data_bag}", "groups:#{new_resource.search_group} AND action:remove") do |rm_user|
+ user rm_user['id'] do
+ action :remove
end
- new_resource.updated_by_last_action(true)
end
end
action :create do
security_group = Array.new
- if Chef::Config[:solo]
- Chef::Log.warn("This recipe uses search. Chef Solo does not support search.")
- else
- search(new_resource.data_bag, "groups:#{new_resource.search_group} AND NOT action:remove") do |u|
- security_group << u['id']
+ search("#{new_resource.data_bag}", "groups:#{new_resource.search_group} NOT action:remove") do |u|
+ security_group << u['id']
- if node['apache'] and node['apache']['allowed_openids']
- Array(u['openid']).compact.each do |oid|
- node['apache']['allowed_openids'] << oid unless node['apache']['allowed_openids'].include?(oid)
- end
+ if node[:apache] and node[:apache][:allowed_openids]
+ Array(u['openid']).compact.each do |oid|
+ node[:apache][:allowed_openids] << oid unless node[:apache][:allowed_openids].include?(oid)
end
+ end
- # Set home to location in data bag,
- # or a reasonable default (/home/$user).
- if u['home']
- home_dir = u['home']
- else
- home_dir = "/home/#{u['id']}"
+ # Set home to location in data bag,
+ # or a reasonable default (/home/$user).
+ if u['home']
+ home_dir = u['home']
+ else
+ home_dir = "/home/#{u['id']}"
+ end
+
+ # The user block will fail if the group does not yet exist.
+ # See the -g option limitations in man 8 useradd for an explanation.
+ # This should correct that without breaking functionality.
+ if u['gid'] and u['gid'].kind_of?(Numeric)
+ group u['id'] do
+ gid u['gid']
end
+ end
- # The user block will fail if the group does not yet exist.
- # See the -g option limitations in man 8 useradd for an explanation.
- # This should correct that without breaking functionality.
- if u['gid'] and u['gid'].kind_of?(Numeric)
- group u['id'] do
- gid u['gid']
- end
+ # Create user object.
+ # Do NOT try to manage null home directories.
+ user u['id'] do
+ uid u['uid']
+ if u['gid']
+ gid u['gid']
end
+ shell u['shell']
+ comment u['comment']
+ if home_dir == "/dev/null"
+ supports :manage_home => false
+ else
+ supports :manage_home => true
+ end
+ home home_dir
+ end
- # Create user object.
- # Do NOT try to manage null home directories.
- user u['id'] do
- uid u['uid']
- if u['gid']
- gid u['gid']
- end
- shell u['shell']
- comment u['comment']
- password u['password'] if u['password']
- if home_dir == "/dev/null"
- supports :manage_home => false
- else
- supports :manage_home => true
- end
- home home_dir
+ if home_dir != "/dev/null"
+ directory "#{home_dir}/.ssh" do
+ owner u['id']
+ group u['gid'] || u['id']
+ mode "0700"
end
- if home_dir != "/dev/null"
- directory "#{home_dir}/.ssh" do
+ if u['ssh_keys']
+ template "#{home_dir}/.ssh/authorized_keys" do
+ source "authorized_keys.erb"
+ cookbook new_resource.cookbook
owner u['id']
group u['gid'] || u['id']
- mode "0700"
- end
-
- if u['ssh_keys']
- template "#{home_dir}/.ssh/authorized_keys" do
- source "authorized_keys.erb"
- cookbook new_resource.cookbook
- owner u['id']
- group u['gid'] || u['id']
- mode "0600"
- variables :ssh_keys => u['ssh_keys']
- end
+ mode "0600"
+ variables :ssh_keys => u['ssh_keys']
end
end
end
end
- group new_resource.group_name do
+ group "#{new_resource.group_name}" do
gid new_resource.group_id
members security_group
end
- new_resource.updated_by_last_action(true)
end
View
5 cookbooks/users/resources/manage.rb
@@ -30,8 +30,3 @@
attribute :group_name, :kind_of => String, :name_attribute => true
attribute :group_id, :kind_of => Integer, :required => true
attribute :cookbook, :kind_of => String, :default => "users"
-
-def initialize(*args)
- super
- @action = :create
-end
View
14 data_bags/monit/monit_services.json
@@ -0,0 +1,14 @@
+{
+ "id": "monit_services",
+ "nginx": {
+ "process_name": "nginx",
+ "pidfile": "/var/run/nginx.pid",
+ "start_command":"/etc/init.d/nginx start",
+ "stop_command": "/etc/init.d/nginx stop",
+ "check_port": "80",
+ "check_protocol": "http",
+ "check_times": 1,
+ "within_cycles": 2,
+ "then_action": "restart"
+ }
+}
View
6 readme.md
@@ -23,6 +23,12 @@ Following softwares are installed to the vbox
### Console
* vagrant ssh
+### Start
+ * vagrant up
+
+### Stop
+ * vagrant halt
+
### Node.js App
* The sample app is in 'app' directory
* ssh to virtualbox
View
21 roles/monit.rb
@@ -0,0 +1,21 @@
+name "monit"
+description "Monit role"
+all_env = [
+ "recipe[monit::default]",
+ "recipe[monit::services]"
+]
+
+default_attributes(
+ "monit" => {
+ "services" => ["monit_services"]
+ }
+)
+
+run_list(all_env)
+
+env_run_lists(
+ "_default" => all_env,
+ "prod" => all_env,
+ "dev" => all_env
+)
+
Please sign in to comment.
Something went wrong with that request. Please try again.