Skip to content

Instantly share code, notes, and snippets.

## Configure httpd
class { 'apache':
default_vhost => true,
}
@boxrick
boxrick / gist:ae85da1eedd485930a37a3dfd6e08329
Created December 7, 2017 17:04
Ansible postinstall preseed
# Add in apt repository for Ansible 2.4 then install
echo "deb http://ppa.launchpad.net/ansible/ansible/ubuntu xenial main" > /etc/apt/sources.list.d/ansible-ubuntu-ansible-xenial.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7BB9C367
apt-get update
apt-get upgrade ansible -y
Generating a pub cert from your private key ( This is going to be stored inside Ansible mist under each user )
openssl req -x509 -new -key ~/.ssh/id_rsa -nodes -subj "/C=GB/ST=*/L=*/O=*/OU=*/CN=NAMEHERE/"
Encrypting some data against the above key(s)
echo STRINGTOENCRYPT | openssl smime -encrypt -aes256 -outform PEM /tmp/rick.CERT /tmp/james.CERT /tmp/stuartgr.CERT
Decrypting data
pipeline {
agent none
stages {
stage('Check Role') {
parallel {
stage('Test Xenial') {
agent any
steps {
sh 'cd tests && vagrant destroy --force || true'
sh 'cd tests && vagrant up --provider docker xenial'
@boxrick
boxrick / pipeline
Created April 30, 2018 18:04
Pipeline2
pipeline {
agent none
stages {
stage('Check Role') {
parallel {
stage('Test Xenial') {
agent any
steps {
dir('tests') {
sh 'vagrant destroy --force || true'
@boxrick
boxrick / Jenkinsfile
Created May 2, 2018 11:25
Shared Library Example
@Library("vagrant_ansible") _
vagrant_ansible {
provider = 'docker'
distros = [ 'xenial', 'bionic' ]
}
@boxrick
boxrick / Vagrantfile
Created May 4, 2018 14:41
Remote Vagrantfile Test
# Get current role name, and append branch name and build number if set
current_role = File.basename(File.expand_path("..", Dir.pwd))
if ENV['BRANCH_NAME'] && ENV['BUILD_NUMBER']
current_role << "-#{ENV['BRANCH_NAME']}-#{ENV['BUILD_NUMBER']}"
end
Vagrant.configure("2") do |config|
config.vm.define "bionic", primary: true do |bionic|
@boxrick
boxrick / vagrantfile
Created May 4, 2018 15:17
Remote Vagrantfile example
require 'open-uri'
require 'openssl'
url = 'https://remote.vagranturi/vagrantfile'
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
download = open(url)
IO.copy_stream(download, '.downloaded.vagrantfile')
@boxrick
boxrick / thread
Created May 11, 2018 10:39
Threaded example
import multiprocessing
from multiprocessing import Pool
from time import sleep
list_of_numbers = list(xrange(101))
def pull_role(stuff):
print('Sleeping ' + str(stuff))
sleep(0.1)
@boxrick
boxrick / example
Created May 14, 2018 13:46
example
pipelineJob('test2') {
logRotator {
numToKeep(10)
}
definition {
cps {
script("""
pipeline
{