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: Install Xentools on deployed vm
hosts: deployed_vms
tasks:
- name: Mount xentools CD
command: mount /dev/xvdd /mnt
- name: Run the xentools installer
command: /mnt/Linux/install.sh -n
#### Contents of the preconfiguration file (for stretch)
### Localization
# Preseeding only locale sets language, country and locale.
#d-i debian-installer/locale string en_US
# The values can also be preseeded individually for greater flexibility.
d-i debian-installer/language string en
d-i debian-installer/country string DK
d-i debian-installer/locale string en_DK.UTF-8
# Optionally specify additional locales to be generated.
version: '2'
services:
web:
image: ansible/awx_web:latest
depends_on:
- rabbitmq
- memcached
- postgres
ports:
# Install Ubuntu Xenial template if it does not exist
- name: Search for Ubuntu 16.04 amd64 template
shell: xe template-list | grep "Ubuntu Xenial Xerus 16.04 (64-bit)"
ignore_errors: True
register: ubuntu_xenial_amd64
tags: [xenserver,templates]
- name: Find UUID of older template
shell: xe template-list name-label="Ubuntu Trusty Tahr 14.04 (64-bit)" params=uuid --minimal
register: old_template_uuid_ubuntu_xenial_amd64
nodes:
 - address: 1.2.3.4
 hostname_override: somehost
 user: rancher
 role:
 - controlplane
 - etcd
 - address: 1.2.3.5
 hostname_override: someotherhost
 user: rancher
mkdir sshkeys
ssh-keygen -N '' -f sshkeys/id_rsa
cat <<EOF > sshkeys/key.sh
#!/bin/bash
mkdir -m 0700 .ssh
wget http://ip-of-rancher-server:8081/id_rsa.pub .ssh/authorized_keys
chmod og-rw .ssh/authorized_keys
EOF
wget http://ip-of-rancher-server:8081/key.sh
chmod +x sshkeys/key.sh
./key.sh
cd /opt/rke/kubernetes
cp ssl/kube-apiserver.pem .tmp/kube-adm.pem
cp ssl/kube-apiserver.key .tmp/kube-adm.key
docker run -d -v $PWD/sshkeys:/usr/share/nginx/html -p 8081:80 nginx