Skip to content

Instantly share code, notes, and snippets.

@yamamoto-febc
yamamoto-febc / file0.yml
Created November 12, 2017 12:26
RancherOSで起動時にNFS(EFS)をマウント ref: http://qiita.com/yamamoto-febc/items/fb3006cf3cf5a18c4e11
#cloud-init
mounts:
- ["192.2.0.1:/export", "/mnt/efs", "nfs4", "nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2"]
@yamamoto-febc
yamamoto-febc / file0.yml
Last active November 11, 2017 08:53
[作成中]RancherOSで起動時にNFS(EFS)をマウント ref: http://qiita.com/yamamoto-febc/items/e4181902245ba30aed0d
#cloud-init
rancher:
mounts:
- ["${efs_server}:/", "/mnt/efs", "nfs4", "nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2"]
@yamamoto-febc
yamamoto-febc / static_ip_example.yml
Last active November 2, 2017 00:58
LinuxKitでスタティックIPアドレスを設定 ref: http://qiita.com/yamamoto-febc/items/5c651233b8989e6719a4
kernel:
image: linuxkit/kernel:4.9.59
cmdline: "console=tty0 console=ttyS0 console=ttyAMA0"
init:
- linuxkit/init:42a92119e1ca10380e0d33e26c0cbcf85b9b3558
- linuxkit/runc:817fdc592eac6cb7804fa1721a43a7f6e23fb50f
- linuxkit/containerd:82be2bbb7cf83bab161ffe2a64624ba1107725ff
- linuxkit/ca-certificates:af4880e78edc28743f7c5e262678c67c6add4c26
onboot:
- name: sysctl
@yamamoto-febc
yamamoto-febc / CSV_or_TSV形式_列を限定する例
Last active November 1, 2017 02:27
usacloudで様々な出力形式を使ってみる(Go言語のtext/templateなど) ref: http://qiita.com/yamamoto-febc/items/68154c2f6a18073e628b
# CSV
$ usacloud server ls --out csv --col ID --col Name
ID,Name
123456789001,GoDev01
123456789002,GoDev02
123456789003,GoDev03
# TSV
$ usacloud server ls --out csv
@yamamoto-febc
yamamoto-febc / さくらのクラウド_GCP_サイト間VPN.tf
Last active October 18, 2017 07:13
さくらのクラウドとGCPでサイト間VPNをコマンド一発構築 ref: http://qiita.com/yamamoto-febc/items/0bd3b0a036c05503a9e7
variable "gcp_region" {} // GCP側リージョン
variable "gcp_project" {} // GCPプロジェクトID
variable "gcp_credential_file" {} // GCP認証情報(JSONファイルパス)
variable "sacloud_zone" {} // さくらのクラウド ゾーン
/**********************************************************
* さくらのクラウド側設定
*********************************************************/
provider sakuracloud {
zone = "${var.sacloud_zone}"
@yamamoto-febc
yamamoto-febc / sacloud-example.tf
Created October 16, 2017 07:09
terraformでソースアーカイブIDが更新されても無視するための設定例
#パスワード定義
variable password {}
# パブリックアーカイブ(OS)のID参照用のデータソース定義
data sakuracloud_archive "centos" {
os_type = "centos"
}
# ディスク定義
resource "sakuracloud_disk" "disk01" {
@yamamoto-febc
yamamoto-febc / file0.txt
Created October 11, 2017 01:48
さくらのクラウド スタートアップスクリプトでのベストプラクティス(motdで通知編) ref: http://qiita.com/yamamoto-febc/items/d3b498f53c7d973f3e59
_motd() {
LOG=$(ls /root/.sacloud-api/notes/*log)
case $1 in
start)
echo -e "\n#-- Startup-script is \\033[0;32mrunning\\033[0;39m. --#\n\nPlease check the log file: ${LOG}\n" > /etc/motd
;;
fail)
echo -e "\n#-- Startup-script \\033[0;31mfailed\\033[0;39m. --#\n\nPlease check the log file: ${LOG}\n" > /etc/motd
exit 1
;;
@yamamoto-febc
yamamoto-febc / rancher-agents.tf
Last active May 23, 2018 08:15
Rancherのホスト(エージェント)登録をTerraformで
variable "password" {
default = "PUT_YOUR_PASSWORD_HERE"
}
variable "hostname" {
default = "agent-from-terraform"
}
#Create a new Rancher registration token
resource "rancher_registration_token" "default" {
@yamamoto-febc
yamamoto-febc / file0.txt
Created August 26, 2017 10:04
さくらのクラウドでGitLabを簡単に構築する ref: http://qiita.com/yamamoto-febc/items/09f46e2fdde231c3e3b1
/root/.sacloud-api/notes/[12桁の数値].log
@yamamoto-febc
yamamoto-febc / Unattend.xml
Created August 22, 2017 06:47
さくらのクラウド上でパブリックアーカイブから作成したWindowsサーバにパスワードを設定するための応答ファイルサンプル
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="oobeSystem">
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<OOBE>
<HideEULAPage>true</HideEULAPage>
</OOBE>
<UserAccounts>
<AdministratorPassword>
<Value>PUT-YOUR-PASSWORD-HERE</Value>