Skip to content

Instantly share code, notes, and snippets.

Avatar
🍕
Test status please ignore

Arturs Demiters demiters

🍕
Test status please ignore
  • CodeCraft
  • Riga, Latvia
View GitHub Profile
@demiters
demiters / ubuntu-inventory.yml
Created Aug 31, 2020
Ansible inventory for connecting to a local Ubuntu host (use --ask-become-pass)
View ubuntu-inventory.yml
all:
hosts: localhost
vars:
ansible_user: arturs
@demiters
demiters / ubuntu-playbook.yml
Last active Sep 22, 2020
Ansible example playbook for installing software on and configuring Ubunutu 20.04
View ubuntu-playbook.yml
---
- hosts: localhost
connection: local
become: yes
tasks:
- name: Install curl
apt:
name: curl
- name: Install nvm
@demiters
demiters / windows-inventory.yml
Created Aug 30, 2020
Ansible inventory for connecting to a Windows host
View windows-inventory.yml
all:
hosts: localhost
vars:
ansible_user: arturs
ansible_connection: winrm
ansible_winrm_server_cert_validation: ignore
@demiters
demiters / windows-playbook.yml
Last active Aug 31, 2020
Ansible example playbook for installing Windows 10 software
View windows-playbook.yml
---
- hosts: localhost
connection: local
tasks:
- name: Install Chocolatey packages
win_chocolatey:
name:
- vscode
- git
- nvm
@demiters
demiters / windows-host-setup.ps1
Last active Aug 31, 2020
PowerShell script that configures WinRM for use with Ansible
View windows-host-setup.ps1
$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 / example.com.tf
Created Jul 24, 2020
Terraform setup for automated install of microk8s on a Ubuntu 20.04 DigitalOcean VPS. Edits required, see comments for more info.
View example.com.tf
# 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 Jul 24, 2020
Installs microk8s on a remote Ubuntu 20.04 server, with essential addons
View microk8s.sh
#!/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 Jul 24, 2020
Creates non-root user with ssh key auth on remote Ubuntu 20.04 server
View user.sh
#!/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 / microk8s-aliases.sh
Created Jul 24, 2020
Shell aliases for microk8s
View microk8s-aliases.sh
#!/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 / firewall.sh
Created Jul 23, 2020
ufw firewall for a microk8s server
View firewall.sh
#!/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
You can’t perform that action at this time.