Skip to content

Instantly share code, notes, and snippets.

View demiters's full-sized avatar
🍕
Test status please ignore

Arturs Demiters demiters

🍕
Test status please ignore
  • CodeCraft
  • Riga, Latvia
View GitHub Profile
@demiters
demiters / microk8s-aliases.sh
Created July 24, 2020 12:47
Shell aliases for microk8s
#!/bin/bash
# Sets up aliases for microk8s on the server
echo "alias m='microk8s'
alias k='microk8s kubectl'
alias h='microk8s helm3'" >> ~/.bash_aliases
source ~/.bash_aliases
@demiters
demiters / ubuntu-playbook.yml
Last active November 12, 2020 16:21
Ansible example playbook for installing software on and configuring Ubunutu 20.04
---
- hosts: localhost
connection: local
become: yes
become_user: arturs
tasks:
- name: Install curl
apt:
name: curl
@demiters
demiters / ubuntu-inventory.yml
Created August 31, 2020 10:01
Ansible inventory for connecting to a local Ubuntu host (use --ask-become-pass)
all:
hosts: localhost
vars:
ansible_user: arturs
@demiters
demiters / windows-host-setup.ps1
Last active August 31, 2020 08:25
PowerShell script that configures WinRM for use with Ansible
$url = "https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1"
$file = "$env:temp\ConfigureRemotingForAnsible.ps1"
(New-Object -TypeName System.Net.WebClient).DownloadFile($url, $file)
powershell.exe -ExecutionPolicy ByPass -File $file
@demiters
demiters / windows-playbook.yml
Last active August 31, 2020 08:12
Ansible example playbook for installing Windows 10 software
---
- hosts: localhost
connection: local
tasks:
- name: Install Chocolatey packages
win_chocolatey:
name:
- vscode
- git
- nvm
@demiters
demiters / windows-inventory.yml
Created August 30, 2020 14:06
Ansible inventory for connecting to a Windows host
all:
hosts: localhost
vars:
ansible_user: arturs
ansible_connection: winrm
ansible_winrm_server_cert_validation: ignore
@demiters
demiters / example.com.tf
Created July 24, 2020 13:30
Terraform setup for automated install of microk8s on a Ubuntu 20.04 DigitalOcean VPS. Edits required, see comments for more info.
# Edit name (example.com), region and size as you wish
resource "digitalocean_droplet" "example.com" {
image = "ubuntu-20-04-x64"
name = "example.com"
region = "fra1"
size = "s-2vcpu-4gb"
private_networking = true
ssh_keys = [
var.ssh_fingerprint
]
@demiters
demiters / microk8s.sh
Last active July 24, 2020 13:24
Installs microk8s on a remote Ubuntu 20.04 server, with essential addons
#!/bin/bash
# Installs microk8s and enables addons:
# dns, ingress, helm3 (essential)
# dashboard (cluster monitoring)
# registry (private Docker registry)
# Installs and configures essential helm charts:
# external-dns (automating setting of dns records)
# cert-manager (automating issuing of https certificates)
@demiters
demiters / user.sh
Created July 24, 2020 12:56
Creates non-root user with ssh key auth on remote Ubuntu 20.04 server
#!/bin/bash
# Creates non-root user who can use ssh key auth, edit to your liking.
sudo apt install rsync
adduser arturs
usermod -aG sudo arturs
rsync --archive --chown=arturs:arturs ~/.ssh /home/arturs
@demiters
demiters / firewall.sh
Created July 23, 2020 12:04
ufw firewall for a microk8s server
#!/bin/bash
ufw default deny incoming
ufw default allow outgoing
ufw default allow routed
ufw allow OpenSSH
ufw allow http
ufw allow https
ufw allow in on cni0 && ufw allow out on cni0
ufw enable