我有一本用来修补oracle目标的剧本,但是在启动对清单文件中的每个主机运行一次的过程之前,我需要包括一个确认提示。它仅使用play_hosts和with_items与主机名一起使用,但是当我尝试添加要使用with_together修补的oracle sid的并行数组时,提示仅对单个目标运行一次。代码如下;
#this runs once for each target
- name: Sanity check
pause:
prompt: 'Confirm that you want to patch the oracle home on "{{ item }}" Press return to continue, or press ctrl+c and then a to abort'
with_items: "{{ play_hosts }}"
#this only runs once
- name: sanity check
pause:
prompt: 'Confirm that you want to patch "{{ item.0 }}" on "{{ item.1 }}". Press return to continue, or press ctrl+c and then a to abort'
with_together:
- "{{ oracle_sids }}"
- "{{ oracle_hostnames }}"
这应该对每个目标运行一次,但只能运行一次。
TASK [sanity_check_patch : sanity check] ****************************************
[sanity_check_patch : sanity check]
Confirm that you want to patch "db1" on "server1". Press return to continue, or press ctrl+c and then a to abort:
ok: [server1] => (item=[u'db1', u'server1'])