For more details, please see ourCookie Policy.


DevNet Discussions

Reply
Broadcom
Posts: 21
Registered: ‎01-31-2012

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

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.

New Contributor
Posts: 2
Registered: ‎03-27-2016

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

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 

 

Broadcom
Posts: 21
Registered: ‎01-31-2012

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

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.

Occasional Contributor
Posts: 13
Registered: ‎02-16-2018

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

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.

Occasional Contributor
Posts: 13
Registered: ‎02-16-2018

Re: Automation Demo Video

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

Highlighted
Broadcom
Posts: 21
Registered: ‎01-31-2012

Re: Automation Demo Video

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.

Occasional Contributor
Posts: 13
Registered: ‎02-16-2018

Re: Automation Demo Video

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 ~]#

Broadcom
Posts: 21
Registered: ‎01-31-2012

Re: Automation Demo Video

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?

Occasional Contributor
Posts: 13
Registered: ‎02-16-2018

Re: Automation Demo Video

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

Broadcom
Posts: 1
Registered: ‎02-24-2010

Re: Automation Demo Video

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

 

Join the Broadcom Community

Get quick and easy access to valuable resources across the Broadcom Community Network.