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

Couldn't create alias #114

Open
w1g opened this issue Jan 26, 2023 · 4 comments
Open

Couldn't create alias #114

w1g opened this issue Jan 26, 2023 · 4 comments

Comments

@w1g
Copy link

w1g commented Jan 26, 2023

Hallo,

excuse me, I'm confused by the behavior of this module: when I run my playbook, it isn't reported about any errors and a syccesfully finished, in the audit dump on a brocade switch all commands ran successfully, but a new alias isn't created. Could you please help me to understand where is my mistake or what problem I encountered?

All outputs are here:

  • Ansible view:
(ansible) [gnoevoi@plixstord-p00 ansible]$ cat san_automations/playbooks/san_alias_create.yml 
---
- name: Test -- SAN Automatisation. Creating of alias(e)
  hosts: mgnt_faba
  gather_facts: false

  vars:
    credential:
      fos_ip_addr: "{{ ansible_host }}"
      fos_user_name: "{{ ansible_user }}"
      fos_password: "{{ ansible_password }}"
      https: self
    aliases:
      - name: A_ANSIBLE_TEST_01
        members:
#faba
          - 10:00:1c:98:ec:09:7b:24

  tasks:
    - name: Creating of alias(e)
      brocade.fos.brocade_zoning_alias:
        credential: "{{credential}}"
        vfid: -1 
        aliases: "{{aliases}}"
      register: result

    - name: Checking of result
      ansible.builtin.debug:
        msg: "{{ result }}"
...   
(ansible) [gnoevoi@host ansible]$ ansible-playbook -i /home/gnoevoi/betrieb/everydays/src/ansible/san_automations/inventory/switch.ini /home/gnoevoi/betrieb/everydays/src/ansible/san_automations/playbooks/san_alias_create.yml 

PLAY [Test -- SAN Automatisation. Creating of alias(e)] *********************************************************************************************************************************************

TASK [Creating of alias(e)] *************************************************************************************************************************************************************************
changed: [sw12t]

TASK [Checking of result] ***************************************************************************************************************************************************************************
ok: [sw12t] => {
    "msg": {
        "GET_url": "https://********/rest/running/zoning/defined-configuration/alias",
        "PATCH_url": "https://********/rest/running/zoning/effective-configuration",
        "POST_url": "https://********/rest/logout",
        "alias_str": "<defined-configuration><alias><alias-name>A_ANSIBLE_TEST_01</alias-name><member-entry><alias-entry-name>10:00:1c:98:ec:09:7b:24</alias-entry-name></member-entry></alias></defined-configuration>",
        "changed": true,
        "common_list": [],
        "failed": false,
        "method": "POST",
        "patch_resp_data": "",
        "post_list": [
            {
                "members": [
                    "10:00:1c:98:ec:09:7b:24"
                ],
                "name": "A_ANSIBLE_TEST_01"
            }
        ],
        "remove_list": []
    }
}

PLAY RECAP ******************************************************************************************************************************************************************************************
sw12t                      : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   

(ansible) [gnoevoi@plixstord-p00 ansible]$ ansible-galaxy collection verify brocade.fos
Downloading https://galaxy.ansible.com/download/brocade-fos-1.3.0.tar.gz to /home/gnoevoi/.ansible/tmp/ansible-local-10347f_bkk125/tmpmba2ihn4/brocade-fos-1.3.0-y5lby903
Verifying 'brocade.fos:1.3.0'.
Installed collection found at '/home/gnoevoi/.ansible/collections/ansible_collections/brocade/fos'
MANIFEST.json hash: bb0a492c9174c803170c2444abdcb9ce43227e4956e3e22cbaed189c5380054b
Collection brocade.fos contains modified content in the following files:
    plugins/modules/__pycache__
    plugins/modules/__pycache__/brocade_facts.cpython-38.pyc
    plugins/modules/__pycache__/brocade_list_obj.cpython-38.pyc
    plugins/modules/__pycache__/brocade_list_obj_facts.cpython-38.pyc
    plugins/modules/__pycache__/brocade_zoning_alias.cpython-38.pyc
    plugins/modules/__pycache__/brocade_zoning_alias_facts_by_wwn.cpython-38.pyc
(ansible) [gnoevoi@plixstord-p00 ansible]$ ansible-galaxy collection list brocade.fos

