有没有办法在使用add_host或group_by模块的配置任务期间创建内存清单:
var dynamicDivSelector = $(HTMLAsString);
dynamicDivSelector.text($("#hiddenDivId").text());
$("#modalDivId").append(dynamicDivSelector);
答案 0 :(得分:0)
Yes。你可以这样做(如果你在问题中提供更多信息,我们可以提供更多的特殊性):
- add_host:
hostname: 1.1.1.1
groups: SET
- add_host:
hostname: 1.1.1.2
groups: SET1
这将动态地将1.1.1.1作为SET
组的一部分添加到清单中,并将1.1.1.2作为SET1
组的一部分添加到清单中。在rackspace
任务:
- name: Provision a set of instances
local_action:
module: rax
name: "{{ rax_name }}"
flavor: "{{ rax_flavor }}"
image: "{{ rax_image }}"
count: "{{ rax_count }}"
group: "{{ group }}"
wait: yes
register: rax
- name: Add the instances we created (by public IP) to the group 'raxhosts'
local_action:
module: add_host
hostname: "{{ item.name }}"
ansible_host: "{{ item.rax_accessipv4 }}"
ansible_ssh_pass: "{{ item.rax_adminpass }}"
groups: raxhosts
with_items: "{{ rax.success }}"
when: rax.action == 'create'