SlideShare uma empresa Scribd logo
1 de 29
Baixar para ler offline
跟著 geerlingguy 大神

一起測試 Ansible Roles
Cheng Wei Chen @ DevOps Taiwan Meetup #13 - Ansible User 小聚 (2018/4/28)
閃電秀
Cheng Wei Chen 陳 正瑋
DevOps Engineer @ 得寬科技
http://chengweichen.com
https://devopstw.club
https://devopsdays.tw
目前徵稿中!
活動日期:9/11 ~ 9/13
: https://unsplash.com/photos/DlR32lXV01M
Testing ?
Roles ?
Playbook ?
: https://www.ansible.com/beginners-guide-to-testing-infrastructure-as-code
: https://unsplash.com/photos/lt2GzPlOAmc , https://unsplash.com/photos/s8OO2-t-HmQ
Playbook Roles
: https://galaxy.ansible.com/ , https://github.com/logos , https://travis-ci.com/logo
: https://ithelp.ithome.com.tw/articles/10187519
Ansible 圈內 大神
Jeff Geerling
(@geerlingguy) is a
developer and has
been using Ansible to
manage infrastructure
since early 2013.
: https://www.ansiblefordevops.com/ , https://www.jeffgeerling.com/
Roles
基本結構
關鍵重點
: https://github.com/geerlingguy/ansible-role-docker
: https://github.com/geerlingguy/ansible-role-docker
tests/test.yml
: https://github.com/geerlingguy/ansible-role-docker
tests/test.yml
: https://github.com/geerlingguy/ansible-role-docker
tests/test.yml
: https://github.com/geerlingguy/ansible-role-docker
.travis.yml
: https://github.com/geerlingguy/ansible-role-docker
.travis.yml
運用 Docker
: https://github.com/geerlingguy/ansible-role-docker
.travis.yml
測試多種環境
: https://github.com/geerlingguy/ansible-role-docker
.travis.yml
設置 OPTIONS
: https://github.com/geerlingguy/ansible-role-docker
.travis.yml
取得測試用 shell script
: https://github.com/geerlingguy/ansible-role-docker
.travis.yml
執行測試
: https://github.com/geerlingguy/ansible-role-docker
.travis.yml
再次驗證 Roles 執行成果
: https://travis-ci.org/geerlingguy/ansible-role-docker
https://gist.githubusercontent.com/geerlingguy/
73ef1e5ee45d8694570f334be385e181/raw/
關鍵重點 / test.sh
test.sh
‧ 根據 env 設置的 os distribution,
透過 docker 運行對應的測試環境。
‧ 根據 test/requirements.yml 下載相
依之其他 Roles。
‧ 執行 --syntax-check 檢查是否有語
法錯誤。
test.sh
‧ 執行 test/test.yml,或執行 env 中
指定其他的 playbook。
‧ 再次執行 test/test.yml 檢查 Role
是否具備 idempotence 特性。
‧ 根據 OPTION 決定是否要刪除
docker container。
: https://github.com/geerlingguy/docker-ubuntu1604-ansible/blob/master/Dockerfile
: https://github.com/geerlingguy/docker-ubuntu1604-ansible/blob/master/Dockerfile
如何套用大神測試法?
複製 修改
test.yml
.travis.yml
pre_task
OPTIONS
如何驗證 Roles
執行成果
Thanks
Cheng Wei Chen @ DevOps Taiwan Meetup #13 - Ansible User 小聚 (2018/4/28)

Mais conteúdo relacionado

Mais procurados

Continuous Delivery Workshop with Ansible x GitLab CI (5th)
 Continuous Delivery Workshop with Ansible x GitLab CI (5th) Continuous Delivery Workshop with Ansible x GitLab CI (5th)
Continuous Delivery Workshop with Ansible x GitLab CI (5th)Chu-Siang Lai
 
摩登開發團隊的DevOps之道 (@DevOpsTaiwan)
摩登開發團隊的DevOps之道 (@DevOpsTaiwan)摩登開發團隊的DevOps之道 (@DevOpsTaiwan)
摩登開發團隊的DevOps之道 (@DevOpsTaiwan)Chen Cheng-Wei
 
