我有一个剧本,我使用字典变量文件和includes_tasks播放。我的问题是playbook在运行时显示变量。我尝试了no_log:True和ignore_errors:True但没有任何区别。我使用的是ansible版本2.4.1.0
以下是剧本任务:
tasks:
- name: "Install License and Remove Default Identifier"
include_tasks: includes/junos_license.yml
with_dict: "{{ vsrx }}"
以下是运行剧本的输出:
TASK [Install License and Remove Default Identifier]
***************************************************************************
msg: All items completed
results: [
{
"item": {
"key": "vsrx-02",
"value": {
"Hostname": "vsrx-02",
"IP_Address": "192.168.1.211"
}
},
"_ansible_item_result": true,
"include": "includes/junos_license.yml",
"include_variables": {}
},
{
"item": {
"key": "vsrx-01",
"value": {
"Hostname": "vsrx-01",
"IP_Address": "192.168.1.209"
}
},
"_ansible_item_result": true,
"include": "includes/junos_license.yml",
"include_variables": {}
}
]
included: /home/ansible/junos_base_config/includes/junos_license.yml for
localhost
included: /home/ansible/junos_base_config/includes/junos_license.yml for
localhost
答案 0 :(得分:2)
使用loop_control:
tasks:
- name: "Install License and Remove Default Identifier"
include_tasks: includes/junos_license.yml
with_dict: "{{ vsrx }}"
loop_control:
label: "{{ item.key }}"