小编seb*_*szw的帖子

Ansible:同时部署在多个主机上

是否可以运行ansible playbook,看起来像这样(这是来自这个网站的一个例子:http://docs.ansible.com/playbooks_roles.html):

- name: this is a play at the top level of a file
  hosts: all
  remote_user: root
  tasks:
  - name: say hi
    tags: foo
    shell: echo "hi..."

- include: load_balancers.yml
- include: webservers.yml
- include: dbservers.yml
Run Code Online (Sandbox Code Playgroud)

在多线程模式?

我想在同一时间运行三个"包含"(它正在部署到不同的主机),如下图所示:

http://www.gliffy.com/go/publish/5267618

可能吗?

ansible

50
推荐指数
4
解决办法
10万
查看次数

在Python中按属性获取对象列表中的索引

我有具有属性id的对象列表,我想找到具有特定id的对象的索引.我写了这样的东西:

index = -1
for i in range(len(my_list)):
    if my_list[i].id == 'specific_id'
        index = i
        break
Run Code Online (Sandbox Code Playgroud)

但它看起来不太好.还有更好的选择吗?

python indexing list

14
推荐指数
3
解决办法
3万
查看次数

如何在lxml中解析XML时不加载注释

我尝试使用lxml在Python中解析XML文件,如下所示:

objectify.parse(xmlPath, parserWithSchema)
Run Code Online (Sandbox Code Playgroud)

但XML文件可能包含奇怪的地方的评论:

<root>
    <text>Sam<!--comment-->ple text</text>
    <!--comment-->
    <float>1.2<!--comment-->3456</float>
</root>
Run Code Online (Sandbox Code Playgroud)

这是一种在解析之前不加载或删除注释的方法吗?

python xml lxml comments xml-parsing

11
推荐指数
1
解决办法
3271
查看次数

标签 统计

python ×2

ansible ×1

comments ×1

indexing ×1

list ×1

lxml ×1

xml ×1

xml-parsing ×1