Is it really easy for companies to import Ansible automation
Is it really easy for companies to import Ansible automationIs it really easy for companies to import Ansible automation
Is it really easy for companies to import Ansible automationChu-Siang Lai
 
Effective DevOps (Agile Tour HsinChu 2017)
Effective DevOps (Agile Tour HsinChu 2017)Effective DevOps (Agile Tour HsinChu 2017)
Effective DevOps (Agile Tour HsinChu 2017)Chen Cheng-Wei
 
DevOpsDays Taipei 2017 Farewell
DevOpsDays Taipei 2017 FarewellDevOpsDays Taipei 2017 Farewell
DevOpsDays Taipei 2017 FarewellChen Cheng-Wei
 
Continuous Delivery Workshop with Ansible x GitLab CI (3rd)
Continuous Delivery Workshop with Ansible x GitLab CI (3rd)Continuous Delivery Workshop with Ansible x GitLab CI (3rd)
Continuous Delivery Workshop with Ansible x GitLab CI (3rd)Chu-Siang Lai
 
Continuous Delivery - 敏捷開發的最後一哩路
Continuous Delivery - 敏捷開發的最後一哩路Continuous Delivery - 敏捷開發的最後一哩路
Continuous Delivery - 敏捷開發的最後一哩路Miles Chou
 
Dev ops 簡介
Dev ops 簡介Dev ops 簡介
Dev ops 簡介hugo lu
 
Proud Plone on Cloud
Proud Plone on CloudProud Plone on Cloud
Proud Plone on CloudTsungWei Hu
 
模块化和组件化Css
模块化和组件化Css模块化和组件化Css
模块化和组件化CssWu tianhao
 
用Octopus deploy做自動部署 - 快速上手
用Octopus deploy做自動部署 - 快速上手用Octopus deploy做自動部署 - 快速上手
用Octopus deploy做自動部署 - 快速上手Alan Tsai
 
DevOps核心理念和實踐
DevOps核心理念和實踐DevOps核心理念和實踐
DevOps核心理念和實踐Martin Liu
 
Testing in swift
Testing in swiftTesting in swift
Testing in swifthugo lu
 
運用 Docker 整合 Laravel 提升團隊開發效率
運用 Docker 整合 Laravel 提升團隊開發效率運用 Docker 整合 Laravel 提升團隊開發效率
運用 Docker 整合 Laravel 提升團隊開發效率Bo-Yi Wu
 
照騙小幫手 fakpy@HackNCUU
照騙小幫手 fakpy@HackNCUU照騙小幫手 fakpy@HackNCUU
照騙小幫手 fakpy@HackNCUUYukai Huang
 
twMVC#24 | 開發團隊的敏捷之路(未完成)
twMVC#24 | 開發團隊的敏捷之路(未完成)twMVC#24 | 開發團隊的敏捷之路(未完成)
twMVC#24 | 開發團隊的敏捷之路(未完成)twMVC
 
twMVC#21 | 你所不知道的 Visual Studio
twMVC#21 | 你所不知道的 Visual StudiotwMVC#21 | 你所不知道的 Visual Studio
twMVC#21 | 你所不知道的 Visual StudiotwMVC
 
twMVC#29 -Learning Machine Learning with Movie Recommendation
twMVC#29 -Learning Machine Learning with Movie RecommendationtwMVC#29 -Learning Machine Learning with Movie Recommendation
twMVC#29 -Learning Machine Learning with Movie RecommendationMia Chang
 
twMVC#25 | ASP.NET MVC A/B Testing 的眉眉角角
twMVC#25 | ASP.NET MVC A/B Testing 的眉眉角角twMVC#25 | ASP.NET MVC A/B Testing 的眉眉角角
twMVC#25 | ASP.NET MVC A/B Testing 的眉眉角角twMVC
 

Mais procurados (20)

Continuous Delivery Workshop with Ansible x GitLab CI (5th)
 Continuous Delivery Workshop with Ansible x GitLab CI (5th) Continuous Delivery Workshop with Ansible x GitLab CI (5th)
Continuous Delivery Workshop with Ansible x GitLab CI (5th)
 
