I would like to access the string values used at runtime from the ansible-playbook -e argument. In this case the user passes in “public_subnet” which renders to the value subnet-12345678 from group_vars. I would like to take actions based on the string value “public_subnet”
playbook.yml
`
vpc_subnet_id: “{{ subnet }}”
assign_public_ip: “{% if subnet == public_subnet %}True{% endif %}”
`
group_vars/dev
public_subnet: subnet-12345678
command line
`
ansible-playbook -i inventory/local playbook.yml -v -e “subnet=public_subnet”
`