DevOps Buzz
Search
K

Dynamic inventory

Download ec2.py from here. Save it in your Ansible root folder.
Edit ansible.cfg as follows:
...
inventory = ./ec2.py
...
Your playbook host must be as follows:
...
hosts: "{{ variable_host | default('tag_tfplayer_vpninstance') }}"
...
Run the playbook:
ansible-playbook playbooks/vpn.yml \
--extra-vars "variable_host=tag_tfplayer_vpninstance"
variable_host is the EC2 instance tag. In this example the tag name is tfplayer and the tag content is vpninstance.