Skip to content

Instantly share code, notes, and snippets.

@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 / Jenkinsfile
Created May 2, 2018 11:25
Shared Library Example
@Library("vagrant_ansible") _
vagrant_ansible {
provider = 'docker'
distros = [ 'xenial', 'bionic' ]
}
@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'
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'
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
@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
## Configure httpd
class { 'apache':
default_vhost => true,
}