It works if I comment out the hostname_variable, because it allow to
override the inventory_name with an ec2 variable, instead of using the
destination_variable
#hostname_variable = private_ip_address
#hostname_variable = ip_address
destination_variable = public_dns_name
vpc_destination_variable = private_ip_address
For Private IPs:
destination_variable = private_ip_address
On Saturday, March 4, 2017 at 6:43:57 PM UTC+2, Berlin wrote:
>
> I am new to Ansible. When I am using `ec2.py` dynamic inventory to
> generate inventory, after the playbook is finished to run, the results are
> shown as list of IP addresses under specific tag with underscore instead of
> dot.
> For example I want to run a playbook on instances with specific tag, I
> wonder how other people work with IP addresses?
>
> ---
> - hosts: tag_test_staging
> sudo: true
> tasks:
> - name: Make sure that we can connect to the machine
> ping:
>
> PLAY RECAP
> *********************************************************************
> 10_80_20_47 : ok=0 changed=0 unreachable=1
> failed=0
>
> For private address, ec2.ini:
>
> hostname_variable = private_ip_address
> destination_variable = private_ip_address
> vpc_destination_variable = private_ip_address
>
> The results from ec2.py:
>
> "tag_test_staging": [
> "10_80_20_47"
> ],
>
> For Public Address, ec2.ini:
>
> hostname_variable = ip_address
> destination_variable = public_dns_name
> vpc_destination_variable = ip_address
>
> The results from ec2.py:
>
> "tag_test_staging": [
> "52_28_11_11"
> ],
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/5ad97d1f-a96a-4db3-92f1-449f207c4a6e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.