forked from pgolm/ansible-role-monit
-
Notifications
You must be signed in to change notification settings - Fork 2
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
3 changed files
with
77 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.vagrant/ |
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,24 @@ | ||
# -*- mode: ruby -*- | ||
# vi: set ft=ruby ts=2 sw=2 tw=0 et : | ||
|
||
vmname = File.basename(File.expand_path(File.dirname(__FILE__))) | ||
|
||
Vagrant.configure("2") do |config| | ||
config.vm.define vmname do |ap| | ||
ap.vm.box = "opscode-debian-7.4.0" | ||
ap.vm.box_url = "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_debian-7.4.0_chef-provisionerless.box" | ||
ap.vm.hostname = vmname | ||
|
||
ap.vm.provider "virtualbox" do |v| | ||
v.customize ["modifyvm", :id, "--cpuexecutioncap", "50"] | ||
v.customize ["modifyvm", :id, "--memory", 512] | ||
end | ||
|
||
ap.vm.network :private_network, ip: "10.0.0.40" | ||
|
||
ap.vm.provision :ansible do |ansible| | ||
ansible.playbook = "#{vmname}.yml" | ||
ansible.verbose = "vvvv" | ||
end | ||
end | ||
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,52 @@ | ||
--- | ||
- hosts: all | ||
sudo: yes | ||
|
||
vars: | ||
monit_services: | ||
- process: sshd | ||
pidfile: /var/run/sshd.pid | ||
start: /usr/sbin/service sshd start | ||
stop: /usr/sbin/service sshd stop | ||
rules: | ||
- "if failed port 22 protocol ssh then restart" | ||
- "if 5 restarts within 5 cycles then timeout" | ||
- process: apache | ||
pidfile: /var/run/apache2.pid | ||
start: /usr/sbin/service apache2 start | ||
stop: /usr/sbin/service apache2 stop | ||
rules: | ||
- "if failed port 80 protocol http then restart" | ||
- "if 5 restarts within 5 cycles then timeout" | ||
monit_webinterface_enabled: true | ||
monit_webinterface_acl_rules: | ||
- "localhost" | ||
monit_webinterface_bind: 127.0.0.1 | ||
monit_mail_enabled: true | ||
monit_mailserver_host: localhost | ||
monit_mailserver_port: 25 | ||
monit_mailserver_user: root | ||
monit_mailserver_password: root | ||
monit_alert_address: [email protected] | ||
monit_alert_mail_from: vagrant@localhost | ||
monit_alert_mail_subject: alert | ||
monit_alert_mail_message: |+ | ||
$EVENT Service $SERVICE | ||
Date: $DATE | ||
Action: $ACTION | ||
Host: $HOST | ||
Description: $DESCRIPTION | ||
Your faithful employee, | ||
Monit | ||
pre_tasks: | ||
- name: testing - install apache | ||
apt: | ||
pkg: apache2 | ||
update_cache: yes | ||
cache_valid_time: 3600 | ||
state: installed | ||
|
||
roles: | ||
- . | ||
|