Skip to content

Instantly share code, notes, and snippets.

View miticojo's full-sized avatar

Giorgio Crivellari miticojo

View GitHub Profile
@miticojo
miticojo / magento-nfs.dc.yaml
Last active February 20, 2018 14:46
OCP - DC with direct attach NFS volume (no PV/PVC)
apiVersion: v1
kind: DeploymentConfig
metadata:
labels:
app: magento
name: magento
spec:
replicas: 1
selector:
app: magento
@miticojo
miticojo / os-rolling-update.yml
Last active January 31, 2018 06:35
OS rolling update with traditional RH repo and external rpm (for driver)
- hosts: nodes
serial: "20%"
vars:
drivers_packages:
- https://trello-attachments.s3.amazonaws.com/5967300a3e4895c3daf46c6f/5a2e5675861820458e017fa1/04710232eef65ff68adb8587d158e3e0/kmod-hpvsa-1.2.16-114.rhel7u4.x86_64.rpm
proxy_http: ''
proxy_https: ''
@miticojo
miticojo / check-for-update.yml
Created January 23, 2018 09:02
RHEL/CentOS/Fedora - Report pending update with ansible
- name: check for updates
hosts: all
gather_facts: true
become: yes
tasks:
- name: check for updates (yum)
yum: list=updates update_cache=true
register: updates
@miticojo
miticojo / ocp-rolling-os.yml
Last active January 23, 2018 22:39
Openshift Node OS Rolling Update
- hosts: nodes
serial: "20%"
tasks:
- name: make node unschedulable
command: oc adm manage-node {{inventory_hostname}} --schedulable=false
delegate_to: "{{groups.masters.0}}"
retries: 10
delay: 5
@miticojo
miticojo / satellite-ilo-deploy.yml
Created November 23, 2017 16:17
Ansible Satellite machine deploy through HP ILO drive
- hosts: targets
gather_facts: no
tasks:
- hpilo_facts:
host: "{{ilo_ip}}"
login: "{{ilo_user}}"
password: "{{ilo_pass}}"
delegate_to: localhost
register: ilo_facts
@miticojo
miticojo / spark-template.yaml
Created October 19, 2017 09:33
Template - Oshinko - Spark - Kafka for Openshift using RHEL images
apiVersion: v1
kind: Template
labels:
template: spark-kafka-persistent
metadata:
annotations:
description: Application template for Spark and kafka
tags: spark,kafka
version: "1.0"
name: spark-kafka-persistent
@miticojo
miticojo / secure-ssh.yml
Created August 16, 2017 23:17 — forked from cmavr8/secure-ssh.yml
Secure SSH configuration ansible playbook
---
# SSH server settings, in line with https://stribika.github.io/2015/01/04/secure-secure-shell.html
# Before using, change myhosts to your hosts' nickname and myuser to your username (two instances! make sure you replace both or you'll be locked out of ssh!)
- hosts: myhosts
become: true
remote_user: myuser
tasks:
# Key exchange, ciphers and MACs
- lineinfile: dest=/etc/ssh/sshd_config regexp='^KexAlgorithms' line='KexAlgorithms [email protected],diffie-hellman-group-exchange-sha256'
@miticojo
miticojo / ssh_config
Created August 16, 2017 23:16 — forked from bonsi/ssh_config
Secure SSH Config
# Recommendations from https://stribika.github.io/2015/01/04/secure-secure-shell.html
# Github needs diffie-hellman-group-exchange-sha1 some of the time but not always.
#Host github.com
# KexAlgorithms [email protected],diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1
Host *
KexAlgorithms [email protected],diffie-hellman-group-exchange-sha256
Host *
@miticojo
miticojo / templates.md
Last active August 11, 2017 11:57
Openshift utilities

Export single template

TEMPLATE_NAME='mysql'
oc -n openshift export template $TEMPLATE_NAME --as-template=$TEMPLATE_NAME > $TEMPLATE_NAME.yaml

Export all templates

oc get template -n openshift -o=custom-columns=NAME:.metadata.name | tail -n +2 | xargs -I {} bash -c "oc export template {} --as-template={} -n openshift > {}.yaml"
@miticojo
miticojo / dirsize.go
Created July 24, 2017 23:44
calculate directory size in GO
package main
import (
"fmt"
"os"
"path/filepath"
"log"
"code.cloudfoundry.org/bytefmt"
)