如何維護大型的 Playbooks?
19. 如何維護大型的 Playbooks?
什麼是最佳實踐 (Best Practices)?
官方建議的目錄結構
production # inventory file for production.
staging # inventory file for staging.
group_vars/
group1 # here we assign variables to particular groups
group2
host_vars/
hostname1 # if systems need specific variables, put them here
hostname2
site.yml # master playbook
webservers.yml # playbook for webserver tier
dbservers.yml # playbook for dbserver tier
roles/
common/ # role name
tasks/ #
main.yml # main tasks file.
handlers/ #
main.yml # handlers file.
templates/ #
ntp.conf.j2 # templates end in .j2.
files/ #
bar.txt # files
foo.sh # script files
vars/ #
main.yml # variables with this role.
defaults/ #
main.yml # default variables.
meta/ #
main.yml # role dependencies實戰用的目錄結構
總結
後語
相關連結
Last updated
