Skip to content

Instantly share code, notes, and snippets.

View cyberswat's full-sized avatar

Kevin Bridges cyberswat

View GitHub Profile
@cyberswat
cyberswat / complex_widget.info
Created January 27, 2011 22:05
complex_widget.info
; $Id$
name = complex widget
description = Example content type with a complex widget.
package = examples
core = 7.x
files[] = complex_widget.install
files[] = complex_widget.module
@cyberswat
cyberswat / gist:799394
Created January 27, 2011 22:11
hook_install
<?php
/**
* Implements hook_install().
*/
function complex_widget_install() {
// Create the content type using node_content as the base.
$t = get_t();
$node_type = array(
'type' => 'my_node_type',
'name' => $t('Complex widget example'),
@cyberswat
cyberswat / gist:799451
Created January 27, 2011 22:39
_complex_widget_installed_fields()
<?php
/**
* Return a structured array defining the fields created by this content type.
*
* This is packaged in a function so it can be used in both
* node_example_install() and node_example_uninstall().
*/
function _complex_widget_installed_fields() {
return array(
'complex_widget_variable' => array(
@cyberswat
cyberswat / gist:799489
Created January 27, 2011 23:02
_complex_widget_installed_instances()
<?php
/**
* Return a structured array defining the instances for this content type.
*
* This is provided as a function so that it can be used in both hook_install()
* and hook_uninstall().
*/
function _complex_widget_installed_instances() {
$types = array(t('number'), t('string'));
return array(
@cyberswat
cyberswat / ubuntu-puppetlabs-repo.sh
Created February 28, 2012 02:10
Install Puppet Repo on Ubuntu 10.04
# Add puppetlabs to /etc/apt/sources.list.d
echo -e "deb http://apt.puppetlabs.com/ubuntu lucid main\ndeb-src http://apt.puppetlabs.com/ubuntu lucid main" >> /etc/apt/sources.list.d/puppet.list
# Download the public key
apt-key adv --keyserver keyserver.ubuntu.com --recv 4BD6EC30
#Update apt
apt-get update
#Install puppet
@cyberswat
cyberswat / facter-fqdn.sh
Created February 28, 2012 03:37
facter get fqdn
# Log into the puppet client and execute facter
[root@li220-252 ~] facter | grep fqdn
fqdn => li220-252.members.linode.com
@cyberswat
cyberswat / puppetca-list-clean.sh
Created February 28, 2012 03:44
Use puppetca to list and remove certificates
# You can use puppetca --list fqdn for a specific fqdn or puppetca --list --all to show all
# This example shows that li220-252.members.linode.com exists
[root@puppet ~] puppetca --list li220-252.members.linode.com
+ li220-252.members.linode.com (88:80:14:7A:67:F6:A3:B8:F3:AB:7F:59:FC:8A:29:31)
# This example shows that li220-252.members.linode.com does not exist
[root@puppet ~] puppetca --list li220-252.members.linode.com
err: Could not call list: Could not find a certificate for li220-252.members.linode.com
# If the certificate already exists you should remove it before requesting a new connection
@cyberswat
cyberswat / puppet-sign-request.sh
Created February 28, 2012 03:58
Generate a puppet signing request
[root@li220-252:~] puppetd -t --server puppet.cyberswat.com
info: Creating a new SSL key for li220-252.members.linode.com
warning: peer certificate won't be verified in this SSL session
info: Caching certificate for ca
warning: peer certificate won't be verified in this SSL session
warning: peer certificate won't be verified in this SSL session
info: Creating a new SSL certificate request for li220-252.members.linode.com
info: Certificate Request fingerprint (md5): 52:32:81:19:B1:E4:89:83:13:CC:70:ED:C1:80:7A:5B
warning: peer certificate won't be verified in this SSL session
warning: peer certificate won't be verified in this SSL session
@cyberswat
cyberswat / puppet-master-sign.sh
Created February 28, 2012 04:00
Sign the certificate request on the puppet master
[root@puppet ~] puppetca --list
li220-252.members.linode.com (52:32:81:19:B1:E4:89:83:13:CC:70:ED:C1:80:7A:5B)
[root@puppet ~] puppetca --sign li220-252.members.linode.com
notice: Signed certificate request for li220-252.members.linode.com
notice: Removing file Puppet::SSL::CertificateRequest li220-252.members.linode.com at '/var/lib/puppet/ssl/ca/requests/li220-252.members.linode.com.pem'
@cyberswat
cyberswat / site.pp
Created February 28, 2012 04:51
A simple puppet site definition that inherits a base class
# This is the base node definition that all additional nodes should inherit.
node base {
include puppet
}
# regex is used to match the client fqdn
node /^li220-252.members.linode.com$/ inherits base {
include jenkins
}