Skip to content

Instantly share code, notes, and snippets.

Ansible Puppet
Modules Ships with a lot of modules Modules have to be installed from Puppet Forge.
Syntax Uses YAML Custom DSL
Architecture Only SSH connection required Push change Client - server architecture Pull catalogs from the master
Programming approach or style Procedural Declarative
Templating Uses Jinja 2 Possibility for both Puppet and Ruby templates
Reporting Limited Extensive reporting with dashboard available
Node classification Simple and straightforward More complicated
node ‘orion-ug-africell-staging.staging.com’ {
$data_folder = ‘scala-deploy’
$config = {
project => ‘orion’,
environment => ‘staging’,
network => ‘AfricellUganda’,
bind_ip => $facts[‘ipaddress_eth0’],
service_name => ‘orion-web’,
}
@ianjuma
ianjuma / orion.pp
Last active January 2, 2018 13:15
orion
orion:
time: now # time to deploy — now for now, 4 a.m for 4 a.m EAT
branch: master # branch to pull from and listen for notifications on
channel: orion-deploy
production: false # immediate deployment on staging — not prod
owner: [user1,ian] # users allowed to interact with slack requests for orion
separate-build: true # to be built/compiled on diff machine — for all scala projects
many: true # if many is false — many is > 1
concurrent: no
instances:
@ianjuma
ianjuma / enc.pp
Last active January 2, 2018 13:16
node ‘orion-ug-staging.staging.com’ {
$data_folder = ‘scala-deploy’ # if in hydra group — set type to hydra
$config = {
project => ‘orion’,
environment => ‘staging’,
network => ‘MtnUganda’,
bind_ip => $facts[‘ipaddress_eth0’],
service_name => ‘orion-web’,
}
@ianjuma
ianjuma / send.php
Last active February 28, 2017 12:37
<?php
$from = $_POST['from'];
$to = $_POST['to'];
$text = $_POST['text'];
$date = $_POST['date'];
$id = $_POST['id'];
$linkId = $_POST['linkId'];
if(!empty($_POST['from'])) {
require_once('AfricasTalkingGateway.php');
from flask import Flask
from flask import jsonify
from flask import request
app = Flask('the-box-library')
books = [{
'name': 'Harry Potter and the prisoner of Azkaban',
'author': 'JK. Rowling',
'category': 'Magic / Fiction',
val aopMerge = new sbtassembly.MergeStrategy {
val name = "aopMerge"
import scala.xml._
import scala.xml.dtd._
def apply(tempDir: File, path: String, files: Seq[File]): Either[String, Seq[(File, String)]] = {
val dt = DocType("aspectj", PublicID("-//AspectJ//DTD//EN", "http://www.eclipse.org/aspectj/dtd/aspectj.dtd"), Nil)
val file = MergeStrategy.createMergeTarget(tempDir, path)
val xmls: Seq[Elem] = files.map(XML.loadFile)
val aspectsChildren: Seq[Node] = xmls.flatMap(_ \\ "aspectj" \ "aspects" \ "_")
@ianjuma
ianjuma / Dockerfile
Created September 8, 2016 10:40
Scala dockerfile
#
# Scala and sbt Dockerfile
#
# https://github.com/hseeberger/scala-sbt
#
# Pull base image
FROM java:8
ENV SCALA_VERSION 2.11.8
@ianjuma
ianjuma / ussd.rb
Last active August 10, 2016 11:41
require 'sinatra'
require 'AfricasTalkingGateway'
# gateway = AfricasTalkingGateway.new("username", "apikey");
post '/ussd' do
@sessionId = params[:sessionId]
@serviceCode = params[:serviceCode]
@phoneNumber = params[:phoneNumber]
@text = params[:text]
@app.route('/api/voice/callback/', methods=['POST'])
def voice_callback():
is_active = request.values.get('isActive', None)
session_id = request.values.get('sessionId', None)
caller_number = request.values.get('callerNumber', None)
direction = request.values.get('direction', None)
destination = request.values.get('destination', None)
if isActive:
r.hset(destination, 'phoneNumber', caller_number)