GithubHelp home page GithubHelp logo

Comments (10)

xiaozhu36 avatar xiaozhu36 commented on April 27, 2024

HI @mick1627 I am sorry for late reply. Can you share me the error when running alicloud_ecs.py with python 3.8?

from alibaba.alicloud.

zopcorn avatar zopcorn commented on April 27, 2024

@amolari Can you share us the error when running alicloud_ecs.py with python 3.8?

from alibaba.alicloud.

amolari avatar amolari commented on April 27, 2024

@zopcorn There is no error, but the filtering is ignored.

from alibaba.alicloud.

xiaozhu36 avatar xiaozhu36 commented on April 27, 2024

@amolari Do you want to get some instances by filters dynamically? If so, you can refer to https://docs.ansible.com/ansible/latest/user_guide/intro_dynamic_inventory.html#other-inventory-scripts .

from alibaba.alicloud.

amolari avatar amolari commented on April 27, 2024

@xiaozhu36 : we're using AWX/tower, so filter partly dynamically through limits. However, we need some pre-filtering (for safety) at the inventory level too. That was working perfectly before using Pythong 3.8.

from alibaba.alicloud.

zopcorn avatar zopcorn commented on April 27, 2024

@amolari would you please try to use aliyun-python-sdk-ecs with version 2.1.3 ? Since we do not have your ansible playbook, we are not able to test it.

from alibaba.alicloud.

mick1627 avatar mick1627 commented on April 27, 2024

filters on tags is now working with pip module aliyun-python-sdk-ecs version 4.24.22

But now I have an other issue setting setting hostname variables to a specific tag does not work anymore.

Here my alicloud.yml file

plugin: alicloud_ecs

alicloud_region: cn-shanghai

keyed_groups:
  # add hosts to instance_type groups
  - prefix: instance_type
    key: instance_type
  # add hosts to instance_name groups
  - key: instance_name
    prefix: name
  - key: availability_zone
    prefix: ''
    separator: ''
  - key: "availability_zone | regex_replace('^(.*)-[^-]+$', '\\1')"
    prefix: ''
    separator: ''
  - key: tags
    prefix: tag
    parent_group: tags


cache: false
cache_plugin: jsonfile
cache_timeout: 7200
cache_connection: /tmp/alicloud_inventory
cache_prefix: alicloud_ecs

# Add hosts to group based on Jinja2 conditionals
groups:
  # add hosts to the group Spinnaker if instance_name starts with 'k8sSpinnaker'
#  Spinnaker: instance_name.startswith('k8sSpinnaker')

# Create vars from jinja2 expressions
compose:
  # set the ansible_host variable to connect with the public ip address without changing the hostnames
  ansible_host: private_ip_address

#If true make invalid entries a fatal error, otherwise skip and continue
#Since it is possible to use facts in the expressions they might not always be available and we ignore those errors by default.
strict: false

filters:
  tags:
     Name: stfeagt04


hostnames:
  - tags: fqdn

@zopcorn you can test the inventory plugins with the command ansible-inventory -i alicloud.yml --list
no needs to run playbook.

from alibaba.alicloud.

xiaozhu36 avatar xiaozhu36 commented on April 27, 2024

@mick1627 OK, let me have a check.

from alibaba.alicloud.

amolari avatar amolari commented on April 27, 2024

@xiaozhu36 any news please?

from alibaba.alicloud.

xiaozhu36 avatar xiaozhu36 commented on April 27, 2024

Hi @amolari @mick1627 I am sorry for late reply. This issue has been fixed the by #309 and you can build a new collection to have a try.
In addition, the hostnames in inventory file should be as following:

hostnames:
  - tag:fqdn

from alibaba.alicloud.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.