Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions ansible/config_sonic_basedon_testbed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,15 @@
- topo_facts: topo={{ topo }}
delegate_to: localhost

- name: set default dualtor facts
set_fact:
dual_tor_facts: {}
when: "'dualtor' not in topo"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be like below?

when: "{{'dualtor' not in topo }}"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it OK to omit the {{ }} because it's not a template. And i verified it by deploying a minigraph.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please ignore this. I tested your code, it works. On the contrary, ansible complains with warning [WARNING]: conditional statements should not include jinja2 templating delimiters such as {{ }} or {% %}. Found: {{ 'dualtor' in topo }} if format when: "{{'dualtor' not in topo }}" is used.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @wangxin


- name: gather dual ToR information
dual_tor_facts: hostname="{{ inventory_hostname }}" testbed_facts="{{ testbed_facts }}" hostvars="{{ hostvars }}" vm_config="{{ vm_topo_config }}"
delegate_to: localhost
when: "'dualtor' in topo"

- name: set default vm file path
set_fact:
Expand Down