Skip to content

Commit

Permalink
Testing with vagrant.
Browse files Browse the repository at this point in the history
  • Loading branch information
mtpereira committed Nov 6, 2014
1 parent c8620e5 commit ed9f0d8
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.vagrant/
24 changes: 24 additions & 0 deletions Vagrantfile
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
52 changes: 52 additions & 0 deletions ansible-monit.yml
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:
- .

0 comments on commit ed9f0d8

Please sign in to comment.