Ansible network module ios_config dont work on my fs S3260switch

Hello!

I finishing my course beeing an intern on a company, and my project is switch automation with ansible.

With the cisco switch its not hard, but fs.com switches although they are similar to cisco, dont accept some modules, like, ios_config, and my boss ask me to try to “create” a module like ios_config but that fs.com accept it.

Right now when i try to use it on fs switch, it says that this operation requires privilege escalation, if i use ios_command the operations works. Can somoene help me on how to use ios_config like a template and change it to be able to use on fs.com???

Best Regards,
Tiago Oliveira

Perhaps you could show us what you currently have for this new module, so we
have an understanding of what commands you are trying to run which require
special privileges.

Also, any documentation you can point us to, for those of us not intimately
familiar with fs.com switches and their remote management capabilities, would
probably help.

Antony.

I actually dont have anything of the module done.

I wanted to see the ios_config module and how it was done so i could have an ideia of what to do… but i cant find the documentation and the how to do that module.

About the fs.com switches, the one i am trying to use is a lot similar to cisco ios, with small diferences. for example you do enable and then config and not config terminal, and i dont know if that changes something for the module not working, because if i use ios_command module and write all the commands: enable,config i can use this commands inside fs switch config without problems…

Tiago

A segunda-feira, 19 de julho de 2021 à(s) 18:02:30 UTC+1, Antony Stone escreveu:

I actually dont have anything of the module done.

So, how are you getting the error "this operation requires privilege
escalation"?

I wanted to see the ios_config module and how it was done so i could have
an ideia of what to do.. but i cant find the documentation and the how to
do that module.

There may only be source code. Not everyone documents the development of
things like this in sufficient detail that other developers can understand the
design process.

About the fs.com switches, the one i am trying to use is a lot similar to
cisco ios, with small diferences. for example

Sorry, but phrases like "small differences" and "for example" are not enough to
write software. You need specifications - you need definite documentation about
_exactly_ how things need to be done.

you do enable and then config and not config terminal, and i dont know if that
changes something for the module not working, because if i use ios_command
module and write all the commands: enable,config i can use this commands
inside fs switch config without problems..

Start with something simple.

Make sure you can do one specific, simple command manually, and then get an
ansible module to do it for you. If you need escalated privileges, well, put
that in (I assume you already know how to do that in ansible).

Then, once you have something simple working, build up to the real goal of the
full configuration you are trying to achieve.

If you need further help from the list, though, I really think you need to
provide some details about what you are doing, what the errors are, and what
the fs.com documentation says needs to be done to make something work.

Antony.

So, how are you getting the error “this operation requires privilege
escalation”?

I was getting this error when i try to use the ios_config, wich is made for cisco_ios. Fs.com switches base ios is cisco, but i dont know what is their ios name (if they have a name) and i cant find it anywhere. When i use ios_command the switch accept it because this dont go further to config mode without my commands and i dont know if it a conflict because config mode in cisco is config terminal and fs.com config mode is config only.

There may only be source code. Not everyone documents the development of
things like this in sufficient detail that other developers can understand the
design process.

About this, im kynda new on ansible, and i cant find a “guide” on how to build a module and that is maybe the hardest part… in my course ive studied C,C++ and C# but we dont use python… although everyone says to me that if i can program with c i can easy learn python. The problem here is actually, find a ‘how to do a module guide’.

Sorry, but phrases like “small differences” and “for example” are not enough to
write software. You need specifications - you need definite documentation about
exactly how things need to be done.

Here i got a manual that i am using to see what to do when cisco commands not working (because some are different!)

PoE+ Series Switches CLI Reference Guide | FS → https://img-en.fs.com/file/user_manual/poe+-series-switches-cli-reference-guide.pdf

Start with something simple.

Make sure you can do one specific, simple command manually, and then get an
ansible module to do it for you. If you need escalated privileges, well, put
that in (I assume you already know how to do that in ansible).

Then, once you have something simple working, build up to the real goal of the
full configuration you are trying to achieve.

If you need further help from the list, though, I really think you need to
provide some details about what you are doing, what the errors are, and what
the fs.com documentation says needs to be done to make something work.

So the point is to make a module to automate commands inside config mode in the s3260-8T2FP switch from fs.com, i am using an s3900-24F4S switch also from fs.com but this one i have since yesterday so im still testing and learning how to work with it and for now it looks more similar to cisco_ios than the other one…

I already make 2 roles that create vlans on the switch and link them with a specific port. This roles are working but the module was a better project for my internship since this roles are only working to fs with ios_command and i have to make the commands all by myself.

If i could do a module like ios_config but working to fs, not only i would automate even better my roles, but also i would have a better project to show in the present in the end of my internship.

Hope you guys can help me!!
If u didnt understand something please ask me!!

A segunda-feira, 19 de julho de 2021 à(s) 20:30:16 UTC+1, Antony Stone escreveu:

Instead of writing a whole new module, why not try to use netcommon module: https://docs.ansible.com/ansible/latest/collections/ansible/netcommon/cli_command_module.html