This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is the resource to create | |
module "config_generator" { | |
source = "map_module_main.tf" // ? usually point to github url or place on disk where the module exists | |
name = var.config_names | |
} | |
variable "config_names" { | |
type = list(any) | |
default = [ | |
"app", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Some containers do not provide netstat or lsof. This command will get you the local IP a session is established on | |
# In short: This gets the output from namespace 1 (where usually the process is running inside the container), filters out the field where the hex IP is located and converts it into a readable IP in the right format. (some fields are inverted etc) | |
# Benefit is that you dont need netstat installed to see connections. | |
printf '%d.%d.%d.%d\n' $(grep -v local /proc/1/net/tcp | awk '{print $2}'|cut -d: -f1| sed -r 's/(..)/0x\1 /g') | awk -F. '{for (i=NF; i>0; --i) printf "%s%s", (i<NF ? "." : ""), $i; printf "\n"}' | |
# This lists the connections that are established. | |
printf '%d.%d.%d.%d\n' $(grep -v rem /proc/1/net/tcp | awk '{print $3}'|cut -d: -f1| sed -r 's/(..)/0x\1 /g') | awk -F. '{for (i=NF; i>0; --i) printf "%s%s", (i<NF ? "." : ""), $i; printf "\n"}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Script created by Rogier Dikkes. | |
# This script is licensed under the GNU GPL version 3.0. | |
# This script is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# This script is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rancher only supports specific SSH key formats. When you try to add a ssh-key it often will fail and give the following error because the format is incorrect: | |
data does not contain a valid RSA or ECDSA private key | |
This issue gave the idea that the Rancher interface has limited SSH key support: https://github.com/rancher/fleet/issues/138 | |
Generate the private key and public key: | |
ssh-keygen -t rsa -b 4096 -m pem -C "Rancher chart ssh-key" | |
Since there is no password option in the Rancher interface, provide the keys without a passphrase and place the keys to a location of your choice. | |
Test the key against Github to validate it is correct: | |
ssh-agent bash -c 'ssh-add /Users/USERNAME/.ssh/id_rsa_rancher_chart; git clone [email protected]:REPOSITORY/charts.git' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Attach the public ELBs to the instance if they change | |
resource "aws_elb_attachment" "default" { | |
depends_on = [var.elb_depends_on] | |
for_each = toset(local.instance_ids) | |
elb = aws_elb.default.id | |
instance = each.value | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
changed: [127.0.0.1] => (item={'changed': False, 'stat': {'exists': False}, 'invocation': {'module_args': {'path': '/Users/rogierdikkes/Git/ansible/roles/role/handlers', 'follow': False, 'get_md5': False, 'get_checksum': True, 'get_mime': True, 'get_attributes': True, 'checksum_algorithm': 'sha1'}}, 'failed': False, 'item': {'dest': 'handlers'}, 'ansible_loop_var': 'item'}) => { | |
"ansible_loop_var": "item", | |
"changed": true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: 'Verify if directories already exists' | |
stat: | |
path: "{{ playbook_dir }}/roles/{{ new_role_name }}/{{item.dest}}" | |
register: folder_stats | |
loop: | |
- { dest: "tasks" } | |
- { dest: "templates" } | |
- { dest: "defaults" } | |
- { dest: "handlers" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: 'Register Test VPC into a var' | |
ec2_vpc_net_facts: | |
filters: | |
"tag:Name": test-vpc | |
register: vpctest | |
# You probably need to change the IP for something at your side | |
- name: 'Creating Customer Gateway' | |
ec2_customer_gateway: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: set up VPN with tunnel options utilizing 'TunnelInsideCidr' only | |
ec2_vpc_vpn: | |
state: present | |
filters: | |
vpn: vpn-XXXXXXXX | |
static_only: true | |
tunnel_options: | |
- | |
TunnelInsideCidr: '169.254.100.1/30' | |
- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cat >> ./file1.text <<EOF | |
YOUR_NAME: '$RELEASE_NAME' | |
YOUR_ADDR: '$RELEASE_NAMESPACE' | |
EOF | |
cat >> ./file2.text <<EOF | |
MY_NAME: '$RELEASE_NAME' | |
MY_ADDR: '$RELEASE_NAMESPACE' |
NewerOlder