Skip to content

Instantly share code, notes, and snippets.

View jessereynolds's full-sized avatar

Jesse Reynolds jessereynolds

  • Puppet
  • Melbourne, Victoria, Australia
View GitHub Profile
# Create a group in AD if it doesn't exist already
# Requires the 'ad-domain-services' windowsfeature to be installed, eg using the puppet/windowsfeature module:
# windowsfeature {'ad-domain-service':
# ensure => 'present',
# }
$username = 'jane'
$password = 'password'
$group_name = 'foo'
@jessereynolds
jessereynolds / all-in-one.pp
Last active March 2, 2017 05:14
windows-rename-and-domain-join
# Alternative idea - do the rename and domain join in one go (thanks Jessykah)
$username = 'jane'
$password = 'password'
$computer_name = 'foo'
$command_parts = [
'$username = "', $username, '" ; ',
'$password = ConvertTo-SecureString "', $password, '" -AsPlainText -Force ; ',
'$credentials = new-object System.Management.Automation.PSCredential($username,$password) ; ',
'if (Add-Computer -DomainName Sample.domain -Credential $credentials -NewName "', $computer_name, '") ',
@jessereynolds
jessereynolds / choco-nginx-uninstall.md
Last active February 9, 2017 01:08
chocolatey nginx uninstallation woes

Uninstalling via puppet seems to not work, but does via choco...

PS C:\puppetcode> puppet resource package nginx-service ensure=absent
package { 'nginx-service':
  ensure => 'absent',
}
PS C:\puppetcode> puppet resource package nginx
package { 'nginx':
  ensure => '1.6.2',
@jessereynolds
jessereynolds / vsphere no datacenter.md
Last active February 3, 2017 02:15
puppetlabs/vsphere module not seeing specified datacenter

/etc/puppetlabs/puppet/vcenter.conf

vcenter: {
  host: "vcenter5.example"
  port: "443"
  user: "foo"
  password: "password"
  datacenter: "BAR"
}
@jessereynolds
jessereynolds / _ hiera debug output.txt
Last active November 8, 2016 00:28
hiera 4 config syntax assuming environmentpath ?
$ hiera --debug --config hiera.yaml message
DEBUG: 2016-11-08 08:58:08 +1100: Hiera YAML backend starting
DEBUG: 2016-11-08 08:58:08 +1100: Looking up message in YAML backend
DEBUG: 2016-11-08 08:58:08 +1100: Looking for data source common
DEBUG: 2016-11-08 08:58:08 +1100: Cannot find datafile /etc/puppetlabs/code/environments//hieradata/common.yaml, skipping
nil
$ ls -ld hiera.yaml
-rw-r--r-- 1 jesse staff 245 7 Nov 10:16 hiera.yaml
p
#!/bin/bash
echo "Executing bash from a gist. You're very trusting."
@jessereynolds
jessereynolds / puppet-conflicting-environment.md
Created August 10, 2016 07:31
puppet node classified into groups that defined conflicting values for the environment

puppet enterprise - node was classified into groups that defined conflicting values for the environment

This often happens to me and some of the time I understand why and other times it just feels like it's impossible to understand what's going on.

On this occasion it looks like this:

State 1: node is classified into development environment and is happy.

Change: add node into a node group that has parent group Development and environment development (not an environment group)

@jessereynolds
jessereynolds / bamboo-rbenv.markdown
Last active August 1, 2016 02:30
Installing rbenv, ruby, bundler on Bamboo for Puppet testing

Installing rbenv, ruby, bundler on Bamboo

The following details how to install rbenv, ruby, bundler on a RHEL / CentOS Bamboo build agent.

On the bamboo agent/server machine, bamboo.example, install rbenv as per its docs:

yum install -y openssl-devel readline-devel zlib-devel
su - bamboo
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
@jessereynolds
jessereynolds / gist:fc3ca8fc71318639dd0930e0343debec
Last active July 25, 2016 03:03
502 gateway connection refused when trying to reset a password

nginx access.log

10.3.0.232 - - [25/Jul/2016:12:38:53 +1000] "POST /auth/reset HTTP/1.1" 502 172 "https://puppet.corporate.local/auth/reset?token=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJhZG1pbiIsInN1YiI6IjFmMzQ1MjI5LTIxZjktNDNjYy04YmNmLWVmZGU4N2U0Y2M5MyIsImV4cCI6MTQ2OTUwMDYzNywiaWF0IjoxNDY5NDE0MjM3fQ.SuOA-_c3f3otyDF-5LfmED2JioYo3BH5P3Jz_4r9EF4Z80tuz-pw8Z9eidJ8X7myiL4VoQF-sOQMs89ysxD7vh35ifgLnJnV7-2u3K6Ep1FdHHas_yRjdYSdEELJgHByNyqnSYQa5511f9wDYMZN_wyhbqCuXzbdUELjvVj27-sS0jEh2RZMi9Znp68473gwQGxziQkp_bWU1IJ9YJvPEjm29EQSg4Lm1l0b3FcjjdYeWxCE2XPshy294G1BC0KqFBigOZBTmgFBDze6X-4H0y12gk4l_i_TDLC6qZkKQsBR2D3ym4x68TKewS7lKXPX8I4BTswAQ3IIhKyOD4llbQu7QT_ju6DixXgDcZMXek2l4QlLrMev1u7KtMLWf6PSvA61JaKpii4lobgTewdzWm-WIDuU0nAcZHAVDNRe_KBuKbvuwhc15dg2D87WausU2B_lGAg4248f9tcjRfVAsdM4YoSOP6_3HCWScybPz5ABefwvyGGj_Asbs5ydLPUg5SsePG19h5s6d3eWBW4YMR3tRyrR52Leyuo7t2-o5dGmxGq2QEQs-SD_0f_BHeajHKQFbINzDdAyLSmdOLiQl4OvL95SOWICsAop64U0rG2GOp84YpwVTZ7IRuOkPrG5fbIP1fXGm4z98BjoJ6S2gEqIzfRFkhWfvJCNXWTtTTg" "Mozilla/5.0 (Macintosh;
@jessereynolds
jessereynolds / virtualbox_shared_folders_puppet_fundamentals.markdown
Last active July 20, 2016 21:23
Using Atom and Shared Folders in VirtualBox with the Puppet Fundamentals Student VM

Using Atom and Shared Folders in VirtualBox with the Puppet Fundamentals Student VM

First up, why might you want to do this? The main reason is this - you might prefer GUI text editors to command line text editors. Often when teaching Puppet Fundamentals some students will have littler or no command line experience and struggle with vim and nano. One alternative is to share a folder from your workstation (Mac, Windows or Linux) into the Linux vm we use for the course. This takes a little bit of setting up, which is where this document comes in.

An alternative to using shared folders, is to simply just use git to sync your local code up to the puppet master from your workstation.

Shared Folder Setup