Skip to content

Instantly share code, notes, and snippets.

Petr Ruzicka ruzickap

Block or report user

Report or block ruzickap

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ruzickap
ruzickap / create_kubernetes_cluster.sh
Last active Apr 28, 2019
Create Kubernetes Cluster using Kubespray
View create_kubernetes_cluster.sh
# Create Virtual env for Kubespray and make it active
virtualenv --system-site-packages kubespray_virtenv
source kubespray_virtenv/bin/activate
# Install Ansible and Kubespray to virtualenv
pip install kubespray
# Create kubespray config file
cat > ~/.kubespray.yml << EOF
kubespray_git_repo: "https://github.com/kubespray/kubespray.git"
@ruzickap
ruzickap / install_vagrant-libvirt_Vagrantfile.sh
Last active Feb 23, 2018
Install Vagrant + libvirt and create Vagrantfile ale to run 3 VMs in KVM hypervisor
View install_vagrant-libvirt_Vagrantfile.sh
# Install Vagrant libvirt plugin (with all the dependencies like qemu, libvirt, vagrant, ...)
dnf install -y -q ansible git libvirt-client libvirt-nss python-netaddr python-virtualenv vagrant-libvirt
vagrant plugin install vagrant-libvirt
# Enable dns resolution of VMs taken from libvirt (https://lukas.zapletalovi.com/2017/10/definitive-solution-to-libvirt-guest-naming.html)
sed -i.orig 's/files dns myhostname/files libvirt libvirt_guest dns myhostname/' /etc/nsswitch.conf
# Start the libvirt daemon
service libvirtd start
@ruzickap
ruzickap / virtio-win_packer.sh
Last active Apr 30, 2019
Mount the virtio-win iso and run Packer
View virtio-win_packer.sh
export VIRTIO_WIN_ISO_DIR=$(mktemp -d --suffix=_virtio-win-iso)
export NAME=windows-server-2016-standard-x64-eval
export WINDOWS_VERSION=2016
export WINDOWS_TYPE=server
export TMPDIR="/var/tmp/"
cd /var/tmp/packer_windows-server-2016-eval
# Download and mount virtio-win to provide basic virtio Windows drivers
wget -c https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/latest-virtio/virtio-win.iso
@ruzickap
ruzickap / packer_template_autounattended_file_few_scripts.sh
Last active Apr 30, 2019
Create Packer template and Autounattended file for Windows Server 2016 Eval + download few helper scrips
View packer_template_autounattended_file_few_scripts.sh
# Prepare directory structure
mkdir -p /var/tmp/packer_windows-server-2016-eval/{scripts/win-common,http/windows-server-2016,ansible}
cd /var/tmp/packer_windows-server-2016-eval
# Download Autounattended file for Windows Server 2016 Evaluation
wget -c -P http/windows-server-2016 https://raw.githubusercontent.com/ruzickap/packer-templates/master/http/windows-server-2016/Autounattend.xml
# Create some basic Ansible playbook for Windows provisioning
cat > ansible/win.yml << EOF
---
@ruzickap
ruzickap / packer_ansible_qemu_fedora.sh
Last active Dec 15, 2017
Install Packer with WinRM communicator / Ansible / Qemu and enable Packer's Winrm communicator in Fedora
View packer_ansible_qemu_fedora.sh
# Install necessary packages
dnf install -y -q ansible qemu-img qemu-kvm wget unzip
# Download and unpack Packer
cd /tmp
wget https://releases.hashicorp.com/packer/1.1.3/packer_1.1.3_linux_amd64.zip
unzip packer*.zip
# Use packerio as a binary name, because packer binary already exists in fedora : /usr/sbin/packer as part of cracklib-dicts package
mv packer /usr/local/bin/packerio
@ruzickap
ruzickap / vagrant_libvirt_winrm_fedora.sh
Created Oct 23, 2017
Vagrant using KVM with WinRM installation in Fedora
View vagrant_libvirt_winrm_fedora.sh
# Uninstall Vagrant delivered in Fedora
dnf remove vagrant
# Install Vagrant from oficial rpm which has WinRM included
dnf install https://releases.hashicorp.com/vagrant/2.0.0/vagrant_2.0.0_x86_64.rpm
# Install libvirt/KVM plugin (https://github.com/vagrant-libvirt/vagrant-libvirt) for vagrant
vagrant plugin install vagrant-libvirt
@ruzickap
ruzickap / livemedia-creator_make-pxe-live_files
Created Jul 16, 2017
Files created by livemedia-creator
View livemedia-creator_make-pxe-live_files
$ find /var/tmp/a
/var/tmp/a
/var/tmp/a/result
/var/tmp/a/result/my_fedora_img
/var/tmp/a/result/live-rootfs.squashfs.img
/var/tmp/a/result/initramfs-4.11.9-300.fc26.x86_64.img
/var/tmp/a/result/vmlinuz-4.11.9-300.fc26.x86_64
/var/tmp/a/result/PXE_CONFIG
$ cat /var/tmp/a/result/PXE_CONFIG
@ruzickap
ruzickap / fedora26-my.ks
Created Jul 16, 2017
Fedora 26 kickstart file used by lorax livemedia-creator script to create PXE live
View fedora26-my.ks
#version=DEVEL
# Firewall configuration
firewall --disabled
# Use network installation
url --mirrorlist=https://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$releasever&arch=$basearch
# Root password
rootpw --plaintext xxxxxxxx
# Network information
network --bootproto=dhcp --device=link --activate
# System authorization information
@ruzickap
ruzickap / livemedia-creator_make-pxe-live
Created Jul 16, 2017
Create PXE live files form Fedora 26 using lorax
View livemedia-creator_make-pxe-live
# livemedia-creator --make-pxe-live --live-rootfs-keep-size --image-name=my_fedora_img --tmp=/var/tmp/a --ks fedora26-my.ks --iso=/home/ruzickap/data2/iso/Fedora-Workstation-netinst-x86_64-26-1.5.iso --resultdir=/var/tmp/a/result
/usr/lib64/python3.5/optparse.py:999: PendingDeprecationWarning: The KSOption class is deprecated and will be removed in pykickstart-3. Use the argparse module instead.
option = self.option_class(*args, **kwargs)
2017-07-16 08:12:28,922: disk_img = /var/tmp/a/result/my_fedora_img
2017-07-16 08:12:28,923: Using disk size of 6002MiB
2017-07-16 08:12:28,923: install_log = /var/tmp/lorax/virt-install.log
2017-07-16 08:12:29,161: qemu vnc=127.0.0.1:0
2017-07-16 08:12:29,161: Running qemu
2017-07-16 08:12:29,286: Processing logs from ('127.0.0.1', 52518)
2017-07-16 08:40:25,126: Installation finished without errors.
View Autounattend.xml
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="windowsPE">
<component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SetupUILanguage>
<UILanguage>en-US</UILanguage>
</SetupUILanguage>
<InputLocale>en-US</InputLocale>
<SystemLocale>en-US</SystemLocale>
You can’t perform that action at this time.