Skip to content

Instantly share code, notes, and snippets.

View voondo's full-sized avatar

Romain Lalaut voondo

View GitHub Profile
@YumaInaura
YumaInaura / README.md
Last active July 7, 2021 13:10
Ansible—How to pass multiple module arguments ( parameters, MODULE_ARGS ) to ansible command and represent playbook?

Ansible—How to pass multiple module arguments ( parameters, MODULE_ARGS ) to ansible command and represent playbook?

Answer

Describe key=value pari separated with spaces.

$ ansible -m "[module_name]" --args="key1=value2 key2=value2"

In playbook

@ekreutz
ekreutz / ansible_variable_precedence.md
Last active April 25, 2024 17:43
Ansible variable precedence (order, hierarchy)
@esamattis
esamattis / systemdunit.py
Last active November 10, 2021 23:04
Install Systemd units using Ansible
"""
Install Systemd units using Ansible
Handles unit restarting and systemd daemon reloading when the unit changes.
Also stops the unit correctly when uninstalled
In your playbook put this file to library/systemdunit.py and make sure the
server has python-sh package installed
@tpruzina
tpruzina / gist:c4d9c0ca6bdbb6e78ab2126a7cdf8f1c
Last active May 10, 2017 08:09
NVIDIA-378.13-KERNEL-4.10.patch
diff -ur NVIDIA-Linux-x86_64-378.13/kernel/common/inc/nv-mm.h NVIDIA-Linux-x86_64-378.13.patched/kernel/common/inc/nv-mm.h
--- NVIDIA-Linux-x86_64-378.13/kernel/common/inc/nv-mm.h 2017-02-08 04:58:34.000000000 +0100
+++ NVIDIA-Linux-x86_64-378.13.patched/kernel/common/inc/nv-mm.h 2017-02-23 18:57:34.655592444 +0100
@@ -46,6 +46,8 @@
* 2016 Dec 14:5b56d49fc31dbb0487e14ead790fc81ca9fb2c99
*/
+#include <linux/version.h>
+
#if defined(NV_GET_USER_PAGES_REMOTE_PRESENT)
@nrollr
nrollr / nginx.conf
Last active June 9, 2024 23:39
NGINX config for SSL with Let's Encrypt certs
# UPDATED 17 February 2019
# Redirect all HTTP traffic to HTTPS
server {
listen 80;
listen [::]:80;
server_name www.domain.com domain.com;
return 301 https://$host$request_uri;
}
# SSL configuration
@timaschew
timaschew / gulp-task.js
Last active December 4, 2021 18:34
proxy browser-sync server with express and secure everything with basic auth
// just add pass server as your task function
// Start a server with LiveReload to preview the site in
const OUTPUT_PARENT = 'dist'
const OUTPUT_DIRECTORY = OUTPUT_PARENT + '/browser-sync'
function server(done) {
browser.init({
server: {
directory: true,
@craigweston
craigweston / or_scopes.rb
Last active March 26, 2020 23:22 — forked from j-mcnally/or_scopes.rb
OR'ing scopes
module ActiveRecord
module Querying
delegate :or, :to => :all
end
end
module ActiveRecord
module QueryMethods
# OrChain objects act as placeholder for queries in which #or does not have any parameter.
# In this case, #or must be chained with any other relation method to return a new relation.
@mgedmin
mgedmin / postfix.py
Last active February 6, 2024 14:21
Ansible module for postfix configuration
#!/usr/bin/python
import subprocess
DOCUMENTATION = '''
---
module: postfix
short_description: changes postfix configuration parameters
description:
- The M(postfix) module changes postfix configuration by invoking 'postconf'.
class Tilt::CoffeeScriptTemplate
SYNTAX_ERROR_MESSAGE = /SyntaxError: \[stdin\]:(\d+):(\d+)/
def evaluate_with_better_errors(scope, locals, &block)
evaluate_without_better_errors(scope, locals, &block)
rescue ExecJS::RuntimeError => error
raise error unless error.message.match(SYNTAX_ERROR_MESSAGE)
line, col = $1, $2
message = "SyntaxError: #{@file}:#{line}:#{col}"
@saikocat
saikocat / qemu_usage_with_spice_cp.md
Last active January 4, 2021 10:27
QEMU + Spice with Copy & Paste

Create a runner shell script in host -> init with:

  • 2GB RAM
  • Host CPU with 2 Cores
  • Localhost port 2222 traffic redirect to guest port 22
  • Spice display with copy and paste enabled
#!/bin/sh
SPICE_PORT=5924
SPARK_IMG=/home/hoa/spark-training.qcow2