Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Best Practice 的目錄結構下,如何置放 files 檔案? #32

Open
zx1986 opened this issue Jul 13, 2018 · 0 comments
Open

Best Practice 的目錄結構下,如何置放 files 檔案? #32

zx1986 opened this issue Jul 13, 2018 · 0 comments

Comments

@zx1986
Copy link

zx1986 commented Jul 13, 2018

最近在重構公司的 Ansible 目錄結構,參考了官方的 best practice:
https://docs.ansible.com/ansible/2.6/user_guide/playbooks_best_practices.html#content-organization

我本來的目錄主要是 (客戶有很多個):

playbooks/
    客戶1.yml
    客戶2.yml
    group_vars/
    host_vars/
    files/    <=== 這裡放了各種需要 scp 或者 read 到遠端的檔案
inventory/
    客戶1_hosts
    客戶2_hosts

在新架構下, files/ 這個該如何整理?
才能在 with_files 時,讓 Ansible task 可以找到檔案?
我可以直接放在新架構的 inventories/ 的客戶目錄下?

有沒有方法可以列出 Ansible 目前會讀取的目錄路徑?

重構結構:

inventories/
   客戶1/
      hosts               # inventory file for production servers
      group_vars/
         group1.yml       # here we assign variables to particular groups
         group2.yml
      host_vars/
         hostname1.yml    # here we assign variables to particular systems
         hostname2.yml

   客戶2/
      hosts               # inventory file for staging environment
      group_vars/
         group1.yml       # here we assign variables to particular groups
         group2.yml
      host_vars/
         stagehost1.yml   # here we assign variables to particular systems
         stagehost2.yml

library/
module_utils/
filter_plugins/

site.yml
webservers.yml
dbservers.yml

roles/
    common/
    webtier/
    monitoring/
    fooapp/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant