Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Infrastructure as (Ruby) Code の現状確認 / Infrastru...

toshimaru
November 02, 2016

Infrastructure as (Ruby) Code の現状確認 / Infrastructure as Ruby Code 2016

Roppongi.rb #2 "Infrastructure x Ruby" ( http://roppongirb.connpass.com/event/42633/ )での発表スライドです。

- Blog記事にもまとめてあります: http://blog.toshimaru.net/infrastructure-as-ruby-code-2016/

toshimaru

November 02, 2016
Tweet

More Decks by toshimaru

Other Decks in Technology

Transcript

  1. *NNVUBCMF*OGSBTUSVDUVSF w "84 ($1Λ࢝Ίͱ͢Δ*BB4ొ৔ʹΑΓμΠφϛοΫͳ αʔόʔߏ੒͕Մೳͱͳͬͨ w Ϙλϯ̍ͭͰ্͛Լ͛͢Δαʔόʔ %JTQPTBCMFͳ αʔόʔ ஀ੜ

    w ΦʔτεέʔϦϯάͷԸܙΛڗड͢ΔͨΊʹ͸αʔόʔɾ ϓϩϏδϣχϯάࣗಈԽ࡞ۀ͕ඞཁ w ߏஙखॱΛ*NNVUBCMFʹ͠ɺ3FQSPEVDJCMFͳαʔ όʔ؀ڥʹ͢Δ *EFNQPUFODFΛ୲อ͢Δ
  2. 8IZ3VCZ w %4-ͷॻ͖΍͢͞ w એݴతͳهड़ w ࣗ༝౓͕ߴ͍ package 'nginx' do

    action :install end service 'nginx' do action [:enable, :start] end
  3. *OGSBTUSVDUVSFBT$PEF ͷΧόʔൣғ w *BB4͸Ծ૝αʔόҎ֎ʹ΋͞·͟·ͳαʔϏεΛఏ ڙ͍ͯ͠Δ w &-# 3%4 71$ 4

    $MPVE'SPOU *".  4FDVSJUZ(SPVQFUD w ͦΕΒʹର͢ΔΦϖϨʔγϣϯΛ"84 .BOBHFNFOU $POTPMFͳͲͷ(6*Ͱ΍Δ΂͖ͳͷ͔ʁ
  4. 3PVUF$POpHVSBUJPO hosted_zone "example.com." do rrset "example.com.", "A" do ttl 300

    resource_records( "127.0.0.1", "127.0.0.2" ) end end 1PXFSFECZ3PBEXPSLFS
  5. resource "aws_route53_record" "www" { zone_id = "${aws_route53_zone.primary.zone_id}" name = "www.example.com"

    type = "A" ttl = "300" records = ["${aws_eip.lb.public_ip}"] } 1PXFSFECZ5FSSBGPSN "841SPWJEFS 3PVUF$POpHVSBUJPO
  6. %BUBEPH"MFSU$POpHVSBUJPO monitor "Check load avg", :type=>"metric alert" do query "avg(last_5m):avg:ddstat.load_avg.1m{host:i-XXXXXXXX}

    > 1" message "@[email protected]" options do locked false new_host_delay 300 notify_no_data true no_data_timeframe 2 notify_audit true silenced({}) end end 1PXFSFECZ#FSLEPH
  7. (JUIVC.FNCFS.BOBHFNFOU resource "github_membership" "membership_for_some_user" { username = "SomeUser" role =

    "member" } resource "github_repository" "example" { name = "example" description = "My awesome codebase" private = true } resource "github_repository_collaborator" "a_repo_collaborator" { repository = "our-cool-repo" username = "SomeUser" permission = "admin" } 1PXFSFECZ5FSSBGPSNʢ(JUIVC1SPWJEFSʣ
  8. ࢀߟࢿྉ w *UBNBF*OGSBBT$PEFݱঢ়֬ೝձ IUUQTTQFBLFSEFDLDPNSZPUBSBJ JUBNBFJOGSBBTDPEFYJBO[IVBOHRVFSFOIVJ  w 3FCVJME*NNVUBCMF*OGSBTUSVDUVSF IUUQSFCVJMEGN 

    w *OGSBTUSVDUVSFBT$PEF4QFBLFS%FDL IUUQTTQFBLFSEFDLDPNOBPZB JOGSBTUSVDUVSFBTDPEF  w *OGSBTUSVDUVSFBT$PEF࠶ߟ IUUQNJ[[ZPSHCMPH  w 5SBTI:PVS4FSWFSTBOE#VSO:PVS$PEF*NNVUBCMF*OGSBTUSVDUVSFBOE %JTQPTBCMF$PNQPOFOUT IUUQDIBEGPXMFSDPN JNNVUBCMFEFQMPZNFOUTIUNM  w *OGSBTUSVDUVSF"T$PEF IUUQNBSUJOGPXMFSDPNCMJLJ *OGSBTUSVDUVSF"T$PEFIUNM