Skip to content

Instantly share code, notes, and snippets.

View VTRyo's full-sized avatar
🍺
I'm a beer taster. I'm loving it

VTRyo VTRyo

🍺
I'm a beer taster. I'm loving it
View GitHub Profile
@VTRyo
VTRyo / h2o start script
Last active June 20, 2017 05:40
default script is failed restart. This script will succeed
#!/bin/bash
#chkconfig: 2345 85 15
#descpriction: h2o Web Server
# source function library
. /etc/rc.d/init.d/functions
RETVAL=0
SERVICE_NAME=`basename $0`
@VTRyo
VTRyo / snippets.cson
Last active September 21, 2017 02:49
snippets of atom
'.source.json':
'variables':
'prefix':'variables'
'body': """
variable "${1:resource_name}" {
default = "${2:value}"
}
"""
'aws_instance':
@VTRyo
VTRyo / sshd_config
Last active December 13, 2017 07:29
chroot for sftp
## SFTPログイン時に/var/www/html配下のみ表示する
## sftpグループに所属しているユーザ(tatoeba, kimiga, kizutuite)にはUmask 002を付与
# override default of no subsystems
#Subsystem sftp /usr/libexec/openssh/sftp-server
Subsystem sftp internal-sftp
Match user tatoeba
ChrootDirectory /var/www
ForceCommand internal-sftp -u 002
@VTRyo
VTRyo / ansible_for_loop_control
Last active December 28, 2017 03:51
How to write multiple loops with ansible.
tasks/main.yml declares {{server_number}} as a variable of with_items.
After that, using the original {{ item }} by using {{ server_number }} in env/servers-1-10/main.yml that was included.
% tree roles/zabbix-server-host (zabbix-ansible) RyonoMac-mini
.
├── env
│   ├── servers-1-10
│   │   ├── main.yml
│   │   ├── www1.yml
│   │   ├── wwwN.yml
aws cloudfront create-invalidation --distribution-id <distribution ID> --paths '/*'
##variables.tf
variable "env" { }
variable "ec2_config" {
default = {
ami = "ami-4af5022c"
instance_type = "t2.micro"
instance_key = "id_rsa"
}
}
@VTRyo
VTRyo / aws_vpc_variables
Created January 22, 2018 02:31
terraform vpc variables avoid: "default may not contain interpolations"
"subnet_public_a_config": default may not contain interpolations
It is a way to avoid errors like
#--------------------------------------------------------
# variables
#--------------------------------------------------------
variable "vpc_config" {
default = {
cidr_block = "12.0.0.0/16"
instance_tenancy = "default"
enable_dns_support = true
% terraform init -upgrade env/stg (terraform-stg) RyonoMac-mini
Initializing the backend...
Initializing provider plugins...
- Checking for available provider plugins on https://releases.hashicorp.com...
- Downloading plugin for provider "aws" (1.7.1)...
The following providers do not have any version constraints in configuration,
so the latest version was installed.
@VTRyo
VTRyo / terraform-security_group_description_wrote
Last active January 26, 2018 01:43
terraform plan result: change resource
resource "aws_security_group" "infra" {
name = "infra"
description = "infra SSH"
vpc_id = "${aws_vpc.xxx_vpc.id}"
ingress {
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["xxx.xxx.xxx.xx/xx"]
@VTRyo
VTRyo / terraform-security_group_description_delete
Last active January 26, 2018 01:57
terraform plan result: no change
resource "aws_security_group" "infra" {
name = "infra"
description = "infra SSH"
vpc_id = "${aws_vpc.xxx_vpc.id}"
ingress {
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["xxx.xxx.xxx.xx/xx"]