Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Warning]: Found both group and host with same name #139

Closed
zhongl opened this issue Dec 3, 2018 · 4 comments
Closed

[Warning]: Found both group and host with same name #139

zhongl opened this issue Dec 3, 2018 · 4 comments

Comments

@zhongl
Copy link

zhongl commented Dec 3, 2018

When executed ansible to ping all host with alicloud.py, I got this:

> ansible -i alicloud.py all -m ping -u root
 [WARNING]: Found both group and host with same name: i_j6cgu5l5nhep9wim2xly

i_j6cgu5l5nhep9wim2xly | UNREACHABLE! => {
    "changed": false,
    "msg": "Failed to connect to the host via ssh: ssh: Could not resolve hostname i_j6cgu5l5nhep9wim2xly: nodename nor servname provided, or not known\r\n",
    "unreachable": true
}
47.52.225.249 | SUCCESS => {
    "changed": false,
    "ping": "pong"
}

My alicloud.ini is:

# Ansible Alibaba Cloud(Alicloud) ECS dynamic inventory script settings
#

[ecs]

# Alicloud regions to make calls to. Set this to 'all' to make request to all regions
# in Alicloud and then merge the results together. Alternatively, set this to a comma
# separated list of regions. For example, regions = cn-beijing,eu-central-1,ap-southeast-1,us-east-1
#regions = all
regions = cn-hongkong

# In addition, set 'regions_exclude' to a comma separated list of regions to filter 'all' regions.
#regions_exclude = us-west-1,ap-northeast-1


# When generating inventory, Ansible needs to know how to address a ECS instance.
# Each ECS instance has server ip address variables associated with it.
# This destination_variable is used as the address of a server, and it support
# following value:
#   - public_ip_address: return the public IP address of the ECS server
#   - eip_address: return the elastic IP address of the ECS server
#   - private_ip_address: return the inner or private IP address of the ECS server
# WARNING: For instances in a private subnet, this should be set to 'private_ip_address',
#           and Ansible must be run from within the subnet.
destination_variable = public_ip_address


# This allows you to override the inventory_name with an ecs server attribute,
# instead of using the destination_variable above. Addressing (aka ansible_ssh_host)
# will still use destination_variable.
# WARNING: ECS server attribute 'tags' should be written as 'tag_TAGNAME',
#           E.g. hostname_variable = tag_my-ansible
hostname_variable = instance_id


# By default, only ECS instances in the 'running' status are returned.
# Set 'all_instances' to True to return instances in all status.
# Set instance_states to return as a comma-separated list. This
# option will be overriden when 'all_instances' is True.
all_instances = True
# instance_states = pending, running, starting, stopping, stopped


# In order to avoiding calling Alicloud API frequently, we cache the results of an API call.
# Set this to the path you want cache files to be written to. Two files
# will be written to this directory:
#   - ansible-alicloud.cache
#   - ansible-alicloud.index
cache_path = ~/.ansible/tmp

# Set the number of seconds to consider the cache file is valid. After the valid
# seconds, a new API call will be made, and the cache file will be updated.
# To disable the cache, set this value to 0
cache_max_age = 0


# Organize groups into a nested/hierarchy instead of a flat namespace.
nested_groups = False

# Replace - tags when creating groups to avoid issues with ansible
replace_dash_in_groups = True


# If set this to true, any tag of the form "a,b,c" will be expanded into a list
# and the results are used to create additional tag_* inventory groups.
expand_csv_tags = False


# This supports to classify and manage ECS inventory by configuring several groups.
group_by_instance_id = True
group_by_region = True
group_by_availability_zone = True
group_by_image_id = True
group_by_instance_type = True
group_by_vpc_id = True
group_by_vswitch_id = True
group_by_security_group = True
group_by_tag_keys = True
group_by_tag_none = True


# If you only want to include hosts that match a certain regular expression
# pattern_include = myhost-*

# If you want to exclude any hosts that match a certain regular expression
# pattern_exclude = myhost-*


# Set this can be used to retrieve specified ECS instances for inventory.
# For the full list of possible filters, please read the ECS API
# docs: https://www.alibabacloud.com/help/doc-detail/25506.htm?spm=a3c0i.o54244zh.b99.175.1106d719NDxcYR
# The filters are key/value pairs separated by '=', to list multiple filters use
# a list separated by commas. See examples below.

# Retrieve only instances with (key=value) tool=ansible tag
# instance_filters = tag:tool=ansible
# Retrieve ecs.n4.small instances AND instances with tag tool=ansible
# instance_filters = instance_type=ecs.n4.small, tag:tool=ansible

[credentials]

# The Alicloud credentials can optionally be specified here. Credentials specified
# here will be ignored if the environment variable ALICLOUD_ACCESS_KEY(or ALICLOUD_ACCESS_KEY_ID)
# and ALICLOUD_SECRET_KEY(or ALICLOUD_SECRET_ACCESS_KEY) are set.
#
# Supplying Alicloud credentials here is not recommended, as it introduces
# non-trivial security concerns. It is strongly recommended using environment variable.
#
# alicloud_access_key = Abcd1234
# alicloud_secret_key = Abcd2345
@prasathsekar
Copy link

prasathsekar commented Feb 16, 2019

Hi, i too have the same issue. If my ansible pings the alicloud ip address it shows success but using host it is unreachable. i had struck in this for the past 3 days. Kindly answer what would be the issue??

@zhongl
Copy link
Author

zhongl commented Feb 20, 2019

@prasathsekar i wrote my own inventory script to fixed this problem, it may help you too, https://github.com/zhongl/aliyun-ansible-inventory .

@xuchen81
Copy link

I ran into the same error, any ideas or fixes?

@lixue323
Copy link
Contributor

Hi, I am sorry for late reply. This issue has been fixed by the latest alicloud.py, please download it and try again. Please let me know if there are other issues.
cc @xiaozhu36

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants