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
あれは良かった、あれは苦労したB2B2C型SaaSの新規開発におけるCloud Spanner
hirohito1108
2
370
Data-centric AI入門第6章:Data-centric AIの実践例
x_ttyszk
1
390
Postmanを使いこなす!2025年ぜひとも押さえておきたいPostmanの10の機能
nagix
2
140
2.5Dモデルのすべて
yu4u
2
790
データの品質が低いと何が困るのか
kzykmyzw
6
1.1k
トラシューアニマルになろう ~開発者だからこそできる、安定したサービス作りの秘訣~
jacopen
2
1.8k
OpenID Connect for Identity Assurance の概要と翻訳版のご紹介 / 20250219-BizDay17-OIDC4IDA-Intro
oidfj
0
160
地方拠点で エンジニアリングマネージャーってできるの? 〜地方という制約を楽しむオーナーシップとコミュニティ作り〜
1coin
1
220
OpenID BizDay#17 KYC WG活動報告(法人) / 20250219-BizDay17-KYC-legalidentity
oidfj
0
140
Tech Blogを書きやすい環境づくり
lycorptech_jp
PRO
1
230
現場の種を事業の芽にする - エンジニア主導のイノベーションを事業戦略に装着する方法 -
kzkmaeda
2
1.8k
5分で紹介する生成AIエージェントとAmazon Bedrock Agents / 5-minutes introduction to generative AI agents and Amazon Bedrock Agents
hideakiaoyagi
0
230
Featured
See All Featured
How to train your dragon (web standard)
notwaldorf
91
5.8k
GitHub's CSS Performance
jonrohan
1030
460k
Rails Girls Zürich Keynote
gr2m
94
13k
jQuery: Nuts, Bolts and Bling
dougneiner
63
7.6k
The Cult of Friendly URLs
andyhume
78
6.2k
Building Flexible Design Systems
yeseniaperezcruz
328
38k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
193
16k
How GitHub (no longer) Works
holman
313
140k
Code Reviewing Like a Champion
maltzj
521
39k
BBQ
matthewcrist
86
9.5k
Embracing the Ebb and Flow
colly
84
4.6k
RailsConf 2023
tenderlove
29
1k
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….