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

"interface wifi provisioning" with multiple entries #344

Closed
ivoruetsche opened this issue Feb 19, 2025 · 3 comments · Fixed by #345
Closed

"interface wifi provisioning" with multiple entries #344

ivoruetsche opened this issue Feb 19, 2025 · 3 comments · Fixed by #345

Comments

@ivoruetsche
Copy link

ivoruetsche commented Feb 19, 2025

SUMMARY

We try to define with community.routeros.api_modify three CAPsMAN provisioning entries, but only one is accepted, because the attribute action didn't accept create-dynamic-enabled multiple time in the data part of the yaml.

Coresponding RouterOS configuration:

/interface wifi provisioning add action=create-dynamic-enabled comment=prov_yyy-zz-aaa01_min disabled=no identity-regexp="^test-zz-nnn01-ap[0-9][0-9]_l" master-configuration=cfg_yyy-lan_min slave-configurations=cfg_yyy-guest_min,cfg_yyy-test_min
/interface wifi provisioning add action=create-dynamic-enabled comment=prov_yyy-zz-aaa01_mid disabled=no identity-regexp="^test-zz-nnn01-ap[0-9][0-9]_m" master-configuration=cfg_yyy-lan_mid slave-configurations=cfg_yyy-guest_mid,cfg_yyy-test_mid
/interface wifi provisioning add action=create-dynamic-enabled comment=prov_yyy-zz-aaa01_max disabled=no identity-regexp="^test-zz-nnn01-ap[0-9][0-9]_h" master-configuration=cfg_yyy-lan_max slave-configurations=cfg_yyy-guest_max,cfg_yyy-test_max
ISSUE TYPE
  • Bug Report
COMPONENT NAME

community.routeros.api_modify

ANSIBLE VERSION
ansible [core 2.17.8]
COLLECTION VERSION
# /usr/lib/python3/dist-packages/ansible_collections
Collection         Version                          
------------------ -------                          
community.routeros 2.20.0                           
CONFIGURATION

OS / ENVIRONMENT

Router OS 7.17.2

STEPS TO REPRODUCE
- name: mik_switch | mik_switch_capsman.yaml | interface wifi provisioning
  community.routeros.api_modify:
    hostname: "192.168.0.124"
    password: "x"
    username: "admin"
    path: interface wifi provisioning
    handle_absent_entries: remove
    handle_entries_content: remove_as_much_as_possible
    data:
      - identity-regexp: ^test-zz-nnn01-ap[0-9][0-9]_l
        action: create-dynamic-enabled
        comment: prov_yyy-zz-aaa01_min
        disabled: False
        master-configuration: cfg_yyy-lan_min
        slave-configurations: cfg_yyy-guest_min,cfg_yyy-test_min
      - identity-regexp: ^test-zz-nnn01-ap[0-9][0-9]_m
        action: create-dynamic-enabled
        comment: prov_yyy-zz-aaa01_mid
        disabled: False
        master-configuration: cfg_yyy-lan_mid
        slave-configurations: cfg_yyy-guest_mid,cfg_yyy-test_mid
      - identity-regexp: ^test-zz-nnn01-ap[0-9][0-9]_h
        action: create-dynamic-enabled
        comment: prov_yyy-zz-aaa01_max
        disabled: False
        master-configuration: cfg_yyy-lan_max
        slave-configurations: cfg_yyy-guest_max,cfg_yyy-test_max
  register: res
  delegate_to: localhost
EXPECTED RESULTS

Creating three new provisioning entries:

  • prov_yyy-zz-aaa01_min
  • prov_yyy-zz-aaa01_mid
  • prov_yyy-zz-aaa01_max
ACTUAL RESULTS
fatal: [192.168.0.124 -> localhost]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "ca_path": null,
            "data": [
                {
                    "action": "create-dynamic-enabled",
                    "comment": "prov_yyy-zz-aaa01_min",
                    "disabled": false,
                    "identity-regexp": "^test-zz-nnn01-ap[0-9][0-9]_l",
                    "master-configuration": "cfg_yyy-lan_min",
                    "slave-configurations": "cfg_yyy-guest_min,cfg_yyy-test_min"
                },
                {
                    "action": "create-dynamic-enabled",
                    "comment": "prov_yyy-zz-aaa01_mid",
                    "disabled": false,
                    "identity-regexp": "^test-zz-nnn01-ap[0-9][0-9]_m",
                    "master-configuration": "cfg_yyy-lan_mid",
                    "slave-configurations": "cfg_yyy-guest_mid,cfg_yyy-test_mid"
                },
                {
                    "action": "create-dynamic-enabled",
                    "comment": "prov_yyy-zz-aaa01_max",
                    "disabled": false,
                    "identity-regexp": "^test-zz-nnn01-ap[0-9][0-9]_h",
                    "master-configuration": "cfg_yyy-lan_max",
                    "slave-configurations": "cfg_yyy-guest_max,cfg_yyy-test_max"
                }
            ],
            "encoding": "ASCII",
            "ensure_order": false,
            "force_no_cert": false,
            "handle_absent_entries": "remove",
            "handle_entries_content": "remove_as_much_as_possible",
            "handle_read_only": "error",
            "handle_write_only": "create_only",
            "hostname": "192.168.0.124",
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "path": "interface wifi provisioning",
            "port": null,
            "restrict": null,
            "timeout": 10,
            "tls": false,
            "username": "admin",
            "validate_cert_hostname": false,
            "validate_certs": true
        }
    },
    "msg": "Every element in data must contain a unique value for action. The value \"create-dynamic-enabled\" appears at least twice."
}
@felixfontein
Copy link
Collaborator

Right now action is set as the (only) primary key for interface wifi provisioning, which means the module assumes that there can be at most one entry for every value for action. This seems to be a wrong assumption.

Do you happen to know how if there's a combination of the values to uniquely identify an entry, or whether you can simply add whatever you want (possibly even the same record multiple times)?

@ivoruetsche
Copy link
Author

Salü Felix

If I use these:

action: create-dynamic-enabled l
action: create-dynamic-enabled m
action: create-dynamic-enabled h

I get these, which it was expected:

fatal: [192.168.0.124 -> localhost]: FAILED! => {"changed": false, "msg": "Error while creating entry for action=\"create-dynamic-enabled l\": input does not match any value of action"}

But it works when I use different, valid values:

action: create-dynamic-enabled
action: create-enabled
action: create-disabled

Via web gui, it is possible to have three complete identical entries. It looks like, there is not any visible primary key.

Thank you

Ivo

@felixfontein
Copy link
Collaborator

I created a PR #345 to remove the primary key.

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

Successfully merging a pull request may close this issue.

2 participants