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
- name: Deploy new VM
command: xe vm-install template={{ templateuuid.stdout }} new-name-label="{{ vm_name }} - {{ ipaddress }} - {{ vps_type }}" sr-uuid={{ sruuid.stdout }}
register: vmuuid
---
hostname: vm01
domainname: example.com
gateway: 192.168.1.1
dnsservers: "8.8.8.8"
network_name: "Network 0"
sr_name: "Local storage"
vm_template: "Debian Stretch 9.0 (64-bit)"
vm_name: "vm01"
ipaddress: 192.168.1.10
---
- name: Deploy new Debian or Ubuntu VPS
hosts: xenservers
remote_user: root
vars_files:
- xenserver_vars.yml
- 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: 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') }}"
@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
@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:

[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
- hosts: balancers
user: root
tags: deploy
tasks: [ ]
- hosts: prod
serial: 1
tasks:
- name: Upload DB dump to prod
---
- hosts: localhost
connection: local
gather_facts: no
tasks:
- name: Test
local_action: shell /usr/local/bin/pwgen -s 14 1
register: password