Skip to content

Instantly share code, notes, and snippets.

@tgerla
Created April 10, 2014 02:08
Show Gist options
  • Save tgerla/10337114 to your computer and use it in GitHub Desktop.
Save tgerla/10337114 to your computer and use it in GitHub Desktop.
---
ip_vlan_mapping:
"192.168.1.100": 992
"192.168.1.101": 997
"192.168.1.102": 993
Timothys-MacBook-Pro:ansible-test tgerla$ ansible-playbook -i localhost, test-vars.yml
PLAY [localhost] **************************************************************
GATHERING FACTS ***************************************************************
ok: [localhost]
TASK: [debug msg="VLAN for our IP is {{ip_vlan_mapping[ip]}}"] ****************
ok: [localhost] => {
"msg": "VLAN for our IP is 997"
}
PLAY RECAP ********************************************************************
localhost : ok=2 changed=0 unreachable=0 failed=0
---
- hosts: localhost
connection: local
vars:
ip: 192.168.1.101
tasks:
- debug: msg="VLAN for our IP is {{ ip_vlan_mapping[ip] }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment