Skip to content

Instantly share code, notes, and snippets.

View realtebo's full-sized avatar
💭
I may be slow to respond.

Mirko Tebaldi realtebo

💭
I may be slow to respond.
  • Somewhere over the raimbow
  • Ferrara, Italy
View GitHub Profile
@realtebo
realtebo / configure_for_ansible_winrm.ps1
Last active August 10, 2020 03:28
Configure the local Windows 10 machine for be controlled remotely from ansible
##############################################################################################################
# https://docs.ansible.com/ansible/latest/user_guide/windows_setup.html#upgrading-powershell-and-net-framework
#
# The username and password parameters are stored in plain text in the registry. Make sure the Remove-Item
# commands are run, check them after the script finishes to ensure no credentials are still stored on the host.
#
# The ConfigureRemotingForAnsible.ps1 script is intended for training and development purposes only and
# should not be used in a production environment, since it enables settings (like Basic authentication)
# that can be inherently insecure.
##############################################################################################################
@realtebo
realtebo / install_ansible.sh
Last active March 31, 2020 22:24
Install ansible on a Ubuntu 18.04 Server
#!/bin/bash
# Download and run
# curl https://gist.githubusercontent.com/realtebo/3451070eba5a55186afb686d1690abd2/raw/install_ansible.sh?_=$(date +%s) | bash
sudo apt-get update && sudo apt-get install software-properties-common -y
sudo apt-add-repository universe -y
sudo apt-add-repository ppa:ansible/ansible -y
sudo apt-get update && sudo apt-get install ansible python-pip -y
pip install "pywinrm>=0.3.0"
@realtebo
realtebo / hosts
Created August 7, 2018 20:25
/etc/ansible/hosts
[local]
localhost ansible_connection=local
[windows:vars]
ansible_winrm_scheme=http
ansible_connection=winrm
@realtebo
realtebo / ansible_vault.md
Last active November 3, 2020 00:28
How to use encrypted vault files for storing sensitive da ta and NOT enter a password every time :)

How to use the vault with ansible

Prerequisites

pip install cryptography

Create the file

The EDITOR const is optional, but I use to show how to force the use of an editor instead of another.

@realtebo
realtebo / First steps with ansible.md
Last active August 8, 2018 16:15
Starting with ansible

For the file group_vars/windows/main.yml I suggest to use ansible vault

@realtebo
realtebo / Dockerfile
Last active August 9, 2018 12:24
Start with docker + laravel
FROM php:7.0.4-fpm
RUN apt-get update && apt-get install -y libmcrypt-dev \
mysql-client libmagickwand-dev --no-install-recommends \
&& pecl install imagick \
&& docker-php-ext-enable imagick \
&& docker-php-ext-install mcrypt pdo_mysql
@realtebo
realtebo / readme.md
Last active August 11, 2018 20:35
Add a new PiHole
  1. Clone Ubuntu base VM

  2. Assign IP to the new machine (read MAC at assign using DHCP)

  3. Add the ip to ansible [dns] group, in the file /etc/ansible/hosts

  4. Login with default username and password

  5. Enble SSH auth via password to allow first ansible login

       sudo sed -i 's/PasswordAuthentication no/PasswordAuthentication yes' /etc/ssh/sshf_config
    
  6. Restart

  7. From ansible controller, check

@realtebo
realtebo / service-worker.js
Created November 15, 2018 08:04 — forked from cristoni/service-worker.js
Esempio di service worker con workbox per workbox-webpack-plugin
if (workbox) {
console.log(`Yay! Workbox is loaded 🎉`);
// workbox.setConfig({ debug: false });
// workbox.precaching.suppressWarnings();
workbox.precaching.precacheAndRoute(self.__precacheManifest, {});
workbox.routing.registerRoute(/^https?.*/, workbox.strategies.networkFirst(), 'GET');
} else {
console.log(`Boo! Workbox didn't load 😬`);
}
@realtebo
realtebo / service-worker.js
Created November 16, 2018 20:06
Portion of service-worker.js
server.get("/service-worker.js", (req, res) => {
// Don't cache service worker is a best practice (otherwise clients wont get emergency bug fix)
res.set("Cache-Control", "no-store, no-cache, must-revalidate, proxy-revalidate");
res.set("Content-Type", "application/javascript");
const filePath = join(__dirname, '.next', req.url);
app.serveStatic(req, res, filePath);
});
@realtebo
realtebo / Nagios 4.4.6 + plugins 2.3.3 on Debian 10 and nginx
Last active May 6, 2021 09:59
Nagios Core 4.4.6 + Nagios plugins 2.3.3 on Debian 10 with Nginx
# Source of truth
# https://support.nagios.com/kb/article/nagios-core-installing-nagios-core-from-source-96.html#Debian
# About nginx installation
# https://olivertappin.com/command-line-tools/installing-nagios-nginx-php-fpm-nagiosgraph-ubuntu-16-04/
# All steps on debian require root AND `-` to use full env
su -
# Prerequisites