Skip to content

Instantly share code, notes, and snippets.

View meysam81's full-sized avatar
📝
Learning

Meysam meysam81

📝
Learning
View GitHub Profile
@meysam81
meysam81 / main.yml
Created January 27, 2024 07:46
Enable IP forwarding using Ansible
- name: Enable IP Forwarding permanently
ansible.builtin.copy:
content: net.ipv4.ip_forward = 1
dest: /etc/sysctl.d/20-ipforward.conf
mode: "0644"
@meysam81
meysam81 / controlplane-playbook.yml
Created January 27, 2024 07:08
Skeleton for an initial playbook to configure a Kubernetes control plane.
- name: Bootstrap Kubernetes Control plane
hosts: node0
become: true
gather_facts: true
tasks:
- name: Initiating configuration
debug:
msg: "Initiating configuration..."
@meysam81
meysam81 / Vagrantfile
Created January 27, 2024 06:54
One node VM with ansible integration
Vagrant.configure("2") do |config|
config.vm.define "node0" do |node|
node.vm.box = "ubuntu/jammy64"
# ... truncated ...
node.vm.provision "ansible" do |ansible|
ansible.verbose = "v"
ansible.playbook = "bootstrap-controlplane.yml"
ansible.compatibility_mode = "2.0"
@meysam81
meysam81 / Vagrantfile
Last active January 27, 2024 06:48
One node VM with Vagrant
box = "ubuntu/jammy64"
common_script = <<-SCRIPT
export DEBIAN_FRONTEND=noninteractive
# To allow fetching logs from journalctl
usermod -aG adm vagrant
SCRIPT
Vagrant.configure("2") do |config|
apiVersion: v1
kind: Secret
metadata:
name: wordpress
stringData:
MARIADB_ROOT_PASSWORD: Wordpre5$
MARIADB_PASSWORD: Wordpre5$
WORDPRESS_DB_PASSWORD: Wordpre5$
---
apiVersion: v1
@meysam81
meysam81 / hello-koajs.ts
Last active January 10, 2024 14:30
Hello Koajs
const Koa = require('koa')
const app = new Koa()
const PORT = process.env.PORT || 3000
// logger
app.use(async (ctx, next) => {
await next()
const rt = ctx.response.get('X-Response-Time')
@meysam81
meysam81 / nginx-deployment.yml
Last active December 26, 2023 09:46
Nginx Kubernetes Deployment | https://developer-friendly.com
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
@meysam81
meysam81 / install_mongodb_community_v6_ubuntu22.04_jammy.sh
Created October 28, 2023 15:23
MongoDB Community v6 installation on Ubuntu 22.04 Jammy
#!/bin/bash -xe
# ref: https://www.mongodb.com/docs/v6.0/tutorial/install-mongodb-on-ubuntu/#install-mongodb-community-edition
sudo apt update
sudo apt upgrade -y
sudo apt-get install -y gnupg curl
curl -fsSL https://pgp.mongodb.com/server-6.0.asc |
sudo gpg -o /usr/share/keyrings/mongodb-server-6.0.gpg \
@meysam81
meysam81 / http_serving_fileserver_deployment.yml
Last active February 4, 2023 08:15
Kubernestes manifest for HTTP serving file server with basic authentication mechanism | https://meysam.io ©️
apiVersion: v1
items:
- apiVersion: v1
data:
nginx-fileserver.conf: |
server {
listen 80 backlog=1024;
location /healthz {
access_log off;
@meysam81
meysam81 / mount_configmap_as_volume_in_kubernetes.yml
Last active February 4, 2023 08:11
Mount ConfigMap as volume in Kubernetes Pod | https://meysam.io ©️
apiVersion: v1
items:
- apiVersion: v1
data:
favorite-color: red
names.txt: |
Alex
Jane
Sam
kind: ConfigMap