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

add tags option to azure_rm_resource_info module #1498

Merged
merged 7 commits into from
Mar 20, 2024

Conversation

valkiriaaquatica
Copy link
Contributor

SUMMARY

Add an option of tags to filter for one or more tags when getting differente resources. One or more tags can be added, and as default is use the "and" condition to search for multiple tags.

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

azure_rm_resource_info module

ADDITIONAL INFORMATION

Now the user can filter also by the tags of the resource

Before to get snapshots by tag enviroment and value dev

    - name: Get info of all snapshots 
      azure_rm_resource_info:
        provider: compute
        resource_type: snapshots 
      register: snapshots_output

    - name: Filter
      set_fact:
        filtered_snapshots: "{{ snapshots_output.response | selectattr('tags.enviroment', 'defined') | selectattr('tags.enviroment', 'equalto', 'dev') | list }}"

Now

    - name: Get info of all snapshots 
      azure_rm_resource_info:
        provider: compute
        resource_type: snapshots 
        tags: 
           enviroment: dev
      register: filtered_snapshots

@Fred-sun Fred-sun added question Further information is requested medium_priority Medium priority work in In trying to solve, or in working with contributors labels Mar 20, 2024
Copy link
Collaborator

@Fred-sun Fred-sun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor change

plugins/modules/azure_rm_resource_info.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_resource_info.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_resource_info.py Show resolved Hide resolved
Co-authored-by: Fred-sun <37327967+Fred-sun@users.noreply.github.com>
@valkiriaaquatica
Copy link
Contributor Author

valkiriaaquatica commented Mar 20, 2024

@Fred-sun thanks a lot fred for that help with null white space bytes and the tag option

Co-authored-by: Fred-sun <37327967+Fred-sun@users.noreply.github.com>
plugins/modules/azure_rm_resource_info.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_resource_info.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_resource_info.py Show resolved Hide resolved
@Fred-sun
Copy link
Collaborator

@valkiriaaquatica The 'tags' parameter has a default value {}, the document does not! Thank you!

valkiriaaquatica and others added 3 commits March 20, 2024 08:42
Co-authored-by: Fred-sun <37327967+Fred-sun@users.noreply.github.com>
Co-authored-by: Fred-sun <37327967+Fred-sun@users.noreply.github.com>
Co-authored-by: Fred-sun <37327967+Fred-sun@users.noreply.github.com>
Copy link
Collaborator

@Fred-sun Fred-sun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

last change!

plugins/modules/azure_rm_resource_info.py Outdated Show resolved Hide resolved
Co-authored-by: Fred-sun <37327967+Fred-sun@users.noreply.github.com>
@Fred-sun
Copy link
Collaborator

@valkiriaaquatica I will push for a merger as soon as possible. Thank you!

@Fred-sun Fred-sun added ready_for_review The PR has been modified and can be reviewed and merged and removed work in In trying to solve, or in working with contributors labels Mar 20, 2024
@valkiriaaquatica
Copy link
Contributor Author

@Fred-sun that's perfect :) and thank you for the reviews!

@xuzhang3 xuzhang3 merged commit bc101bc into ansible-collections:dev Mar 20, 2024
@valkiriaaquatica valkiriaaquatica deleted the patch-1 branch April 12, 2024 17:12
Justwmz pushed a commit to Justwmz/azure that referenced this pull request Nov 4, 2024
…#1498)

* add tag option

* delete one nullbyte space

Co-authored-by: Fred-sun <37327967+Fred-sun@users.noreply.github.com>

* Update plugins/modules/azure_rm_resource_info.py

Co-authored-by: Fred-sun <37327967+Fred-sun@users.noreply.github.com>

* Update plugins/modules/azure_rm_resource_info.py

Co-authored-by: Fred-sun <37327967+Fred-sun@users.noreply.github.com>

* Update plugins/modules/azure_rm_resource_info.py

Co-authored-by: Fred-sun <37327967+Fred-sun@users.noreply.github.com>

* Update plugins/modules/azure_rm_resource_info.py

Co-authored-by: Fred-sun <37327967+Fred-sun@users.noreply.github.com>

* Update plugins/modules/azure_rm_resource_info.py

Co-authored-by: Fred-sun <37327967+Fred-sun@users.noreply.github.com>

---------

Co-authored-by: Fred-sun <37327967+Fred-sun@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
medium_priority Medium priority question Further information is requested ready_for_review The PR has been modified and can be reviewed and merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants