Skip to content

Instantly share code, notes, and snippets.

View oboukili's full-sized avatar
🏄‍♂️
!

Olivier Boukili oboukili

🏄‍♂️
!
View GitHub Profile
> $ ./scaleway-inventory.py --list
{
"infrastructure": {
"children": [
"scaleway"
]
},
"_meta": {
"hostvars": {
"web1": {
> $ ansible -i scaleway/scaleway-inventory.py all -m debug -a "var=hostvars[inventory_hostname]['ansible_host']"
web1 | SUCCESS => {
"changed": false,
"hostvars[inventory_hostname]['ansible_host']": "10.2.216.145"
}
database1 | SUCCESS => {
"changed": false,
"hostvars[inventory_hostname]['ansible_host']": "10.3.64.213"
}
> $ ./dynamic-inventory.py --list
{
"infrastructure": {
"children": [
"mycloud"
]
},
"_meta": {
"hostvars": {
@oboukili
oboukili / gist:576ff970308819bc15765c8c107a6728
Created May 24, 2017 16:30
playbook + invocation + output
---
- hosts: infrastructure
become: true
pre_tasks:
- name: debug
debug:
msg: "{{ hostvars[item] }}"
with_items: "{{ groups['infrastructure'] }}"
...
## Invocation:
- name: Wait for elasticsearch cluster replica shards to be fully allocated for 5 minutes.
uri:
url: http://localhost:9200/_cluster/health?wait_for_no_relocating_shards=true&timeout=5s
return_content: true
register: elasticsearch_cluster_health
until: elasticsearch_cluster_health.json.status == "green"
retries: 100
when: groups['elasticsearch']|length > 1
environment:
http_proxy: ''
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
General error during class generation: Method code too large!
java.lang.RuntimeException: Method code too large!
at groovyjarjarasm.asm.MethodWriter.a(Unknown Source)
at groovyjarjarasm.asm.ClassWriter.toByteArray(Unknown Source)
at org.codehaus.groovy.control.CompilationUnit$17.call(CompilationUnit.java:827)
at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1065)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:603)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)
provider "aws" {
version = "~> 1.9"
region = "eu-central-1"
}
resource "aws_kms_key" "mykey" {
description = "This key is used to encrypt bucket objects"
deletion_window_in_days = 10
}
resource "aws_s3_bucket" "mybucket" {
#!/bin/sh
export VAULT_ADDR="https://active.vault.service.consul:8200"
export VAULT_PKI_PATH="v1/pki/issue/application"
# Getting a GCP JWT to authenticate against Vault GCP auth backend
JWT_TOKEN=$(curl -s -H "Metadata-Flavor: Google" 'http://metadata/computeMetadata/v1/instance/service-accounts/someserviceaccount/identity?audience=vault/apps&format=full')
# Getting a short lived Vault authentication token payload
until VAULT_TOKEN_PAYLOAD=$(curl -sfk -X POST ${VAULT_ADDR}/v1/auth/gcp/login -d "
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: myapp
spec:
replicas: 2
selector:
matchLabels:
app: myapp
resource "google_container_cluster" "primary" {
name = "primary"
region = "europe-west1"
remove_default_node_pool = true
initial_node_count = 1
ip_allocation_policy {
cluster_secondary_range_name = "10.0.0.0/16"
services_secondary_range_name = "10.1.0.0/16"