我有不同的剧本定义,使用相同的角色。在其中一个角色模板中,我必须编写特定NIC卡的IP地址,因为它取决于主机,因此它在我的剧本中定义。
因此,在我的剧本中,我定义了这个var:
vars:
# NIC I want to use
- nic_card: ens192
在我的角色main.yml文件中,我尝试这样做:
host_specific_address: "{{ ansible_facts['ansible_{{ nic_card }}']['ipv4']['address'] }}"
如您所见,我尝
我正在尝试执行一个现有的ansible攻略,我得到了这个错误:
fatal: [default]: FAILED! => {"failed": true, "msg": "ERROR! 'unicode object' has no attribute 'regexp'"}
在执行ansible攻略的这一部分时:
- name: "Add access to pg_hba.conf for DB users"
become: yes
become_user: postgres
li
我正在尝试将本地存储的文件(脚本和rpms)复制到一组服务器上。当名称是硬编码的时候,我可以复制文件,但当我使用变量时就不能了。
ansible-lint返回时没有错误。
当使用变量替换时,我得到错误:
TASK [Copy cpu_gov.sh]
***************************************************************************************************************************************************************
An exception o
因此,我有一个表单,其中包括一个项目列表,每个项目都有一个选择列表。我的代码是这样的(删除了无关的项):
@for( var i = 0; i < Model.InputSlots.Count; i++)
{
@Html.DropDownListFor(model => model.InputSlots[i].VariableId,
new SelectList(Model.Variables, "VariableId", "Name"),
"--Select Variable--",
new
我正在设计一个从XML导入对象数据的通用解决方案。在我的应用程序中,类结构如下:
class MyObject
{
public string ID { get; private set; }
// This may contain large set of values.
public Dictionary<string, OtherClass> ObjectData { get; set; };
public MyObject()
{}
}
class OtherClass
{
public string SubProper
我正在尝试构建一个/etc/host文件;但是,在运行一个剧本时,我似乎无法让主机显示出来,但是通过命令行,它可以工作到一定程度。
这是我的ansible.cfg文件:
[defaults]
ansible_managed = Please do not change this file directly since it is managed by Ansible and will be overwritten
library = ./library
module_utils = ./module_utils
action_plugins = plugins/actions
callback
Ansible v2.10.8
我在中尝试过这些答案,但是它们给了我语法错误。
例如,我想检查我传入的变量是否包含"development“,所以我会这样做,这是文章中的一个答案。
- name: Set NodeJS version for development branch
set_fact:
nodejs_version: "{{ nodejs_versions[development] }}"
when: '"development" in branch_name'
我得到了...and
TASK [nodejs
我在yaml格式的ansible hosts文件中使用localhost。每当我运行攻略时,我都会收到以下警告。剧本通过使用隐式本地主机成功运行。为什么会发生这种情况,我如何纠正它?
➜ ec2 ansible-playbook site.yml -i inventory/hosts.yml
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
我不清楚为什么ansible会报告这个警
我有多个任务依赖于variable1的值。我想检查值是否在{{variable1}}中,但我收到错误:
- name: do something when the value in variable1
command: <command>
when: "'value' in {{variable1}}"
我使用的是ansible 2.0.2