version Implement test recipe on each role cd /path/pairs/prod/jp terraform apply cd /path/to/test rake pairs:prod/jp/web cd /path/to/ansible_dir ansible-playbook -i hosts/pairs/prod/jp playbook playbook/web.yml exists servers Attach to ELB Activator Ops ᶃ ᶄ ᶅ ᶆ • Scheduled Activation • Semi Automatic Activation
with tags Implement test recipe on each role Provisioning process • Server creation • Via terraform & add tags • Provisioning & deploy • Using dynamic inventory • Implement test recipe • Using Ruby AWS SDK • Attach to ELB • Name:pairs-jp-web-xx • env:prod • regin:jp • role:web exists servers Provisioning and deploy current app version cd /path/to/ansible_dir ansible-playbook -i hosts/pairs/prod/jp playbook playbook/web.yml ᶃ ᶄ ᶅ
with tags Provisioning deploy Test middleware and app status cd /path/pairs/prod/jp terraform apply cd /path/to/test rake pairs:prod/jp/web cd /path/pairs/prod/jp ansible-playbook -i hosts/pairs/prod/jp playbook playbook/web.yml Procedure for Provisioning • Server creation • via terraform & add tags • Provisioning & deploy • Using dynamic inventory • Implement test recipe • Using Ruby AWS SDK # Example ) Additional App Server Recipe resource "aws_instance" "web_xx" { ami = "ami-xxxxxxx" instance_type = "${var.ec2.app.instance_type}" availability_zone = "${var.vpc.region_1a}" security_groups = ["${aws_security_group.app.id}"] subnet_id = "${aws_subnet.app_1a.id}" ebs_optimized = "${var.ec2.app.ebs_optimized}" iam_instance_profile = "${var.ec2.app.iam_instance_profile}" count = 1 tags { Name = “pairs-jp-web-xx” # Unique name for each server role = “pairs-jp-web” # Group for provisioning region = "jp" env = "prod" } }
with tags Provisioning process • Server creation • Via terraform & add tags • Provisioning & deploy • Using dynamic inventory • Implement test recipe • Using Ruby AWS SDK • Attach to ELB Belong to same env/region/role exists servers Provisioning and deploy current app version cd /path/to/ansible_dir ansible-playbook -i hosts/pairs/prod/jp playbook playbook/web.yml ᶃ ᶄ ᶅ • Name:pairs-jp-web-xx • env:prod • regin:jp • role:web Implement test recipe on each role
with tags Provisioning process • Server creation • Via terraform & add tags • Provisioning & deploy • Using dynamic inventory • Implement test recipe • Using Ruby AWS SDK • Attach to ELB • Name:pairs-jp-web-xx • env:prod • regin:jp • role:web exists servers Provisioning and deploy current app version cd /path/to/ansible_dir ansible-playbook -i hosts/pairs/prod/jp playbook playbook/web.yml ᶃ ᶄ ᶅ Dynamically fetched via ec2.py Implement test recipe on each role
with tags Provisioning process • Server creation • Via terraform & add tags • Provisioning & deploy • Using dynamic inventory • Implement test recipe • Using Ruby AWS SDK • Attach to ELB exists servers Provisioning and deploy current app version cd /path/to/ansible_dir ansible-playbook -i hosts/pairs/prod/jp playbook playbook/web.yml • Name:pairs-jp-web-xx • env:prod • regin:jp • role:web ᶃ ᶄ ᶅ Dynamically fetched via ruby aws sdk Implement test recipe on each role
ansible-playbook -i hosts/pairs/prod/jp playbook playbook/web.yml Create server with tags Implement test recipe on each role Procedure for Provisioning • Server creation • Via terraform & add tags • Provisioning & deploy • Using dynamic inventory • Implement test recipe • Using Ruby AWS SDK • Name:pairs-jp-web-xx • env:prod • regin:jp • role:web exists servers Provisioning and deploy current app version # Example ) Rakefile (Define test tasks # Pseudo code) # test recipe : spec/prod/jp/web_spec.rb / spec/common/comon.rb if ec2_hosts ec2_hosts.each do |host| task_name = "#{host_env}:#{host_region}:#{host_group}" spec_pattern = "spec/#{host_env}/#{host_region}/#{host_group} _spec.rb" # define tasks for each roles desc "Run serverspec tests to ec2 #{host_name} (PATH=#{spec_pattern},IP=#{host_ip})" RSpec::Core::RakeTask.new(host_name.to_sym) do |t| ENV['TARGET_HOST'] = host_ip ENV['TARGET_HOST_NAME'] = host_name t.pattern = "#{spec_pattern},spec/common/*_spec.rb" end end end
with tags Provisioning process • Server creation • Via terraform & add tags • Provisioning & deploy • Using dynamic inventory • Implement test recipe • Using Ruby AWS SDK • Attach to ELB • Name:pairs-jp-web-xx • env:prod • regin:jp • role:web exists servers Attach to ELB cd /path/to/ansible_dir ansible-playbook -i hosts/pairs/prod/jp playbook playbook/web.yml Provisioning and deploy current app version ᶃ ᶄ ᶅ ᶆ Implement test recipe on each role
version Implement test recipe on each role cd /path/pairs/prod/jp terraform apply cd /path/to/test rake pairs:prod/jp/web cd /path/to/ansible_dir ansible-playbook -i hosts/pairs/prod/jp playbook playbook/web.yml exists servers Attach to ELB Activator Ops ᶃ ᶄ ᶅ ᶆ • Scheduled Activation • Semi Automatic Activation