29. 持續交付和持續部署有什什麼不同?
前者需⼿手動 Release ⾄至 Production,⽽而後者則⾃自動化之。
Continuous Delivery
Continuous Deployment
auto auto manual
Build Deploy Test Release
auto auto auto
Build Deploy Test Release
29
75. 75
lineinfile
• ⽤用正規表⽰示式對檔案進⾏行行插入或取代⽂文字的檔案模組 (Files Modules)。
• 其類似的 Linux 指令為 sed。
# Before 2.3, option 'dest', 'destfile' or 'name' was used instead of ‘path'.
# 關閉 SELinux。
- name: disable selinux
lineinfile:
path: /etc/selinux/config
regexp: '^SELINUX='
line: 'SELINUX=enforcing'
# 移除 docker 使⽤用者的 sudo 權限。
- name: remove sudo permission of docker
lineinfile:
path: /etc/sudoers
state: absent
regexp: '^docker'
76. 76
shell
• 在遠端⽤用 /bin/sh 執⾏行行 shell 指令的指令模組 (Commands Modules),
⽀支援變數 (variables)、< , > , | , ; 和 & 等運算。
# 藉由 ls 和 wc 檢查檔案數量量。
- name: check files number
shell: ls /home/docker/ | wc -l
# 列列出所有的 Python ⾏行行程。
- name: show all python process
shell: ps aux | grep python
# 執⾏行行 shell script,並把結果導向 /tmp/result.log。
- name: execute run.sh
shell: ./run.sh > /tmp/result.log
77. Playbooks Samples
• Ansible Role: Install Vim and use vi-mode in everyway
- https://github.com/chusiang/vim-and-vi-mode.ansible.role
• Ansible Role: PHP 7 (php-fpm) for Nginx on Ubuntu and CentOS
- https://github.com/chusiang/php7.ansible.role
• Ansible Galaxy
- https://galaxy.ansible.com/
• Code samples from 《Ansible: Up and Running》
- https://github.com/ansiblebook/ansiblebook
77
125. 我的 Pipeline 進化史
Unit Test Integration Test Delivery DeploymentBuildSyntax Check
Unit Test Delivery DeploymentBuildSyntax Check
Unit TestDelivery DeploymentBuildSyntax Check
Delivery DeploymentBuildSyntax Check
BuildSyntax Check
Build
125