Accessing extra-vars inside playbook

16 views
Skip to first unread message

Kenny Garland

unread,
Nov 11, 2014, 2:12:34 PM11/11/14
to ansible...@googlegroups.com
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"


Reply all
Reply to author
Forward
0 new messages