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

Modify address lists without affecting others #283

Open
ewysong opened this issue Apr 30, 2024 · 2 comments
Open

Modify address lists without affecting others #283

ewysong opened this issue Apr 30, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@ewysong
Copy link

ewysong commented Apr 30, 2024

SUMMARY

Ability to modify address-lists without affecting others. I'm sure this would apply to other areas as well, such as /ip/address if an interface has more than one address.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

I've tried both community.routeros.api_modify and community.routeros.api_find_and_modify to try and make this work, but I've not found a way to modify an address list from /ip/firewall/address-list to include only the addresses listed in the playbook and to not remove any other address lists in the configuration.

ADDITIONAL INFORMATION
- name: Firewall list
  delegate_to: localhost
  community.routeros.api_modify:
    path: ip firewall address-list
    data:
      - list: example_list
        address: 192.168.1.0/24
      - list: example_list
        address: 192.168.2.0/24

If I add handle_absent_entries: remove, then it removes any other address lists in the configuration but not listed in the playbook. I'd like to just remove any addresses in the address list itself that are not in the configuration.

@felixfontein felixfontein added the enhancement New feature or request label Apr 30, 2024
@irrwitzer42
Copy link

From my understanding, there is already a PR for this problem (I'm also having): #160

I also have this problem mainly with address-lists, but I like @phox142 's generic approach, because I'm quite sure there will be other "paths" with the same problem.

An other problem with the current (2.15.0) implementation is, that with "handle_absent_entries: remove" one can't add/update address-lists with conditionals, as (at least AFAIK) conditionals work only for tasks, but each task has it's own "data" variable, so each new task will overwrite the changes of the previous one.

Looking forward to a solution, if it's PR160, or something else, but I think this great collection needs one asap ;-)

Thanks guys for your work by the way and looking forward to everything you add to this collection!

@ewysong
Copy link
Author

ewysong commented May 1, 2024

@irrwitzer42 you're absolutely correct. I checked open issues for this but not PRs.

To my knowledge you're correct regarding conditionals as well. I tried (a loop to be exact) and had the same issue (only the last value was present when it completed).

Appreciate the work on this as well. I know it's a small community.

If it's best this be issue be closed since there's already a PR, feel free to close it it @felixfontein!

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

No branches or pull requests

3 participants