Brocade Automation Community

Expand all | Collapse all

Ansible modules & playbooks available on github.com/brocade/ansible

  • 1.  Ansible modules & playbooks available on github.com/brocade/ansible

    Posted 02-02-2018 07:53 PM

    Hi.

     

    Just wanted to give you a heads-up that we have posted Ansible playbooks & modules on github.com/brocade/ansible. These modules and playbooks work with PyFOS already posted on github.com/brocade/pyfos & FOS running 8.2.0. These modules & playbooks are for reference examples only and lightly tested. Some of the use cases that they cover are

     

    * port configuration playbook

    * port configuration based on json inputs

    * zoning between host & target

    * zoning based on cvs entries

    * zoning based on decommissioning of host or target

     

    We are interested in comments/inputs on what additional modules/playbooks examples would be helpful to create/adopt in your own env & any changes to the existing set to make them more useful for your day-to-day operations. Thanks.


    #BrocadeAutomationCommunity


  • 2.  Re: Ansible modules & playbooks available on github.com/brocade/ansible

    Posted 05-28-2018 11:08 PM

    It's wonderful to have Brocade providing modules for automating the SAN infrastructure.. just curios to know to know if  this would work to the older FOS versions like 7.4.2c etc 

     


    #BrocadeAutomationCommunity


  • 3.  Re: Ansible modules & playbooks available on github.com/brocade/ansible

    Posted 06-26-2018 10:58 PM

    sorry for the late reply. but I didn't realize that I wasn't subscribed to the notification from the forum.

     

    rest api for FOS is supported from 8.2.0 and up. So, pyfos & ansible reference examples would work from 8.2.0 and up.


    #BrocadeAutomationCommunity


  • 4.  Re: Ansible modules & playbooks available on github.com/brocade/ansible

    Posted 07-18-2018 12:28 AM

    We are trying to test Ansible on Brocade SAN switches, but we are stuck with some issue. So looking for an help on this.

    We have build a RHEL 7.3 server, so by default 2.7 was the python version. But in the document it was mentioned it was tested with Python3.5. Do we need to upgrade the python version on this server or will the testing will be working with Python2.7 version. I have upgraded the switch to 8.2.0b. Do we have any specification in Ansible version.

     

    It will really great if we have module for firmwareupgrade, that will help in upgrading multiple swicthes at same time.


    #BrocadeAutomationCommunity


  • 5.  Re: Automation Demo Video

    Posted 07-18-2018 12:29 AM

    We are trying to test Ansible on Brocade SAN switches, but we are stuck with some issue. So looking for an help on this.

    We have build a RHEL 7.3 server, so by default 2.7 was the python version. But in the document it was mentioned it was tested with Python3.5. Do we need to upgrade the python version on this server or will the testing will be working with Python2.7 version. I have upgraded the switch to 8.2.0b. Do we have any specification in Ansible version.

     

    It will really great if we have module for firmwareupgrade, that will help in upgrading multiple swicthes at same time


    #BrocadeAutomationCommunity


  • 6.  Re: Automation Demo Video

    Posted 08-07-2018 02:01 PM

    sorry for the late reply. I don't seem to be getting notifications from the forum for activities.

     

    Anyhow, my env is ansible 2.2.0.0. I don't have firmware upgrade examples. Most of the examples are around zoning & port configuraitons. I'll keep firmware upgrade scenario in mind as rest api supports the feature in the future roadmap.


    #BrocadeAutomationCommunity


  • 7.  Re: Automation Demo Video

    Posted 08-13-2018 06:32 AM

    Thanks for the reply, we are trying to test Ansible modules with SAN switch. I am unable to ping the switch in order to test further.

     

    [root@ctsblrtestsanr1 ~]# ansible 172.16.150.161 -i /etc/ansible/hosts -u admin -m ping -k -vvv
    ansible 2.6.1
    config file = /etc/ansible/ansible.cfg
    configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
    ansible python module location = /usr/lib/python2.7/site-packages/ansible
    executable location = /usr/bin/ansible
    python version = 2.7.5 (default, May 3 2017, 07:55:04) [GCC 4.8.5 20150623 (Red Hat 4.8.5-14)]
    Using /etc/ansible/ansible.cfg as config file
    SSH password:
    Parsed /etc/ansible/hosts inventory source with ini plugin
    META: ran handlers
    <172.16.150.161> ESTABLISH SSH CONNECTION FOR USER: admin
    <172.16.150.161> SSH: EXEC sshpass -d12 ssh -C -o ControlMaster=no -o ControlPersist=60s -o User=admin -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/6424650ee0 172.16.150.161 '/bin/sh -c '"'"'echo ~admin && sleep 0'"'"''
    <172.16.150.161> (0, '', "rbash: /bin/sh: restricted: cannot specify `/' in command names\n")
    <172.16.150.161> ESTABLISH SSH CONNECTION FOR USER: admin
    <172.16.150.161> SSH: EXEC sshpass -d12 ssh -C -o ControlMaster=no -o ControlPersist=60s -o User=admin -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/6424650ee0 172.16.150.161 '/bin/sh -c '"'"'echo "`pwd`" && sleep 0'"'"''
    <172.16.150.161> (0, '', "rbash: /bin/sh: restricted: cannot specify `/' in command names\n")
    <172.16.150.161> ESTABLISH SSH CONNECTION FOR USER: admin
    <172.16.150.161> SSH: EXEC sshpass -d12 ssh -C -o ControlMaster=no -o ControlPersist=60s -o User=admin -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/6424650ee0 172.16.150.161 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo ~/.ansible/tmp/ansible-tmp-1534166698.5-181888499061079 `" && echo ansible-tmp-1534166698.5-181888499061079="` echo ~/.ansible/tmp/ansible-tmp-1534166698.5-181888499061079 `" ) && sleep 0'"'"''
    <172.16.150.161> (0, '', "rbash: /bin/sh: restricted: cannot specify `/' in command names\n")
    172.16.150.161 | FAILED! => {
    "msg": "failed to resolve remote temporary directory from ansible-tmp-1534166698.5-181888499061079: `( umask 77 && mkdir -p \"` echo ~/.ansible/tmp/ansible-tmp-1534166698.5-181888499061079 `\" && echo ansible-tmp-1534166698.5-181888499061079=\"` echo ~/.ansible/tmp/ansible-tmp-1534166698.5-181888499061079 `\" )` returned empty string"
    }
    [root@ctsblrtestsanr1 ~]#


    #BrocadeAutomationCommunity


  • 8.  Re: Automation Demo Video

    Posted 09-05-2018 08:21 AM

    ansible reference examples available on github from github.com/brocade are using specific locally executed scripts, not ssh connection. do you have something specific in mind that you are trying to do?


    #BrocadeAutomationCommunity


  • 9.  Re: Automation Demo Video

    Posted 10-04-2018 12:31 AM

    When i trying to do test sample playbooks published in github, it is not working.


    #BrocadeAutomationCommunity


  • 10.  Re: Automation Demo Video

    Posted 10-25-2018 02:06 AM

    You should add inventories written in "san-inventory" to /etc/ansible/hosts with correct switch ip address, like:

     

    san_eng_zone_seed_san_a ansible_connection=local fos_ip_addr=aa.bb.cc.dd

    [switches]
    fc_switch_1 ansible_connection=local fos_ip_addr=aa.bb.cc.dd

    [hosts]
    host_eng_cc port_a=11:22:33:44:55:66:77:dd port_b=11:22:33:44:55:66:77:bb
    host_eng_sqa port_a=22:22:33:44:55:66:77:aa port_b=22:22:33:44:55:66:77:bb
    host_eng_dev port_a=33:22:33:44:55:66:77:aa port_b=33:22:33:44:55:66:77:bb
    host_eng_backup port_a=44:22:33:44:55:66:77:aa port_b=44:22:33:44:55:66:77:bb

    [targets]
    target_200 port_a=99:22:33:44:55:66:77:aa port_b=99:22:33:44:55:66:77:bb
    target_300 port_a=aa:22:33:44:55:66:77:aa port_b=aa:22:33:44:55:66:77:bb

     

    And, you should modify(replace) "fos_passwd.yml" for your environment. This file contains username and password.

    So you should do:

     

    1. Prepare file with these info:

     

    fos_user: "admin"

    fos_password: "password"

     

    2. Create vault file with 'ansible-vault' command:

     

    $ ansible-vault encrypt fos_password.yml

    New Vault password:

    Confirm New Vault password:

     

    Now you can run sample playbooks with "--ask-vault-pass" option.

     

    Hope this helps.

    Akifumi

     


    #BrocadeAutomationCommunity


  • 11.  Re: Automation Demo Video

    Posted 10-26-2018 06:28 AM

    It helped me. It is working for me.


    #BrocadeAutomationCommunity


  • 12.  Re: Automation Demo Video

    Posted 11-19-2018 11:36 AM

    Can i get a copy of that demo.py file..

    I looked around and i can't find that in git repo


    #BrocadeAutomationCommunity


  • 13.  Re: Ansible modules & playbooks available on github.com/brocade/ansible

    Posted 02-26-2019 09:02 AM

    Hi Team,

     

    I am able to succesfully create and activate the zoning using m_zone_allow.py module by setting the ANSIBLE_LIBRARY as the env path using python3.x versions. However, this doesnt work with python2. The reason being the dependency modules are not availabe for installation using pip. Have you been succesfull ever running this on python2?

     

    Additionally, Can I get these modules in a pip-package so that I can install them using pip ?

     

    Thanks in advance.


    #BrocadeAutomationCommunity