Skip to content

Instantly share code, notes, and snippets.

View jrisch's full-sized avatar
🏠
Working from home

Juri Rischel Jensen jrisch

🏠
Working from home
View GitHub Profile
== Rules ==
On Infrastructure
-----------------
There is one system, not a collection of systems.
The desired state of the system should be a known quantity.
The "known quantity" must be machine parseable.
The actual state of the system must self-correct to the desired state.
The only authoritative source for the actual state of the system is the system.
The entire system must be deployable using source media and text files.
require 'rubygems'
require 'resque'
require 'resque/job_with_status' # in rails you would probably do this in an initializer
Resque.redis = "resque-dev.v50.loc:6379"
# sleeps for _length_ seconds updating the status every second
class SleepJob < Resque::JobWithStatus
def perform
---
- hosts: localhost
connection: local
gather_facts: no
tasks:
- name: Test
local_action: shell /usr/local/bin/pwgen -s 14 1
register: password
- hosts: balancers
user: root
tags: deploy
tasks: [ ]
- hosts: prod
serial: 1
tasks:
- name: Upload DB dump to prod
[local]
localhost
[prod]
web01 ansible_ssh_host=xx.xx.xx.xx ansible_ssh_port=2222 ansible_ssh_private_key_file=sshkey
web02 ansible_ssh_host=xx.xx.xx.xx ansible_ssh_port=2223 ansible_ssh_private_key_file=sshkey
[balancers]
lb01 ansible_ssh_host=xx.xx.xx.xx ansible_ssh_private_key_file=sshkey ansible_python_interpreter=/usr/local/bin/python2.7
lb02 ansible_ssh_host=xx.xx.xx.xx ansible_ssh_private_key_file=sshkey ansible_python_interpreter=/usr/local/bin/python2.7
@jrisch
jrisch / keybase.md
Last active August 29, 2015 14:21
Keybase.md

Keybase proof

I hereby claim:

  • I am jrisch on github.
  • I am jrisch (https://keybase.io/jrisch) on keybase.
  • I have a public key whose fingerprint is 46DA 8CEE 5C0A 7029 4E2F CF04 B45A 50EC E8C5 A4FD

To claim this, I am signing this object:

@jrisch
jrisch / vmtypes.csv
Last active November 30, 2017 09:45
Type Disk CPU weight RAM
VM-S 26843545600 64 1073741824
VM-M 53687091200 256 2147483648
VM-L 107374182400 1024 4294967296
VM-XL 214748364800 4096 8589934592
VM-XXL 536870912000 16384 17179869184
VM-XXXL 1073741824000 65536 34359738368
- name: Load VPS specs for chosen type
set_fact:
memory: "{{ lookup('csvfile', '{{ vps_type }} file=vmtypes.csv delimiter=, col=3') }}"
cpu_weight: "{{ lookup('csvfile', '{{ vps_type }} file=vmtypes.csv delimiter=, col=2') }}"
disksize: "{{ lookup('csvfile', '{{ vps_type }} file=vmtypes.csv delimiter=, col=1') }}"
- name: Get UUID of share SR
command: xe sr-list name-label="{{ sr_name }}" --minimal
register: sruuid
- name: Get the UUID of the VM template
command: xe template-list name-label="{{ vm_template }}" --minimal
register: templateuuid
- name: Get the UUID of the network
command: xe network-list name-label="{{ network_name }}" --minimal
---
- name: Deploy new Debian or Ubuntu VPS
hosts: xenservers
remote_user: root
vars_files:
- xenserver_vars.yml