Skip to content

Instantly share code, notes, and snippets.

@egeneralov
egeneralov / ansible_openssl_CA_example.yml
Created September 19, 2019 04:56
Generate a chain (self signed + one signed by the self signed) of certificates using Ansible OpenSSL module.
---
- hosts: localhost
gather_facts: no
# # darwin
# vars:
# ansible_python_interpreter: /usr/local/bin/python
tasks:
- block:
- apt:
@egeneralov
egeneralov / oneshot.sh
Created September 23, 2019 03:06
egeneralov.nginx + acme.sh
DOMAIN=e-xample.com
PROXY_TO=127.0.0.1:8427
cat << EOF > nginx.yml
---
- hosts: ${DOMAIN}
vars:
upstreams:
cat << EOF > config
DRIVE1 /dev/nvme0n1
DRIVE2 /dev/nvme1n1
SWRAID 1
SWRAIDLEVEL 0
BOOTLOADER grub
HOSTNAME $(hostname)
#!/bin/bash -xe
cat << EOF > runner-values.yaml
---
concurrent: 4
checkInterval: 3
rbac:
create: true
clusterWideAccess: false
runners:
#!/bin/bash -xe
cat << EOF > /etc/systemd/system/log-dns-query.service
[Unit]
Description=dns
[Service]
ExecStart=/bin/sh -c "script -q -c \"tcpdump -l port 53 2>/dev/null | grep --line-buffered ' A? ' | cut -d' ' -f8\" | tee -a /var/log/dns.log"
[Install]
#!/bin/bash -xe
[ -f /usr/local/bin/gitlab-runner ] || curl -L --output /usr/local/bin/gitlab-runner https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-amd64
chmod +x /usr/local/bin/gitlab-runner
gitlab-runner register -n \
--url https://gitlab.com \
--registration-token qwerty \
--executor docker \
--description "dind runner" \
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv-gitlab-managed-apps-prometheus-server
spec:
accessModes:
- ReadWriteOnce
capacity:
storage: 10Gi
claimRef:
#!/bin/bash -xe
# Disk wipe
sgdisk --zap-all ${DEV:-/dev/sda}
# Disk partitioning
sgdisk -og ${DEV:-/dev/sda}
sgdisk -n 1:2048:+128M -t 1:fd00 ${DEV:-/dev/sda}
sgdisk -n 128:-3M:0 -t 128:ef02 ${DEV:-/dev/sda}
#!/bin/bash -xe
[ -b ${DISK_1:-/dev/sda} ] || exit 1
[ -b ${DISK_2:-/dev/sdb} ] || exit 1
mdadm --stop --scan
sgdisk -og ${DISK_1:-/dev/sda}
sgdisk -n 1:2048:+${SIZE_ROOTFS:-128M} -t 1:fd00 ${DISK_1:-/dev/sda}
sgdisk -n 128:-3M:0 -t 128:ef02 ${DISK_1:-/dev/sda}
#!/bin/bash
mkdir hello_app
cd hello_app
echo '#!/usr/bin/env ruby' > hello.rb
echo 'puts "hello world"' >> hello.rb
ruby hello.rb
mkdir -p hello-1.0.0-linux-x86/lib/app