Skip to content

Instantly share code, notes, and snippets.

View ebuildy's full-sized avatar
🤟
South of France

Thomas Decaux ebuildy

🤟
South of France
View GitHub Profile
@ebuildy
ebuildy / cert.yaml
Last active March 10, 2022 08:09
Secure elasticsearch cluster
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: my-issuer
spec:
selfSigned: {}
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
@ebuildy
ebuildy / collection.json
Created February 3, 2021 15:15
Configure elasticsearch via newman
{
"info": {
"name": "Configure elasticsearch",
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
},
"item": [
{
"id": "livecycle-delete",
"name": "Remove existing livecycle",
"request": {
@ebuildy
ebuildy / intro.md
Last active January 4, 2021 11:28
Fix broken elasticsearch cluster

How to fix a broken ES cluster

@ebuildy
ebuildy / actions.sh
Created December 7, 2020 09:17
Resize elasticsearch data disk in a kubernetes cluster
# Our cluster is a 3 master nodes / 3 data nodes cluster, setup via Helm chart and we are running out of disk space
# "conso-es-data" is the "data nodes" Helm release
# Change ES cluster setting, to rebalance shards faster
PUT _cluster/settings
{
"persistent": {
"cluster.routing.allocation.enable": "all",
"cluster.routing.allocation.node_concurrent_recoveries" : 10,
@ebuildy
ebuildy / tasks.yaml
Created November 3, 2020 10:53
Ansible - manipulate semver with regex_replace
- name: Bump version - patch
set_fact:
version_major: "{{ cidre.version.current | regex_replace('^v(?P<major>[0-9]+)\\.(?P<minor>[0-9]+)\\.(?P<patch>[0-9]+)$', '\\g<major>') }}"
version_minor: "{{ cidre.version.current | regex_replace('^v(?P<major>[0-9]+)\\.(?P<minor>[0-9]+)\\.(?P<patch>[0-9]+)$', '\\g<minor>') }}"
version_patch: "{{ cidre.version.current | regex_replace('^v(?P<major>[0-9]+)\\.(?P<minor>[0-9]+)\\.(?P<patch>[0-9]+)$', '\\g<patch>') }}"
- name: Bump version - patch
when: "'cidre_bump_patch' in ansible_run_tags"
set_fact:
version_patch: "{{ version_patch | int + 1 }}"
@ebuildy
ebuildy / index.py
Last active June 17, 2024 11:40
List gitlab container registry size, per project, via gitlab API
import gitlab
import urllib3
import humanfriendly
import timeago, datetime
# 2020-04-24T12:04:26.475+00:00
date_now = datetime.datetime.now()
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
@ebuildy
ebuildy / docker_compose_config_service.bash
Created July 29, 2020 19:12
docker-compose config, filter service. Show config only for desired service.
docker-compose config | docker run -i karlkfi/yq -r ".services.my_service_name"
@ebuildy
ebuildy / instlal_gitlab_runner_playbook.yaml
Created May 11, 2020 11:44
Install gitlab-runner with Ansible
---
- hosts: recette
become: yes
become_user: root
vars:
gitlab_url: https://XXXXXX
gitlab_runner_registration_token: XXXXX
tasks:
- name: setup user
user:
@ebuildy
ebuildy / playbook_install_docker_compose.yaml
Created May 11, 2020 08:56
Install docker-compose via Ansible
---
- hosts: recette
become: yes
become_user: root
tasks:
- name: "Get Linux uname's"
command: "uname -{{ item }}"
register: unames
with_items: ["s", "m"]
- set_fact:
#!/usr/bin/python3
import argparse, json, requests
parser = argparse.ArgumentParser(description='Create automatically index patterns, from elasticsearch indices.')
parser.add_argument('elasticsearch_url',type=str, help='elasticsearch full URL')
parser.add_argument('kibana_url', type=str, help='kibana full URL')
args = parser.parse_args()