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
障害対応指揮の意思決定と情報共有における価値観 / Waroom Meetup #2
arthur1
5
480
New Relicを活用したSREの最初のステップ / NRUG OKINAWA VOL.3
isaoshimizu
2
610
データプロダクトの定義からはじめる、データコントラクト駆動なデータ基盤
chanyou0311
2
320
【Startup CTO of the Year 2024 / Audience Award】アセンド取締役CTO 丹羽健
niwatakeru
0
1.2k
マルチプロダクトな開発組織で 「開発生産性」に向き合うために試みたこと / Improving Multi-Product Dev Productivity
sugamasao
1
310
Flutterによる 効率的なAndroid・iOS・Webアプリケーション開発の事例
recruitengineers
PRO
0
110
EventHub Startup CTO of the year 2024 ピッチ資料
eventhub
0
120
OCI Network Firewall 概要
oracle4engineer
PRO
0
4.1k
ドメインの本質を掴む / Get the essence of the domain
sinsoku
2
160
OCI 運用監視サービス 概要
oracle4engineer
PRO
0
4.8k
【令和最新版】AWS Direct Connectと愉快なGWたちのおさらい
minorun365
PRO
5
750
初心者向けAWS Securityの勉強会mini Security-JAWSを9ヶ月ぐらい実施してきての近況
cmusudakeisuke
0
130
Featured
See All Featured
Building Flexible Design Systems
yeseniaperezcruz
327
38k
A designer walks into a library…
pauljervisheath
204
24k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
Why Our Code Smells
bkeepers
PRO
334
57k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
840
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
28
2k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
47
2.1k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Testing 201, or: Great Expectations
jmmastey
38
7.1k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
506
140k
Building Adaptive Systems
keathley
38
2.3k
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….