Skip to content

Instantly share code, notes, and snippets.

@dreiggy
dreiggy / docker-systemd.md
Created September 30, 2021 07:34 — forked from OnkelDom/docker-systemd.md
My Setup to manage docker containers with systemd services

Setup Docker Systemd on Ubuntu 20.04

This is my docker systemd setup. I stored no configs or environment vars in this gist.

Install Docker

# Install Dependencies
$ sudo apt-get update
$ sudo apt-get install -y apt-transport-https ca-certificates curl gnupg lsb-release
@dreiggy
dreiggy / package_updates_check.py
Created July 21, 2020 11:46 — forked from yumminhuang/package_updates_check.py
Python script to check apt-get updates
#!/usr/bin/env python
#coding=utf-8
import apt
import apt_pkg
from time import strftime
import os
import subprocess
import sys
# Check OS and VERSION
if [ -f /etc/os-release ]; then
# freedesktop.org and systemd
. /etc/os-release
OS=$ID
VER=$VERSION_ID
elif type lsb_release >/dev/null 2>&1; then
# linuxbase.org
OS=$(lsb_release -si)
VER=$(lsb_release -sr)
---
- name: yum check-update
shell: yum check-update
register: yum_result
failed_when: yum_result.rc != 100
---
#source: https://serverfault.com/a/883713
- hosts: ubuntu
tasks:
- name: install all updates
apt:
upgrade: dist
update_cache: yes
autoremove: yes
autoclean: yes
@dreiggy
dreiggy / system-updates-playbook.yml
Created July 15, 2020 12:28 — forked from ZeroDeth/system-updates-playbook.yml
Ansible Playbook Installing System Updates for YUM and APT
---
- hosts: all
become: yes
tasks:
- name: Install system updates for centos systems
yum:
name: '*'
state: latest
@dreiggy
dreiggy / snmp.yml
Created July 15, 2020 10:26 — forked from h3po/snmp.yml
Config for prometheus-snmp-exporter polling the most important metrics (mtu, bandwith, packet/byte counters, plug status) from a cisco switch stack, with static port properties (index, descr, type, mac, name, alias) as labels
#http://www.oidview.com/mibs/0/IF-MIB.html
#http://www.net-snmp.org/docs/mibs/interfaces.html
cisco_custom:
version: 2
auth:
community: public
walk:
- 1.3.6.1.2.1.2.2.1
- 1.3.6.1.2.1.31.1.1.1
metrics:
@dreiggy
dreiggy / slapd
Created March 10, 2020 13:13 — forked from tuxfight3r/slapd
openldap proxy to AD with TLS
#file /etc/sysconfig/slapd
# OpenLDAP server configuration
# see 'man slapd' for additional information
# Where the server will run (-h option)
# - ldapi:/// is required for on-the-fly configuration using client tools
# (use SASL with EXTERNAL mechanism for authentication)
# - default: ldapi:/// ldap:///
# - example: ldapi:/// ldap://127.0.0.1/ ldap://10.0.0.1:1389/ ldaps:///
SLAPD_URLS="ldap:/// ldaps:///"
@dreiggy
dreiggy / mirror_remote_directory_to_local_directory
Created October 10, 2019 07:23 — forked from pixeline/mirror_remote_directory_to_local_directory
Bash script using lftp to mirror remote directory to local directory, thus keeping the local directory synchronized with the remote one.
#!/bin/sh
# @author: Alexandre Plennevaux
# @description: MIRROR DISTANT FOLDER TO LOCAL FOLDER VIA FTP
#
# FTP LOGIN
HOST='sftp://ftp.domain.com'
USER='ftpusername'
PASSWORD='ftppassword'
# DISTANT DIRECTORY
@dreiggy
dreiggy / prometheus.md
Created October 2, 2019 05:54 — forked from petarnikolovski/prometheus.md
Prometheus 2.x installation on Ubuntu 16.04 server.

Installing Prometheus on Ubuntu 16.04

This gist is a compilation of two tutorials. You can find the original tutorials here and here. What should you know before using this? Everything can be executed from the home folder. For easier cleanup at the end you can make directory where you'll download everything, and then just use rm -rf .. Although, you should be careful. If some strange bugs arise unexpectedly somewhere sometimes, just keep in mind that some user names have underscores in them (this is probably nothing to worry about).

Create Users

sudo adduser --no-create-home --disabled-login --shell /bin/false --gecos "Prometheus Monitoring User" prometheus
sudo adduser --no-create-home --disabled-login --shell /bin/false --gecos "Node Exporter User" node_exporter
sudo adduser --no-create-home --disabled-login --shell /bin/false --gecos "Alertm