The ternary options appear to be getting evaluated whether they are used or not, so item['interface'] is always accessed. This patch aims to check for the key's presence before performing ternary operations, or use Ansible variables to postpone evaluation until absolutely necessary. Change-Id: Ib1462c04d1a0820a37998f989e2ed16566f71f54