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
variable "env" {} | |
variable "instance_type" {} | |
variable "bastion_key_name" {} | |
variable "bastion_key_path" {} | |
variable "vpc_id" {} | |
variable "vpc_cidr" {} | |
variable "peered_vpc_cidr" {} | |
variable "subnet_ids" {} | |
variable "shell_username" {} | |
variable "public_zone_id" {} |
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 | |
set -x | |
# Ensure dependencies are installed | |
yum install -y epel-release | |
yum update -y epel-release | |
yum install -y python-pip python-devel git openssl-devel libffi-devel | |
pip install --upgrade pip | |
pip install --upgrade setuptools | |
yum install -y awscli python-six ansible |
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
--- | |
mysql_build_cluster: false | |
mysql_verify_cluster: false | |
# It's always | |
mysql_ | |
mysql_ | |
mysql_ | |
# It's never about MEsql | |
... |
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
data "template_file" "kibana" { | |
template = "${file("${path.module}/init.sh")}" | |
vars { | |
TERRAFORM_env = "${var.env}" | |
TERRAFORM_user = "${var.shell_username}" | |
TERRAFORM_role = "kibana" | |
} | |
} |
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
resource "aws_iam_role_policy" "instance_policy" { | |
name = xxxxxxx | |
role = "${aws_iam_role.instance_role.id}" | |
policy = xxxxxxx | |
# Allows the IAM role enough time to propagate through AWS | |
provisioner "local-exec" { | |
command = <<EOT | |
echo "Sleeping for 10 seconds to allow the IAM role enough time to propagate through AWS"; | |
sleep 10; |
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 bats | |
@test "Kibana is installed" { | |
run rpm -q kibana | |
[ "$status" -eq 0 ] | |
} | |
@test "Kibana is running" { | |
run systemctl is-active kibana | |
[ "$status" -eq 0 ] |
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
$ cat scripts/serverspec.sh | |
#!/bin/bash | |
# WHAT: Run serverspec tests that Packer copies up to the server. You'll need a ruby environment with bundler and gem. | |
cd /tmp/tests | |
/usr/local/bin/bundler install --no-deployment | |
/usr/local/bin/bundler exec rake spec | |
cd /tmp | |
rm -rf /tmp/tests |
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
/* | |
other configs go here | |
*/ | |
resource "aws_security_group" "elb" { | |
name = "${var.env}-${var.tier}-elasticsearch-elb-sg" | |
vpc_id = "${var.vpc_id}" | |
description = "Allow http and https inbound traffic through the ELB." | |
tags { |
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: Give 50% of all memory to the JVM | |
set_fact: | |
elasticsearch_java_initial_heap_size: "{{ (2|pow(((ansible_memtotal_mb|log(2))|round|int)) * 0.50)|int }}m" | |
elasticsearch_java_maximum_heap_size: "{{ (2|pow(((ansible_memtotal_mb|log(2))|round|int)) * 0.50)|int }}m" | |
... |
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
$ sudo rkt --insecure-options=image run docker://redis | |
stage1: warning: no volume specified for mount point "volume-data", implicitly creating an "empty" volume. This volume will be removed when the pod is garbage-collected. | |
stage1: Docker converted image, initializing implicit volume with data contained at the mount point "volume-data". | |
stage1: warning: no volume specified for mount point "volume-data", implicitly creating an "empty" volume. This volume will be removed when the pod is garbage-collected. | |
stage1: Docker converted image, initializing implicit volume with data contained at the mount point "volume-data". | |
[20030.471072] redis[5]: 5:C 03 Mar 18:14:10.858 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf | |
[20030.471791] redis[5]: 5:M 03 Mar 18:14:10.859 # You requested maxclients of 10000 requiring at least 10032 max file descriptors. | |
[20030.472056] redis[5]: 5:M 03 Mar 18:14:10.859 # Server can't set maximum open fil |