摩登開發團隊的DevOps之道 (@DevOpsTaiwan)
摩登開發團隊的DevOps之道 (@DevOpsTaiwan)摩登開發團隊的DevOps之道 (@DevOpsTaiwan)
摩登開發團隊的DevOps之道 (@DevOpsTaiwan)
 
Is it really easy for companies to import Ansible automation
Is it really easy for companies to import Ansible automationIs it really easy for companies to import Ansible automation
Is it really easy for companies to import Ansible automation
 
Effective DevOps (Agile Tour HsinChu 2017)
Effective DevOps (Agile Tour HsinChu 2017)Effective DevOps (Agile Tour HsinChu 2017)
Effective DevOps (Agile Tour HsinChu 2017)
 
DevOpsDays Taipei 2017 Farewell
DevOpsDays Taipei 2017 FarewellDevOpsDays Taipei 2017 Farewell
DevOpsDays Taipei 2017 Farewell
 
Continuous Delivery Workshop with Ansible x GitLab CI (3rd)
Continuous Delivery Workshop with Ansible x GitLab CI (3rd)Continuous Delivery Workshop with Ansible x GitLab CI (3rd)
Continuous Delivery Workshop with Ansible x GitLab CI (3rd)
 
Continuous Delivery - 敏捷開發的最後一哩路
Continuous Delivery - 敏捷開發的最後一哩路Continuous Delivery - 敏捷開發的最後一哩路
Continuous Delivery - 敏捷開發的最後一哩路
 
My DevOps Tour 2.3
My DevOps Tour 2.3My DevOps Tour 2.3
My DevOps Tour 2.3
 
Dev ops 簡介
Dev ops 簡介Dev ops 簡介
Dev ops 簡介
 
Proud Plone on Cloud
Proud Plone on CloudProud Plone on Cloud
Proud Plone on Cloud
 
模块化和组件化Css
模块化和组件化Css模块化和组件化Css
模块化和组件化Css
 
用Octopus deploy做自動部署 - 快速上手
用Octopus deploy做自動部署 - 快速上手用Octopus deploy做自動部署 - 快速上手
用Octopus deploy做自動部署 - 快速上手
 
DevOps核心理念和實踐
DevOps核心理念和實踐DevOps核心理念和實踐
DevOps核心理念和實踐
 
Testing in swift
Testing in swiftTesting in swift
Testing in swift
 
運用 Docker 整合 Laravel 提升團隊開發效率
運用 Docker 整合 Laravel 提升團隊開發效率運用 Docker 整合 Laravel 提升團隊開發效率
運用 Docker 整合 Laravel 提升團隊開發效率
 
照騙小幫手 fakpy@HackNCUU
照騙小幫手 fakpy@HackNCUU照騙小幫手 fakpy@HackNCUU
照騙小幫手 fakpy@HackNCUU
 
twMVC#24 | 開發團隊的敏捷之路(未完成)
twMVC#24 | 開發團隊的敏捷之路(未完成)twMVC#24 | 開發團隊的敏捷之路(未完成)
twMVC#24 | 開發團隊的敏捷之路(未完成)
 
twMVC#21 | 你所不知道的 Visual Studio
twMVC#21 | 你所不知道的 Visual StudiotwMVC#21 | 你所不知道的 Visual Studio
twMVC#21 | 你所不知道的 Visual Studio
 
twMVC#29 -Learning Machine Learning with Movie Recommendation
twMVC#29 -Learning Machine Learning with Movie RecommendationtwMVC#29 -Learning Machine Learning with Movie Recommendation
twMVC#29 -Learning Machine Learning with Movie Recommendation
 
twMVC#25 | ASP.NET MVC A/B Testing 的眉眉角角
twMVC#25 | ASP.NET MVC A/B Testing 的眉眉角角twMVC#25 | ASP.NET MVC A/B Testing 的眉眉角角
twMVC#25 | ASP.NET MVC A/B Testing 的眉眉角角
 

Semelhante a 跟著 geerlingguy 大神
一起測試 Ansible Roles

淺入淺出 MySQL & PostgreSQL
淺入淺出 MySQL & PostgreSQL淺入淺出 MySQL & PostgreSQL
淺入淺出 MySQL & PostgreSQLYi-Feng Tzeng
 
