Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
20190720_Better Practice_ Day 2 Operaition with...
Search
Phil Huang
July 20, 2019
Technology
1.1k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
20190720_Better Practice_ Day 2 Operaition with Ansible
#ansible
Phil Huang
July 20, 2019
More Decks by Phil Huang
See All by Phil Huang
20251119 如果是勇者欣美爾的話, 他會怎麼做? 東海資工
pichuang
1
240
20250924 零信任下的容器安全供應鏈:從隔離到信任
pichuang
0
110
20250705 Headlamp: 專注可擴展性的 Kubernetes 用戶界面
pichuang
0
440
20250307 雲端原生:引領數位轉型與永續的雙贏之道
pichuang
0
140
20250116 When Windows Meets Kubernetes…
pichuang
0
650
20241217-Azure Red Hat OpenShift 於 Azure TaiwanNorth 上之雲原生異地備援架構設計
pichuang
0
190
20241112 Real AVS Migration Experience Sharing
pichuang
0
150
Active/Passive HA FortiGate Pair with External and Internal Azure Load Balancer
pichuang
0
740
20240814-採用 Azure VMware Solution 啟動你的 Azure 雲端服務
pichuang
0
190
Other Decks in Technology
See All in Technology
ペアプロの価値はコードを書くことだけじゃない
codmoninc
PRO
0
150
AI時代に、プロダクトの数だけ積み上がる所有コストをどうエンジニアリングするか / Engineering the Cost of Ownership
kzkmaeda
1
1.1k
enechainの内製セルフサービスプラットフォーム
hiyosi
0
150
Where Is JetBrains AI Heading- — Central CLI, Air Alpha, and the Agentic Development Stack
x5gtrn
PRO
0
150
Code4Lib JAPANカンファレンス2026 開会挨拶 / Code4Lib JAPAN Conference 2026: Opening Remarks
ykiyota
0
280
あるけみー式LTスライド作成術
alchemy1115
1
140
スクラムで身についていた動き方を、XPで捉え直してみた
codmoninc
PRO
1
330
なぜSRE・セキュリティは評価されないのか?守りの組織を事業成長エンジンに変えた実践
cscengineer
PRO
3
2.4k
「図書館」という名前のままでいいのか -Code4Lib JAPANカンファレンス2026 アンカンファレンス報告- / Code4Lib JAPAN Conference 2026: Unconference Report
ykiyota
0
130
SQL文一行も書けない人事がCortexもろもろを使って人事業務を楽にしてみる
ponponmikankan
1
200
2026-09-04 SRE Tech Talk #15 怠惰なTerraform / Lazy Terraform
masasuzu
0
230
20260912_スクフェス三河
kgnkhkr
0
170
Featured
See All Featured
The Invisible Side of Design
smashingmag
301
52k
Rails Girls Zürich Keynote
gr2m
96
14k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
310
We Have a Design System, Now What?
morganepeng
55
8.3k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
490
Statistics for Hackers
jakevdp
799
230k
It's Worth the Effort
3n
188
29k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
410
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
3k
Crafting Experiences
bethany
1
310
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
Transcript
Best Better Practice: Day 2 Operation with Ansible Phil Huang
黃秉鈞 <
[email protected]
> SDN x Cloud Native Meetup #18, Taiwan, July. 20, 2019
# whois Phil Huang 黃秉鈞 • 社群斜槓 青年 青壯年 ◦
SDNDS-TW ◦ Cloud Native Taiwan User Group (CNTUG) • 任職於 Red Hat 擔任 Solution Architect ◦ Ansible IT Automation ◦ OpenShift Container Platform ◦ Software-Defined Networking (SDN) ◦ Network Function Virtualization (NFV) • Blog ◦ https://blog.pichuang.com.tw Ref: https://www.linkedin.com/in/phil-huang-09b09895/
感謝 Monosapce 共同工作空間 提供場地支持 Ref: https://monospace.tw/
感謝 台中自由軟體愛好者社群 - TFC 提供社群支持 Ref: https://www.facebook.com/tfctaiwan
Before Starting
閒聊... 1. Ceph 快起飛了 2. k8s 多網卡架構 3. Ansible 的
Logo 小趣事
假設你... 1. 你知道 Ansible 2. 你用過 Ansible 3. 你電腦有裝 Ansible
回顧一下 Ansible 技術概觀介紹_20190130 Ref: https://speakerdeck.com/pichuang/ansible-ji-shu-gai-guan-jie-shao-20190130
Ansible in Real World
Q: Ansible 在 IT 架構具體落地是在哪裡? Ref: https://www.ibm.com/cloud/blog/end-to-end-application-provisioning-with-ansible-and-terraform
A: 堡壘機 (Bastion Host / Jump Server ) • 單一管理入口
• 權限控管窗口 • 雜 Code 放置所 Ref: 認識 Bastion Host 部署管理機 - Yi Yang
關於 SSH 連線 - ProxyCommand Ref: 認識 Bastion Host 部署管理機
- Yi Yang Host 10.10.10.* ProxyCommand ssh -W %h:%p bastion.pichuang.local IdentityFile ~/.ssh/private_key.pem Host bastion.pichuang.local Hostname bastion.pichuang.local User pichuang IdentityFile ~/.ssh/private_key.pem StrictHostKeyChecking no
到底 ansible.cfg 放在哪裡好? A. ANSIBLE_CONFIG (environment variable if set) B.
ansible.cfg (in the current directory) C. ~/.ansible.cfg (in the home directory) D. /etc/ansible/ansible.cfg Ref: https://docs.ansible.com/ansible/latest/reference_appendices/config.html#the-configuration-file 個人慣例
是否該維護自己的 ansible.cfg? Ref: https://gist.github.com/pichuang/7b1b826595aada062f37eee5ab9852a2#file-ansible-cfg-L13 • 就像對待 dotfiles (.bashrc / .vimrc
/ … ) • 常駐外掛: SSH 加速設定 • 開了不會後悔的參數 • callback_whitelist = profile_tasks • stdout_callback = debug
Recap: 三個指令學一下 • 檢查環境 ◦ ansible -i hosts all -m
ping • 同時下指令 (回想起用 tmux synchronize-panes 的畫面嗎?) ◦ ansible -i hosts all -m command -a “ls” • Copy 檔案 (回想起用 scp + for 迴圈的日子了嗎?) ◦ ansible -i hosts all -m copy -a “src=/ooxx dest=/xxoo”
Ansible Command v.s. Shell v.s. Raw • Linux ◦ command
> shell > raw • Windows ◦ win_command > win_shell > raw • Network ◦ *os_command > raw 三者參考選擇: • 避免環境變數注入問題,寫 Playbook 時,優選 command • shell 類同於一般打指令 ◦ ansible -m shell -a “xxx | ooo >> $HOME” • raw 在受控機器環境嚴苛狀況下再考慮用 (例如 router)
啥時該寫 Ansible Playbook? • 短時間內需要反覆下同樣的指令 • 每日例行公事 • Debugging •
分享經驗給其他人 ◦ ansible-galaxy (o) ◦ git (o) ◦ svn (o) ◦ zip (x) Check List
Q: 如何使用 ansible-playbook 指令? A. 直接下指令: ansible-playbook -i hosts ...
B. shell script + ansible-playbook C. makefile + ansible-playbook 個人慣例
A: ansible-playbook 與 {Shell Script, Makefile} 是好友 $ cat /usr/bin/upgrade.sh
#!/bin/bash ansible-playbook -i hosts /do/not/copy/the/script/upgrade.yml $ chmod +x /usr/bin/upgrade.sh $ upgrade.sh
Ansible v.s. (or +) Terraform (1/2) • Ansible: 單點 Configuration
• Terraform: 廣域 Provision
Ansible v.s. (or +) Terraform (2/2)
IaC 基礎建設即代碼: Git + Ansible 上班撿到槍組合 Ref: https://about.gitlab.com/community/heroes • 版本控制
>> 多人共用 • 地端最多人用 GitLab • 開發流程選擇 ◦ 小型副本: GitHub Flow ◦ 大型副本: GitLab Flow
Ansible 除錯小技巧 Ref: https://blog.pichuang.com.tw/20190618-ansible-troubleshooting/
思考 Pipeline 心法: Step by Step 點、線、面
After
Ref: https://www.facebook.com/events/2143280755732051/
Ref: http://ansible.tw/#!index.md
Ref: https://www.facebook.com/RedHatTaiwan/ 紅帽美女S小編說:
Q&A 台上一小時,台下三日夜 社群正向回饋,需要一起參與 Ref: https://www.facebook.com/micomikicat/