English 中文(简体)
利用胶卷更新多个组的库存档案
原标题:Using tuples to update an inventory file under multiple groups

我正试图在多个地方更新我的清单,以备一本具体的游戏手册。 这是三肢的游戏手册。

FYI. 参考配置在实际环境中已经删除。

vars:
  instance_groups: [ ec2_instances , docker , ubuntu ]

<snip>
- name: persist new hosts in inventory
  lineinfile:
    line: "{{ item[1] }}"
    path: "{{ inventory_file }}"
    insertafter: "{{ item[0] }}"
   loop: "{{ instance_groups | product(dns_names) | list }}"
   when: dns_names is defined

例如:团体是一个名单,名字是名单

但是,Im 期望该休息室插入每个小孩——每个小队——名称,但只为第一例假团体插入。

档案中的样本:

[ec2_instances]
ec2-3-219-45-179.compute-1.amazonaws.com
ec2-44-212-11-160.compute-1.amazonaws.com
ec2-44-192-37-35.compute-1.amazonaws.com

[docker]

[ubuntu]

Here is a the detailed playbook output https://gist.github.com/traxeon/190f462a3fcc933e60996e63a4b35259

我欢迎任何人对解决办法有任何见解。 感谢。

我期待该庇护所在档案中填满每组长的姓名。

问题回答

暂无回答




相关问题
Related Docker networks for apps in separate Ansible roles

Suppose I m using a webserver / reverse proxy (traefik, nginx, apache, etc.) for various apps. If the webserver and all the apps are in the same docker-compose.yml then it s easy to configure the ...

Lookup method interpreting result

I am using a lookup method which returns a password (using cyberark.. but that is not relevant for this issue description) When the password happens to contain a curly brace and there is a variable in ...

利用胶卷更新多个组的库存档案

我正在尝试在多个位置更新特定剧本的库存文件。这是被简化的剧本。请注意,实际环境中已删除引用的配置。

How to fallback to a default value when ansible lookup fails?

I was a little bit surprised to discover that his piece of code fails with an IOError exception instead of defaulting to omitting the value. #!/usr/bin/env ansible-playbook -i localhost, --- - hosts: ...

热门标签