问题;TLDR
是否有关于如何处理文件、和保险库文件的建议?在操作手册中而不是在角色中。
解释
我熟悉ansible中的以下最佳做法,其中列出了以下目录结构:
inventories/
production/
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
staging/
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/这种结构适用于简单的项目。然而,一本非常大的剧本,使用requirements.yml将克隆角色插入到它的结构中,这使得它很难维护像金库文件这样的项目,因为在众多的回放中可能会出现密码漂移。在我看来,如果拱形文件位于游戏手册级别的中心位置,那将是很有用的。
我想知道是否有一种方法可以在与inventories或playbook_dir/inventories/group_vars/vault | files目录相同的级别上创建一个playbook_dir/inventories/group_vars/vault | files目录。然后,在这个vault | files文件夹中,我可以集中我所有必要的秘密/非机密文件(例如证书和其他项目太长,不能作为变量存储)。
这样,当为[servers]运行剧本时,它将获得我需要主机组共享的所有必要变量和vaulted | files。
发布于 2021-08-23 15:09:03
我将与seshadri_c和Vladimir Botka的建议合作。搜索路径似乎是金库文件和常规文件的最佳解决方案。
files文件夹放置在剧本的根部'{{ vaulted-file }}'../../files/{{ vaulted-file }} )就可以解析。谢谢。
https://stackoverflow.com/questions/68865864
复制相似问题