user3577012
user3577012

Reputation: 29

Ansible - hide with_dict variables from playbook output

I have a playbook where I use a dictionary variable file and an includes_tasks play. My issue is the playbook displays the variables when it is run. I tried no_log: True and ignore_errors: True but makes no difference. I am using ansible version 2.4.1.0

Here is the playbook tasks:

tasks:
  - name: "Install License and Remove Default Identifier"
    include_tasks: includes/junos_license.yml
    with_dict: "{{ vsrx  }}"

Here is the output from running the playbook:

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

Upvotes: 1

Views: 2014

Answers (1)

Konstantin Suvorov
Konstantin Suvorov

Reputation: 68269

Use loop_control:

tasks:
  - name: "Install License and Remove Default Identifier"
    include_tasks: includes/junos_license.yml
    with_dict: "{{ vsrx }}"
    loop_control:
      label: "{{ item.key }}"

Upvotes: 2

Related Questions