Using google appengine_1027
Using google appengine_1027Using google appengine_1027
Using google appengine_1027Wei Sun
 
[AI / ML] 用 LLM (Large language model) 來整理您的知識庫 @Devfest Taipei 2023
[AI / ML] 用 LLM (Large language model) 來整理您的知識庫 @Devfest Taipei 2023[AI / ML] 用 LLM (Large language model) 來整理您的知識庫 @Devfest Taipei 2023
[AI / ML] 用 LLM (Large language model) 來整理您的知識庫 @Devfest Taipei 2023Johnny Sung
 
Using google appengine (2)
Using google appengine (2)Using google appengine (2)
Using google appengine (2)Wei Sun
 
[PHPConf Taiwan 2015] 跟著 Laravel 5.1 一起成為更好的 PHP 開發者
[PHPConf Taiwan 2015] 跟著 Laravel 5.1 一起成為更好的 PHP 開發者[PHPConf Taiwan 2015] 跟著 Laravel 5.1 一起成為更好的 PHP 開發者
[PHPConf Taiwan 2015] 跟著 Laravel 5.1 一起成為更好的 PHP 開發者Shengyou Fan
 
給軟體工程師的不廢話 R 語言精要班
給軟體工程師的不廢話 R 語言精要班給軟體工程師的不廢話 R 語言精要班
給軟體工程師的不廢話 R 語言精要班台灣資料科學年會
 

Semelhante a 跟著 geerlingguy 大神
一起測試 Ansible Roles (6)

淺入淺出 MySQL & PostgreSQL
淺入淺出 MySQL & PostgreSQL淺入淺出 MySQL & PostgreSQL
淺入淺出 MySQL & PostgreSQL
 
Using google appengine_1027
Using google appengine_1027Using google appengine_1027
Using google appengine_1027
 
[AI / ML] 用 LLM (Large language model) 來整理您的知識庫 @Devfest Taipei 2023
[AI / ML] 用 LLM (Large language model) 來整理您的知識庫 @Devfest Taipei 2023[AI / ML] 用 LLM (Large language model) 來整理您的知識庫 @Devfest Taipei 2023
[AI / ML] 用 LLM (Large language model) 來整理您的知識庫 @Devfest Taipei 2023
 
Using google appengine (2)
Using google appengine (2)Using google appengine (2)
Using google appengine (2)
 
[PHPConf Taiwan 2015] 跟著 Laravel 5.1 一起成為更好的 PHP 開發者
[PHPConf Taiwan 2015] 跟著 Laravel 5.1 一起成為更好的 PHP 開發者[PHPConf Taiwan 2015] 跟著 Laravel 5.1 一起成為更好的 PHP 開發者
[PHPConf Taiwan 2015] 跟著 Laravel 5.1 一起成為更好的 PHP 開發者
 
給軟體工程師的不廢話 R 語言精要班
給軟體工程師的不廢話 R 語言精要班給軟體工程師的不廢話 R 語言精要班
給軟體工程師的不廢話 R 語言精要班
 

Mais de Chen Cheng-Wei

GitOps is IaC done right
GitOps is IaC done rightGitOps is IaC done right
GitOps is IaC done rightChen Cheng-Wei
 
From DevOps to GitOps with GitLab
From DevOps to GitOps with GitLabFrom DevOps to GitOps with GitLab
From DevOps to GitOps with GitLabChen Cheng-Wei
 
和艦長一起玩轉 GitLab & GitLab Workflow
和艦長一起玩轉 GitLab & GitLab Workflow和艦長一起玩轉 GitLab & GitLab Workflow
和艦長一起玩轉 GitLab & GitLab WorkflowChen Cheng-Wei
 
SRE 讀書會:導讀《持續交付》第15章 - 持續交付管理
SRE 讀書會:導讀《持續交付》第15章 - 持續交付管理SRE 讀書會:導讀《持續交付》第15章 - 持續交付管理
SRE 讀書會:導讀《持續交付》第15章 - 持續交付管理Chen Cheng-Wei
 