# /home/gnoevoi/.ansible/collections/ansible_collections
Collection  Version
----------- -------
brocade.fos 1.3.0  
(ansible) [gnoevoi@plixstord-p00 ansible]$ ansible --version
ansible [core 2.13.7]
  config file = None
  configured module search path = ['/home/gnoevoi/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/gnoevoi/ansible/lib64/python3.8/site-packages/ansible
  ansible collection location = /home/gnoevoi/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/gnoevoi/ansible/bin/ansible
  python version = 3.8.14 (default, Sep 19 2022, 09:47:48) [GCC 9.1.1 20190605 (Red Hat 9.1.1-2)]
  jinja version = 3.1.2
  libyaml = True
(ansible) [gnoevoi@plixstord-p00 ansible]$ cat san_automations/inventory/switch.ini
[admins_switch_access]
sw12t ansible_host=172.30.148.120

sw13t ansible_host=172.30.148.122

[mgnt_faba]
sw12t

[mgnt_fabb]
sw13t

[mgnt:children]
mgnt_faba
mgnt_fabb

[mgnt:vars]
ansible_user = admin
ansible_password = ********
ansible_connection = local
ansible_network_os = brocade.fos
#ansible_become = yes
#ansible_become_method = enable
#ansible_become_password = enpwd
ansible_ssh_common_args = "-o "
ansible_model =  brocade
(ansible) [gnoevoi@plixstord-p00 ansible]$ cat san_automations/ansible.cfg 
[defaults]
inventory = /home/gnoevoi/betrieb/everydays/src/ansible/san_automations/inventory/switch.ini
host_key_checking = False
stdout_callback = yaml
callback_enabled = timer
  • Brocade view
D4_SW12T:admin> auditdump -show
...
253 AUDIT, 2023/01/26-12:18:26 (CET), [SEC-3020], INFO, SECURITY, admin/admin/172.30.148.70/telnet/Rest-Conf, ad_0/D4_SW12T/FID 128, , Event: login, Status: success, Info: Successful login attempt via HTTPS, IP Addr: 172.30.148.70.

254 AUDIT, 2023/01/26-12:18:33 (CET), [ZONE-3002], INFO, ZONE, admin/admin/172.30.148.70/https/Python-urllib/3., None/D4_SW12T/FID 128, , Event: alicreate, Status: success, Info: Alias "A_ANSIBLE_TEST_01" created with Alias member(s) "10:00:1c:98:ec:09:7b:24".

255 AUDIT, 2023/01/26-12:18:35 (CET), [ZONE-3007], INFO, ZONE, admin/admin/172.30.148.70/https/Python-urllib/3., None/D4_SW12T/FID 128, , Event: cfgenable, Status: success, Info: Zone configuration "TEST_SAN_FAB_A" enabled.

256 AUDIT, 2023/01/26-12:18:37 (CET), [SEC-3022], INFO, SECURITY, admin/admin/172.30.148.70/https/Python-urllib/3., None/D4_SW12T/FID 128, , Event: logout, Status: success, Info: Successful logout by user [admin].

D4_SW12T:admin> alishow "A_ANSIBLE_TEST_01"

"A_ANSIBLE_TEST_01" does not exist.
D4_SW12T:admin> alicreate "A_ANSIBLE_TEST_01", "10:00:1c:98:ec:09:7b:24"
D4_SW12T:admin> alishow "A_ANSIBLE_TEST_01"
 alias: A_ANSIBLE_TEST_01
                10:00:1c:98:ec:09:7b:24

D4_SW12T:admin>
D4_SW12T:admin> auditdump -show
...
248 AUDIT, 2023/01/26-12:17:58 (CET), [RAS-3005], INFO, CLI, admin/admin/172.31.152.90/ssh/CLI, ad_0/Brocade6510/CHASSIS, , CLI: auditdump -show


249 AUDIT, 2023/01/26-12:18:26 (CET), [SEC-3020], INFO, SECURITY, admin/admin/172.30.148.70/telnet/Rest-Conf, ad_0/D4_SW12T/FID 128, , Event: login, Status: success, Info: Successful login attempt via HTTPS, IP Addr: 172.30.148.70.

250 AUDIT, 2023/01/26-12:18:33 (CET), [ZONE-3002], INFO, ZONE, admin/admin/172.30.148.70/https/Python-urllib/3., None/D4_SW12T/FID 128, , Event: alicreate, Status: success, Info: Alias "A_ANSIBLE_TEST_01" created with Alias member(s) "10:00:1c:98:ec:09:7b:24".

251 AUDIT, 2023/01/26-12:18:35 (CET), [ZONE-3007], INFO, ZONE, admin/admin/172.30.148.70/https/Python-urllib/3., None/D4_SW12T/FID 128, , Event: cfgenable, Status: success, Info: Zone configuration "TEST_SAN_FAB_A" enabled.

252 AUDIT, 2023/01/26-12:18:37 (CET), [SEC-3022], INFO, SECURITY, admin/admin/172.30.148.70/https/Python-urllib/3., None/D4_SW12T/FID 128, , Event: logout, Status: success, Info: Successful logout by user [admin].

253 AUDIT, 2023/01/26-12:19:19 (CET), [RAS-3005], INFO, CLI, admin/admin/172.31.152.90/ssh/CLI, ad_0/Brocade6510/CHASSIS, , CLI: alishow "A_ANSIBLE_TEST_01"


254 AUDIT, 2023/01/26-12:19:40 (CET), [ZONE-3002], INFO, ZONE, admin/admin/172.31.152.90/ssh/CLI, ad_0/D4_SW12T/FID 128, , Event: alicreate, Status: success, Info: Alias "A_ANSIBLE_TEST_01" created with Alias member(s) "10:00:1c:98:ec:09:7b:24".

255 AUDIT, 2023/01/26-12:19:42 (CET), [RAS-3005], INFO, CLI, admin/admin/172.31.152.90/ssh/CLI, ad_0/Brocade6510/CHASSIS, , CLI: alicreate "A_ANSIBLE_TEST_01", "10:00:1c:98:ec:09:7b:24"


256 AUDIT, 2023/01/26-12:19:53 (CET), [RAS-3005], INFO, CLI, admin/admin/172.31.152.90/ssh/CLI, ad_0/Brocade6510/CHASSIS, , CLI: alishow "A_ANSIBLE_TEST_01"
D4_SW12T:admin> version
Kernel:     2.6.14.2
Fabric OS:  v8.2.3c
Made on:    Mon Jul 18 19:25:41 2022
Flash:      Wed Sep 21 12:11:17 2022
BootProm:   1.0.11
D4_SW12T:admin> mgmtapp --show
REST Interface State: Enabled
REST Session Count: 3
REST Throttling Configurations:
   Sample Requests      : 30
   Sample Time (in sec) : 30
   Idle Time (in sec)   : 3
KeepAlive : Disabled
KeepAliveTimeout : 15sec

Thank you and habe a nice day,
Vasilii

@prasad-valmeti-broadcom
Copy link
Collaborator

As a part of the ansible fos, 1.3.1 release addressed zoning URI issues based on the version of the switch.
Please try with ansible 1.3.1 and let us know if you still see the issues.

@w1g
Copy link
Author

w1g commented May 22, 2023

Hello,

thank you for the answer, but after upgrade of the brocade.fos the situation didn't change:

Ansible:

(ansible) [gnoevoi@plixstord-p00 src]$ ansible-galaxy collection list

# /home/gnoevoi/.ansible/collections/ansible_collections
Collection              Version
----------------------- -------
brocade.fos             1.3.2  
...
(ansible) [gnoevoi@plixstord-p00 src]$ ansible-playbook -vvvv -i /home/gnoevoi/betrieb/everydays/src/ansible/san_automations/inventory/switch.ini /home/gnoevoi/betrieb/everydays/src/ansible/sa
n_automations/playbooks/san_alias_create.yml 
ansible-playbook [core 2.13.10]
  config file = None
  configured module search path = ['/home/gnoevoi/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/gnoevoi/ansible/lib64/python3.8/site-packages/ansible
  ansible collection location = /home/gnoevoi/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/gnoevoi/ansible/bin/ansible-playbook
  python version = 3.8.14 (default, Sep 19 2022, 09:47:48) [GCC 9.1.1 20190605 (Red Hat 9.1.1-2)]
  jinja version = 3.1.2
  libyaml = True
No config file found; using defaults
setting up inventory plugins
host_list declined parsing /home/gnoevoi/betrieb/everydays/src/ansible/san_automations/inventory/switch.ini as it did not pass its verify_file() method
script declined parsing /home/gnoevoi/betrieb/everydays/src/ansible/san_automations/inventory/switch.ini as it did not pass its verify_file() method
auto declined parsing /home/gnoevoi/betrieb/everydays/src/ansible/san_automations/inventory/switch.ini as it did not pass its verify_file() method
yaml declined parsing /home/gnoevoi/betrieb/everydays/src/ansible/san_automations/inventory/switch.ini as it did not pass its verify_file() method
Parsed /home/gnoevoi/betrieb/everydays/src/ansible/san_automations/inventory/switch.ini inventory source with ini plugin
Loading collection brocade.fos from /home/gnoevoi/.ansible/collections/ansible_collections/brocade/fos
Loading callback plugin default of type stdout, v2.0 from /home/gnoevoi/ansible/lib64/python3.8/site-packages/ansible/plugins/callback/default.py
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.

PLAYBOOK: san_alias_create.yml *****************************************************************************************************************************************************************
Positional arguments: /home/gnoevoi/betrieb/everydays/src/ansible/san_automations/playbooks/san_alias_create.yml
verbosity: 4
connection: smart
timeout: 10
become_method: sudo
tags: ('all',)
inventory: ('/home/gnoevoi/betrieb/everydays/src/ansible/san_automations/inventory/switch.ini',)
forks: 5
1 plays in /home/gnoevoi/betrieb/everydays/src/ansible/san_automations/playbooks/san_alias_create.yml

PLAY [Test -- SAN Automatisation. Creating of alias(e)] ****************************************************************************************************************************************
META: ran handlers

TASK [Creating of alias(e)] ********************************************************************************************************************************************************************
task path: /home/gnoevoi/betrieb/everydays/src/ansible/san_automations/playbooks/san_alias_create.yml:19
<172.30.148.122> ESTABLISH LOCAL CONNECTION FOR USER: gnoevoi
<172.30.148.122> EXEC /bin/sh -c 'echo ~gnoevoi && sleep 0'
<172.30.148.122> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/gnoevoi/.ansible/tmp `"&& mkdir "` echo /home/gnoevoi/.ansible/tmp/ansible-tmp-1684792441.5742838-39440-176192953418709 `" && echo ansible-tmp-1684792441.5742838-39440-176192953418709="` echo /home/gnoevoi/.ansible/tmp/ansible-tmp-1684792441.5742838-39440-176192953418709 `" ) && sleep 0'
Using module file /home/gnoevoi/.ansible/collections/ansible_collections/brocade/fos/plugins/modules/brocade_zoning_alias.py
<172.30.148.122> PUT /home/gnoevoi/.ansible/tmp/ansible-local-39423vwogik1t/tmp_qojlgvv TO /home/gnoevoi/.ansible/tmp/ansible-tmp-1684792441.5742838-39440-176192953418709/AnsiballZ_brocade_zoning_alias.py
<172.30.148.122> EXEC /bin/sh -c 'chmod u+x /home/gnoevoi/.ansible/tmp/ansible-tmp-1684792441.5742838-39440-176192953418709/ /home/gnoevoi/.ansible/tmp/ansible-tmp-1684792441.5742838-39440-176192953418709/AnsiballZ_brocade_zoning_alias.py && sleep 0'
<172.30.148.122> EXEC /bin/sh -c '/usr/bin/env python3 /home/gnoevoi/.ansible/tmp/ansible-tmp-1684792441.5742838-39440-176192953418709/AnsiballZ_brocade_zoning_alias.py && sleep 0'
<172.30.148.122> EXEC /bin/sh -c 'rm -f -r /home/gnoevoi/.ansible/tmp/ansible-tmp-1684792441.5742838-39440-176192953418709/ > /dev/null 2>&1 && sleep 0'
changed: [sw13t] => {
    "GET_url": "https://********/rest/running/zoning/defined-configuration/alias",
    "PATCH_url": "https://********/rest/running/zoning/effective-configuration",
    "POST_url": "https://********/rest/logout",
    "alias_str": "<defined-configuration><alias><alias-name>A_TEST_ALIAS_01</alias-name><member-entry><alias-entry-name>10:00:00:00:00:00:00:01</alias-entry-name></member-entry></alias></defined-configuration>",
    "changed": true,
    "common_list": [],
    "invocation": {
        "module_args": {
            "aliases": [
                {
                    "members": [
                        "10:00:00:00:00:00:00:01"
                    ],
                    "name": "A_TEST_ALIAS_01"
                }
            ],
            "aliases_to_delete": null,
            "credential": {
                "fos_ip_addr": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
                "fos_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
                "fos_user_name": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
                "https": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER"
            },
            "members_add_only": null,
            "members_remove_only": null,
            "throttle": null,
            "timeout": null,
            "vfid": -1
        }
    },
    "method": "POST",
    "patch_resp_data": "",
    "post_list": [
        {
            "members": [
                "10:00:00:00:00:00:00:01"
            ],
            "name": "A_TEST_ALIAS_01"
        }
    ],
    "remove_list": []
}

TASK [Checking of result] **********************************************************************************************************************************************************************
task path: /home/gnoevoi/betrieb/everydays/src/ansible/san_automations/playbooks/san_alias_create.yml:27
ok: [sw13t] => {
    "msg": {
        "GET_url": "https://********/rest/running/zoning/defined-configuration/alias",
        "PATCH_url": "https://********/rest/running/zoning/effective-configuration",
        "POST_url": "https://********/rest/logout",
        "alias_str": "<defined-configuration><alias><alias-name>A_TEST_ALIAS_01</alias-name><member-entry><alias-entry-name>10:00:00:00:00:00:00:01</alias-entry-name></member-entry></alias></defined-configuration>",
        "changed": true,
        "common_list": [],
        "failed": false,
        "method": "POST",
        "patch_resp_data": "",
        "post_list": [
            {
                "members": [
                    "10:00:00:00:00:00:00:01"
                ],
                "name": "A_TEST_ALIAS_01"
            }
        ],
        "remove_list": []
    }
}
META: ran handlers
META: ran handlers

PLAY RECAP *************************************************************************************************************************************************************************************
sw13t                      : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   

Brocade:

250 AUDIT, 2023/05/22-23:54:05 (CEST), [SEC-3020], INFO, SECURITY, admin/admin/172.30.148.70/telnet/Rest-Conf, ad_0/D4_SW13T/FID 128, , Event: login, Status: success, Info: Successful login attempt via HTTPS
, IP Addr: 172.30.148.70.

251 AUDIT, 2023/05/22-23:54:12 (CEST), [ZONE-3002], INFO, ZONE, admin/admin/172.30.148.70/https/Python-urllib/3., None/D4_SW13T/FID 128, , Event: alicreate, Status: success, Info: Alias "A_TEST_ALIAS_01" cre
ated with Alias member(s) "10:00:00:00:00:00:00:01".

252 AUDIT, 2023/05/22-23:54:14 (CEST), [ZONE-3007], INFO, ZONE, admin/admin/172.30.148.70/https/Python-urllib/3., None/D4_SW13T/FID 128, , Event: cfgenable, Status: success, Info: Zone configuration "TEST_SA
N_FAB_B" enabled.

253 AUDIT, 2023/05/22-23:54:17 (CEST), [SEC-3022], INFO, SECURITY, admin/admin/172.30.148.70/https/Python-urllib/3., None/D4_SW13T/FID 128, , Event: logout, Status: success, Info: Successful logout by user [
admin].

254 AUDIT, 2023/05/22-23:55:50 (CEST), [SEC-3021], INFO, SECURITY, NONE/NONE/172.31.152.2/ssh/CLI, None/D4_SW13T/FID 128, , Event: login, Status: failed, Info: Failed login attempt via REMOTE, IP Addr: 172.3
1.152.2.

255 AUDIT, 2023/05/22-23:55:50 (CEST), [SEC-3020], INFO, SECURITY, admin/admin/172.31.152.2/ssh/CLI, ad_0/D4_SW13T/FID 128, , Event: login, Status: success, Info: Successful login attempt via REMOTE, IP Addr
: 172.31.152.2.

256 AUDIT, 2023/05/22-23:56:08 (CEST), [RAS-3005], INFO, CLI, admin/admin/172.31.152.2/ssh/CLI, ad_0/Brocade6510/CHASSIS, , CLI: auditdump -h


D4_SW13T:admin> alishow A_TEST_ALIAS_01

"A_TEST_ALIAS_01" does not exist.
D4_SW13T:admin> nodefind 10:00:00:00:00:00:00:01
No device found
D4_SW13T:admin> cfgshow |grep -i cfg
 cfg:   TEST_SAN_FAB_B
 cfg:   TEST_SAN_FAB_B
D4_SW13T:admin> version
Kernel:     2.6.14.2
Fabric OS:  v8.2.3c
Made on:    Mon Jul 18 19:25:41 2022
Flash:      Wed Oct 19 11:15:43 2022
BootProm:   1.0.11

With best regards.
Vasilii

@prasad-valmeti-broadcom
Copy link
Collaborator

Hi Vailii,
Below switch 9.x release, we are using zoing as the URI. Only after 9.x using brocade-zone as the URI. Are there any plans to upgrade to 9.x releases? This will resolve the issue.
Regards,
Prasad

@prasad-valmeti-broadcom
Copy link
Collaborator

If there are no further issues, please suggest if we can close this issue.

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

2 participants