Skip to content

Instantly share code, notes, and snippets.

@knakayama
knakayama / rds.tf
Last active September 27, 2018 09:42
variable "name" {
default = "test"
}
variable "region" {
default = "ap-northeast-1"
}
variable "vpc_cidr" {
default = "172.16.0.0/16"
#!/usr/bin/env bash
pip install ansible
variable "name" { default = "test" }
variable "region" { default = "ap-northeast-1" }
variable "access_key" { }
variable "secret_key" { }
variable "vpc_cidr" { default = "172.16.0.0/16" }
variable "az" { default = "ap-northeast-1a" }
variable "public_subnet" { default = "172.16.0.0/24" }
variable "web_instance_type" { default = "t2.micro" }
---
- name: Check if hoge in fuga
shell: |
grep -F 'hoge' roles/test/files/path/to/fuga
register: res
always_run: yes
failed_when: no
changed_when: res.rc == 0
notify:
- Ping only if hoge in fuga
#compdef apex
function _apex() {
local context curcontext=$curcontext state line
typeset -A opt_args
local ret=1
_arguments -C \
'(-C --chdir)'{-C,--chdir}'[<string> Working directory]' \
'(-D --dry-run)'{-D,--dry-run}'[Perform a dry-run]' \
require 'spec_helper'
describe 'www.example.com' do
it { is_expected.to have_dns.with_type('A') }
end
---
- name: Ansible tips
connection: local
hosts: localhost
tasks:
- name: Ping only if OSX
ping:
when: "{{ lookup('pipe', 'uname -s') | match('Darwin') }}"
---
- name: Test serial
hosts: test
serial: 2
tasks:
- name: task1
ping:
- name: task2
ping:
variable "name" { default = "test" }
variable "region" { default = "ap-northeast-1" }
variable "vpc_cidr" { default = "172.16.0.0/16" }
variable "az" { default = "ap-northeast-1a" }
variable "public_subnet" { default = "172.16.0.0/24" }
variable "web_instance_type" { default = "t2.micro" }
variable "web_instance_ami_id" { default = "ami-383c1956" }
- hosts: all
tasks:
- name: Create a group of all hosts by operating system
group_by: key={{ansible_distribution}}-{{ansible_distribution_version}}
# the following host group does not exist in inventory and was created by the group_by
# module.