DevOpsDays Taiepi 2018 - Farewell 閉幕
DevOpsDays Taiepi 2018 - Farewell 閉幕DevOpsDays Taiepi 2018 - Farewell 閉幕
DevOpsDays Taiepi 2018 - Farewell 閉幕Chen Cheng-Wei
 
SRE 讀書會 - 導讀:第 31 章
SRE 讀書會 - 導讀:第 31 章SRE 讀書會 - 導讀:第 31 章
SRE 讀書會 - 導讀:第 31 章Chen Cheng-Wei
 
SRE 讀書會 - 導讀:第 30 章
SRE 讀書會 - 導讀:第 30 章SRE 讀書會 - 導讀:第 30 章
SRE 讀書會 - 導讀:第 30 章Chen Cheng-Wei
 
CI/CD、自動化,你還沒準備好(GCPUG.TW Meetup #34)
CI/CD、自動化,你還沒準備好(GCPUG.TW Meetup #34)CI/CD、自動化,你還沒準備好(GCPUG.TW Meetup #34)
CI/CD、自動化,你還沒準備好(GCPUG.TW Meetup #34)Chen Cheng-Wei
 
CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)
CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)
CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)Chen Cheng-Wei
 
SRE 讀書會 - 導讀:第一章
SRE 讀書會 - 導讀:第一章SRE 讀書會 - 導讀:第一章
SRE 讀書會 - 導讀:第一章Chen Cheng-Wei
 
DevOpsDays Taipei 2017 Opening Talk
DevOpsDays Taipei 2017 Opening TalkDevOpsDays Taipei 2017 Opening Talk
DevOpsDays Taipei 2017 Opening TalkChen Cheng-Wei
 
Effective DevOps:一場文化與技術的轉型運動
Effective DevOps:一場文化與技術的轉型運動Effective DevOps:一場文化與技術的轉型運動
Effective DevOps:一場文化與技術的轉型運動Chen Cheng-Wei
 
Ignite talks - 自動化的關鍵
Ignite talks - 自動化的關鍵Ignite talks - 自動化的關鍵
Ignite talks - 自動化的關鍵Chen Cheng-Wei
 
提到 DevOps 到底在
談些什麼玩意兒?(@ Agile Tour Taichung 2017)
提到 DevOps 到底在
談些什麼玩意兒?(@ Agile Tour Taichung 2017)提到 DevOps 到底在
談些什麼玩意兒?(@ Agile Tour Taichung 2017)
提到 DevOps 到底在
談些什麼玩意兒?(@ Agile Tour Taichung 2017)Chen Cheng-Wei
 
提到 DevOps 到底在談些什麼玩意兒?
提到 DevOps 到底在談些什麼玩意兒?提到 DevOps 到底在談些什麼玩意兒?
提到 DevOps 到底在談些什麼玩意兒?Chen Cheng-Wei
 
PHP Conf Taiwan 2016 自動化與持續整合實作工作坊
PHP Conf Taiwan 2016 自動化與持續整合實作工作坊PHP Conf Taiwan 2016 自動化與持續整合實作工作坊
PHP Conf Taiwan 2016 自動化與持續整合實作工作坊Chen Cheng-Wei
 
快快樂樂打造自動化開發環境
快快樂樂打造自動化開發環境快快樂樂打造自動化開發環境
快快樂樂打造自動化開發環境Chen Cheng-Wei
 
