- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有以下文件夹结构,这似乎使它能够构建和加载角色,但没有加载组和主机变量。怎么会?
/etc/ansible/
- hosts
- requirements.yml
- group_vars/
- app/
- postgres.yml
- host_vars/
- app1/
- postgres.yml
- roles
/documents/ansible/
- playbook.yml
- vagrant
主机文件
# Application servers
[app]
192.168.60.6
# Group multi
[multi:children]
app
#variables applied to all servers
[multi:vars]
ansible_ssh_user=vagrant
ansible_ssh_private_key_file=~/.vagrant.d/insecure_private_key
** Vagrant **
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# Genral Vagrant VM Configuration.
config.vm.box = "geerlingguy/centos7"
config.ssh.insert_key = false
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.provider :virtualbox do |v|
v.memory = 256
v.linked_clone = true
end
config.vm.provision "ansible" do |ansible|
ansible.playbook = "playbook.yml"
end
# Application server 1
config.vm.define "app1" do |app|
app.vm.hostname = "orc-app1.dev"
app.vm.network :private_network, ip: "192.168.60.6"
end
end
最佳答案
默认情况下,Vagrant 在 .vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory
中使用自己的自动生成的 list 文件。
在 Vagrant 中有一个选项 ansible.inventory_path
指向库存文件/目录而不是自动生成的,但你不要用它来指向 /
,所以 Vagrant 完全不知道它。同样,它不会在 Vagrantfile
中的 etc/ansible/hosts/etc/ansible
中查找 host_vars
和 group_vars
。
另一方面,角色的路径不会被 list 文件覆盖,因此 Vagrant 使用自己的路径这一事实不会影响角色的路径。
它们默认从 /etc/ansible/roles
(或 Ansible 默认使用的任何目录,例如 /usr/local/etc/ansible/roles
加载> 在 macOS 上)。
关于vagrant - host_vars 和 group_vars 未加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43162620/
我正在使用count()包中的函数plyr。从今天早上开始,我在运行以下代码时收到错误消息: Arrivaltime <- cut(Export_2019_2$Arrival,
将其放入group_vars/all: default_environment: HOME2: "{{ ansible_env.HOME }}" 在任务中使用时定义环境: environment:
这可能是一个奇怪的问题,我确信我已经看到了这个问题,但忽略了将其添加为书签。 我的主机存在于多个组中: [group1] host1 [group2] host2 [group3] host1 hos
我有一个虚拟的怀疑让我卡住了很长时间。我有一个非常平庸的 list 文件,其中包含主机和变量: [lb] 10.112.84.122 [tomcat] 10.112.84.124 [jboss5] 1
我正在尝试调试 ansible 如何在运行时填充我的一些模板。 我在 group_vars 中有两个文件: foo/etl.yml prod/etl.yml prod/etl.yml中有值应该覆盖 f
我有以下文件夹结构,这似乎使它能够构建和加载角色,但没有加载组和主机变量。怎么会? /etc/ansible/ - hosts - requirements.yml - group_vars/
我有一个要求,我需要在 Ansible 中使用 group_vars 但它不需要在同一路径上。基本上我的剧本在 SVN 中,每当我们想要部署时,我们实际上会检查最新版本的剧本,然后部署。 实际执行部署
我需要将一些 YAML 格式的文件从一个“大” yml 更改为几个较小的文件。不幸的是,我不知道哪个部分属于哪里。例如,我有以下 .yml: all: hosts: station01:
Ansible 最佳实践文档 recommends分离库存: inventories/ production/ hosts.ini # inventory file
对于现有项目,我将首先通过 Vagrant 将 bash 配置脚本替换为 ansible,然后在解决问题后将其推出到临时/生产服务器。 问题... 根据ansible docs在变量优先级上,grou
我之前一直将所有变量放在 list 文件中,例如 dse_dir=/app/dse dse_bin_dir={{ dse_dir }}/bin dse_conf_dir={{ dse_dir }}/r
有谁知道如何将剧本放入文件夹中,但共享相同的角色、group_vars 以及通常位于根目录的其他内容? 这是我想要的: root_dir:- group_vars- roles- inventory-
我试图从 list 组中获取 IP 地址列表而不是主机名。这些 IP 地址已经在我的主机变量中,但我无法让它们匹配来自其组名的列表。 这是我的原始剧本: - name: Install Kafka
这个问题在这里已经有了答案: Ansible with "Alternative Directory Layout" and using vaults (1 个回答) 4年前关闭。 我正在尝试使用 a
如果变量可以在 list 文件中或 group_vars 中,我如何从 list 中获取变量的值目录? 例如,region=place-a可能在 list 文件中或在 group_vars 中的文件中
假设 Ansible 结构: . ├── group_vars │ └── all └── site.yml 在哪里 all包含 my_test_variable: yes , 和 site.ym
我正在尝试在本地运行剧本,但我希望角色的 task/main.yml 文件中的所有变量都引用特定 list 文件中的 group_var。 不幸的是,剧本无法访问 group_vars 目录,就像无法
我们可以通过修改ansible.cfg中的roles_path来改变角色的路径。但该文档似乎没有提及任何有关更改 group_vars 和 host_vars 路径的内容。 如何更改这些路径? 我会将
我正在尝试将 ansible 连接到本地网络中的一台机器,这需要在 SSH 调用中传递一些额外的选项。我在 list 、组变量、主机变量中尝试了 ansible_ssh_extra_args,但它被忽
Ansible 2.10.1 提供以下弃用警告: [DEPRECATION WARNING]: DEFAULT_HASH_BEHAVIOUR option, This feature is fragi
我是一名优秀的程序员,十分优秀!