Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Ansibleとテスト
Search
volanja
September 22, 2014
Technology
8
2.6k
Ansibleとテスト
Ansible Meetup in Tokyo 2014.09
volanja
September 22, 2014
Tweet
Share
Other Decks in Technology
See All in Technology
ディスプレイ広告(Yahoo!広告・LINE広告)におけるバックエンド開発
lycorptech_jp
PRO
0
490
役員・マネージャー・著者・エンジニアそれぞれの立場から見たAWS認定資格
nrinetcom
PRO
4
6.4k
急成長する企業で作った、エンジニアが輝ける制度/ 20250227 Rinto Ikenoue
shift_evolve
0
180
AIエージェント開発のノウハウと課題
pharma_x_tech
7
4.2k
いまからでも遅くない!コンテナでWebアプリを動かしてみよう!コンテナハンズオン編
nomu
0
170
【詳説】コンテンツ配信 システムの複数機能 基盤への拡張
hatena
0
280
Охота на косуль у древних
ashapiro
0
120
Apache Iceberg Case Study in LY Corporation
lycorptech_jp
PRO
0
350
Amazon Aurora のバージョンアップ手法について
smt7174
2
180
実は強い 非ViTな画像認識モデル
tattaka
3
1.4k
AWS Well-Architected Frameworkで学ぶAmazon ECSのセキュリティ対策
umekou
2
150
30→150人のエンジニア組織拡大に伴うアジャイル文化を醸成する役割と取り組みの変化
nagata03
0
200
Featured
See All Featured
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
129
19k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
7
650
Embracing the Ebb and Flow
colly
84
4.6k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
27
1.9k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
59k
The Language of Interfaces
destraynor
156
24k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
32
2.1k
Done Done
chrislema
182
16k
Building Applications with DynamoDB
mza
93
6.2k
Building Adaptive Systems
keathley
40
2.4k
For a Future-Friendly Web
brad_frost
176
9.6k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
Transcript
Ansible Meetup in Tokyo 2014.09 LT ʮAnsibleͱςετʯ @volanja
Introduction • Twitter / Github / Qiita : volanja •
Ansibleྺ:1 (≒Github/Qiitaྺ) • QiitaʮAnsilbeͰ࡞ΔGitlab+RedmineʯͳͲɻ • Ansible Advent Calendar 2013 ࡢɺͬͯΈ·ͨ͠ɻ࠷ॳͱ࠷ޙͷਓͰ͢ɻ
Thank you All Author!!
Ansibleͬͯ·͔͢ʁ
ςετͲ͏ͯ͠·͔͢ʁ
Severspec http://serverspec.org/
ansible_spec https://rubygems.org/gems/ansible_spec
ansible_spec • RubyίϚϯυϥΠϯπʔϧͰ͢ɻ AnsibleͱServerspecΛΈ߹Θͤͯ͏ͨΊͷɺ Rakefileͱspec_helper.rbΛ࡞͠·͢ɻ • ServerspecɺAnsibleͷInventoryFile͔ΒରϗετΛɺ playbook͔ΒରϩʔϧΛɺಡΈࠐΜͰςετΛ࣮ߦ͠·͢ɻ $ gem
install ansible_spec $ ansiblespec_init create spec create spec/spec_helper.rb create Rakefile create .ansiblespec
ᵓᴷᴷ hostsɹɹ(Inventoryfile) ᵓᴷᴷ site.yml (playbook) ᵓᴷᴷ roles ᴹ ᵋᴷᴷ nginx
ᴹ ᵋᴷᴷ spec ᴹ ᵋᴷᴷ nginx_spec.rb ᴹ ᵋᴷᴷ tasks ᴹ ᵋᴷᴷ main.yml ᵓᴷᴷ Rakefile ᵓᴷᴷ spec ᵋᴷᴷ spec_helper.rb ᵋᴷᴷ .ansiblespecɹɹɹ(playbook, inventoryfileΛઃఆ͢ΔϑΝΠϧ) AnsibleͱServerspec Ansible Serverspec σΟϨΫτϦߏ(like BestPractise) by https://github.com/volanja/ansible-sample-tdd
࣮ߦ $ ansible-playbook site.yml -i hosts ! PLAY [Ansible-Sample-TDD] *****************************************************
GATHERING FACTS *************************************************************** ok: [192.168.0.103] (লུ) PLAY RECAP ******************************************************************** 192.168.0.103 : ok=10 changed=9 unreachable=0 failed=0 $ rake serverspec:Ansible-Sample-TDD Run serverspec for Ansible-Sample-TDD to 192.168.0.103 /Users/Adr/.rvm/rubies/ruby-2.0.0-p353/bin/ruby -S rspec roles/nginx/spec/nginx_spec.rb ........... Finished in 0.79885 seconds 11 examples, 0 failures
$ ansible-playbook site.yml -i hosts ! PLAY [Ansible-Sample-TDD] ***************************************************** GATHERING
FACTS *************************************************************** ok: [192.168.0.103] (লུ) PLAY RECAP ******************************************************************** 192.168.0.103 : ok=10 changed=9 unreachable=0 failed=0 $ rake serverspec:Ansible-Sample-TDD Run serverspec for Ansible-Sample-TDD to 192.168.0.103 /Users/Adr/.rvm/rubies/ruby-2.0.0-p353/bin/ruby -S rspec roles/nginx/spec/nginx_spec.rb ........... Finished in 0.79885 seconds 11 examples, 0 failures site.yml is playbook - name: Ansible-Sample-TDD ࣮ߦ
$ ansible-playbook site.yml -i hosts ! PLAY [Ansible-Sample-TDD] ***************************************************** GATHERING
FACTS *************************************************************** ok: [192.168.0.103] (লུ) PLAY RECAP ******************************************************************** 192.168.0.103 : ok=10 changed=9 unreachable=0 failed=0 $ rake serverspec:Ansible-Sample-TDD Run serverspec for Ansible-Sample-TDD to 192.168.0.103 /Users/Adr/.rvm/rubies/ruby-2.0.0-p353/bin/ruby -S rspec roles/nginx/spec/nginx_spec.rb ........... Finished in 0.79885 seconds 11 examples, 0 failures hosts is InventoryFile [Server] 192.168.0.103 ࣮ߦ
• GemͷৄࡉҎԼͷϖʔδΛޚཡ͍ͩ͘͞ɻ Github volanja/ansible_spec https://github.com/volanja/ansible_spec • NginxͱMariaDBΛΠϯετʔϧ͢Δαϯϓϧ͕͋Γ·͢ɻ Githubɹvolanja/ansible-sample-tdd https://github.com/volanja/ansible-sample-tdd
ͱ͜ΖͰɺ AnsibleͱผͷςετπʔϧඞཁͰ͠ΐ͏͔ʁ
Testing Strategies • Ansible » Docs » Testing Strategies http://docs.ansible.com/test_strategies.html
• Conclusion “Ansible believes you should not need another framework to validate basic things of your infrastructure is true.” • modules for Test assert, register, when, fail
Έͳ͞ΜͲ͏͍ͯ͠·͔͢ʁ
Welcome to Ansible Advent Calendar 2014 at Qiita or ATND
͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ɻ
͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ɻ དྷ݄ʹServerspec v2͕ग़ΔͷͰɺ ͝հͨ͠Gemಈ͔ͳ͘ͳΔ͔͠Ε·ͤΜorz….