DevOps:建造開發維運的跨界之橋 (@ C.C. Agile #37)
DevOps:建造開發維運的跨界之橋 (@ C.C. Agile #37)DevOps:建造開發維運的跨界之橋 (@ C.C. Agile #37)
DevOps:建造開發維運的跨界之橋 (@ C.C. Agile #37)Chen Cheng-Wei
 

Mais de Chen Cheng-Wei (20)

GitOps is IaC done right
GitOps is IaC done rightGitOps is IaC done right
GitOps is IaC done right
 
From DevOps to GitOps with GitLab
From DevOps to GitOps with GitLabFrom DevOps to GitOps with GitLab
From DevOps to GitOps with GitLab
 
Become a GitLab Hero
Become a GitLab HeroBecome a GitLab Hero
Become a GitLab Hero
 
和艦長一起玩轉 GitLab & GitLab Workflow
和艦長一起玩轉 GitLab & GitLab Workflow和艦長一起玩轉 GitLab & GitLab Workflow
和艦長一起玩轉 GitLab & GitLab Workflow
 
SRE 讀書會:導讀《持續交付》第15章 - 持續交付管理
SRE 讀書會:導讀《持續交付》第15章 - 持續交付管理SRE 讀書會:導讀《持續交付》第15章 - 持續交付管理
SRE 讀書會:導讀《持續交付》第15章 - 持續交付管理
 
DevOpsDays Taiepi 2018 - Farewell 閉幕
DevOpsDays Taiepi 2018 - Farewell 閉幕DevOpsDays Taiepi 2018 - Farewell 閉幕
DevOpsDays Taiepi 2018 - Farewell 閉幕
 
SRE 讀書會 - 導讀:第 31 章
SRE 讀書會 - 導讀:第 31 章SRE 讀書會 - 導讀:第 31 章
SRE 讀書會 - 導讀:第 31 章
 
SRE 讀書會 - 導讀:第 30 章
SRE 讀書會 - 導讀:第 30 章SRE 讀書會 - 導讀:第 30 章
SRE 讀書會 - 導讀:第 30 章
 
CI/CD、自動化,你還沒準備好(GCPUG.TW Meetup #34)
CI/CD、自動化,你還沒準備好(GCPUG.TW Meetup #34)CI/CD、自動化,你還沒準備好(GCPUG.TW Meetup #34)
CI/CD、自動化,你還沒準備好(GCPUG.TW Meetup #34)
 
Ignite talks
Ignite talksIgnite talks
Ignite talks
 
CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)
CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)
CI、CD、Automation你還沒準備好!?(Agile Tour Kaohsiung 2017)
 
SRE 讀書會 - 導讀:第一章
SRE 讀書會 - 導讀:第一章SRE 讀書會 - 導讀:第一章
SRE 讀書會 - 導讀:第一章
 
DevOpsDays Taipei 2017 Opening Talk
DevOpsDays Taipei 2017 Opening TalkDevOpsDays Taipei 2017 Opening Talk
DevOpsDays Taipei 2017 Opening Talk
 
Effective DevOps:一場文化與技術的轉型運動
Effective DevOps:一場文化與技術的轉型運動Effective DevOps:一場文化與技術的轉型運動
Effective DevOps:一場文化與技術的轉型運動
 
Ignite talks - 自動化的關鍵
Ignite talks - 自動化的關鍵Ignite talks - 自動化的關鍵
Ignite talks - 自動化的關鍵
 
提到 DevOps 到底在
談些什麼玩意兒?(@ Agile Tour Taichung 2017)
提到 DevOps 到底在
談些什麼玩意兒?(@ Agile Tour Taichung 2017)提到 DevOps 到底在
談些什麼玩意兒?(@ Agile Tour Taichung 2017)
提到 DevOps 到底在
談些什麼玩意兒?(@ Agile Tour Taichung 2017)
 
提到 DevOps 到底在談些什麼玩意兒?
提到 DevOps 到底在談些什麼玩意兒?提到 DevOps 到底在談些什麼玩意兒?
提到 DevOps 到底在談些什麼玩意兒?
 
PHP Conf Taiwan 2016 自動化與持續整合實作工作坊
PHP Conf Taiwan 2016 自動化與持續整合實作工作坊PHP Conf Taiwan 2016 自動化與持續整合實作工作坊
PHP Conf Taiwan 2016 自動化與持續整合實作工作坊
 
快快樂樂打造自動化開發環境
快快樂樂打造自動化開發環境快快樂樂打造自動化開發環境
快快樂樂打造自動化開發環境
 
DevOps:建造開發維運的跨界之橋 (@ C.C. Agile #37)
DevOps:建造開發維運的跨界之橋 (@ C.C. Agile #37)DevOps:建造開發維運的跨界之橋 (@ C.C. Agile #37)
DevOps:建造開發維運的跨界之橋 (@ C.C. Agile #37)
 

跟著 geerlingguy 大神
一起測試 Ansible Roles