Skip to content

Instantly share code, notes, and snippets.

View salgo's full-sized avatar

Andy Gale salgo

View GitHub Profile
#
# Cookbook Name:: web-base
# Recipe:: yum-webtatic
#
# Copyright 2014, Hello Future Ltd
#
# All rights reserved - Do Not Redistribute
#
rpm_path = File.join(Chef::Config[:file_cache_path], 'webtatic_repo_latest.rpm')
node.default['mysql']['client']['packages'] = ['mysql55w', 'mysql55w-devel']
node.default['php']['packages'] = ['php54w', 'php54w-devel', 'php54w-cli', 'php54w-pear']
packages = %w{php54w-mysql php54w-mcrypt php54w-pdo php54w-xml php54w-gd}
conflicting_packages = %w{mysql-libs}
if conflicting_packages
conflicting_packages.each do |p|
package p do
action :remove
end
$dns_hack = <<SCRIPT
echo "; generated by /sbin/dhclient-script
search home
nameserver 8.8.8.8
" > /etc/resolv.conf
SCRIPT
Vagrant.configure("2") do |config|
machine 'db' do
recipe 'mysql'
end
machine 'web1' do
recipe 'apache'
end
@salgo
salgo / gist:8d0631b5c41d09bb47b8
Created October 2, 2014 09:22
Little bit of bash to create a new tag for a Chef cookbook
#!/usr/bin/env bash
VERSION=`grep 'version' metadata.rb | grep -o "[0-9.]" | tr -d '\n'''`
git tag -a $VERSION -m $VERSION
git push origin --tags
@salgo
salgo / gist:3208d2d29d13881e03d1
Created October 6, 2014 09:25
Little bit of bash to remove the current cookbook tag :)
#!/usr/bin/env bash
VERSION=`grep 'version' metadata.rb | grep -o "[0-9.]" | tr -d '\n'''`
git tag -d $VERSION
git push origin :refs/tags/$VERSION
@salgo
salgo / curl-test.php
Created October 7, 2014 14:06
Funky bit of PHP for testing curl
<?php
if ($argc == 1) {
die("Specify a url!");
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $argv[1]);
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
Hi Andy,
Yes certainly, I need some information from you please:
Address:
Contact number:
Card details to confirm the booking, you can call with these if you wish,
Card type:
require 'spec_helper'
describe package('httpd'), :if => os[:family] == 'redhat' do
it { should be_installed }
end
describe package('apache2'), :if => os[:family] == 'ubuntu' do
it { should be_installed }
end
execute 'create-ssh-key-' + account_id do
user account_id
cwd user_home
environment(
'HOME' => user_home,
'USER' => account_id
)
command 'ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa'
not_if { ::File.exist?(File.join(user_home, '.ssh', 'id_rsa')) }
end