Got it

Ansible Module for non CloudEngine Switches

Created: Apr 3, 2019 11:43:20Latest reply: Dec 16, 2020 23:52:57 1961 15 1 0 0
  Rewarded HiCoins: 0 (problem resolved)

Hi all

is there an Ansible module to configure or get infromations from a non CloudEngine Switch like S5720?

Im looking for a module like the Cisco ios_facts.


Thanks for any help

Lars

  • x
  • convention:

Featured Answers
chenhui
Admin Created Apr 5, 2019 02:41:36

cause the S series switch and CE series swith both based on the VRP platform, and there are modules for the CE switch, so, I think you can try it with the CE module.
View more
  • x
  • convention:

All Answers
Oussema
Oussema Created Apr 3, 2019 12:59:06

There are no device-specific modules for that device, but that device can be configured from the command line, so you can use the Ansible CLI modules:
 
  • cli_command – Run a cli command on cli-based network devices
(https://docs.ansible.com/ansible/devel/modules/cli_command_module.html#cli-command-module)

  • cli_command – Run a cli command on cli-based network devices
(https://docs.ansible.com/ansible/devel/modules/cli_config_module.html#cli-config-module)


View more
  • x
  • convention:

user_3362717
user_3362717 Created Apr 3, 2019 15:36:54

I have tried it with this but I did not get it to work. with this module you have to set the ansible_connection to network_cli and you have to set the ansible_network_os variable but for huawei there is no option. do you have any working playbook?
View more
  • x
  • convention:

chenhui
chenhui Admin Created Apr 5, 2019 02:41:36

cause the S series switch and CE series swith both based on the VRP platform, and there are modules for the CE switch, so, I think you can try it with the CE module.
View more
  • x
  • convention:

chenhui
chenhui Admin Created Apr 5, 2019 02:43:37

by the way, since I never used Ansible before, so, this is just a advise, and I think it's better to contact with the Ansible support or community. maybe they can provide a more useful advise.
View more
  • x
  • convention:

fliubo
fliubo Created Dec 9, 2020 19:24:27

Hi ,
i ha ve the same question :

I have tried it with this but I did not get it to work. with this module you have to set the ansible_connection to network_cli and you have to set the ansible_network_os variable but for huawei there is no option. do you have any working playbook?

THX
View more
  • x
  • convention:

egleesc
egleesc Created Dec 10, 2020 20:20:26 (0) (0)
 
philip.schaller
philip.schaller Created Dec 10, 2020 21:35:33 (0) (0)
Hi fliubo

Yes it's possible and I've created several ansible playbooks for Huawei S-series switches. You have to use "ansible_network_os=ce" in your vars.  
philip.schaller
philip.schaller Created Dec 10, 2020 21:36:06 (0) (0)
Here a simple example to create an ACL:
---
- hosts: all
gather_facts: no
connection: network_cli
tasks:
- name: change acl
cli_command:
command: |
system-view
acl number 2999
rule 10 permit source 192.168.1.83 0
return

- name: save running to startup
cli_command:
command: save
prompt:
- "continue?"
answer:
- "y"  
philip.schaller
philip.schaller Created Dec 10, 2020 21:37:01 (0) (0)
And another example:
---
- name: Check Version
hosts: all
connection: network_cli
gather_facts: false

tasks:
- name: display version
cli_command:
command: display version
register: config
when: ansible_network_os == 'ce'

- name: show version
cli_command:
command: show version
register: config
when: ansible_network_os == 'ios'  
philip.schaller
philip.schaller Created Dec 10, 2020 21:37:58 (0) (0)
Hope that helps. Let me know how it works for you.  
aba_rechsteiner
aba_rechsteiner Reply philip.schaller  Created Feb 3, 2021 16:53:25 (0) (0)
Thank you Philip, but this really not what i understand by automation or config managment. with the network_cli every command is executed on every ansible run. Config management should be declarative. It's really sad that huawei doesn't offer better support for switch automation.  
philip.schaller
philip.schaller Reply aba_rechsteiner  Created Feb 18, 2021 21:30:12 (0) (0)
yes I totally agree with you for both points: 1. It's not a automation/config management we are looking for and 2. it's a pity that Huawei is not invest more in such things. That could be more and more an argument to use other vendors with better implementation.  
fliubo
fliubo Created Dec 11, 2020 00:24:57

Thx very much in deed philip ,
now i have a good point to start ,
good examples ( I ask to me how )
Do you know about using Ansible into Huawei eNSP lab simulation ?
is it possible ?

I wish you all the best
View more
  • x
  • convention:

philip.schaller
philip.schaller Created Dec 11, 2020 17:44:47 (0) (0)
I've never tried it but it should work with the cloud feature within eNSP. With the cloud you can connect your switch/router with the real world and you will have access from your ansible station.  
fliubo
fliubo Created Dec 16, 2020 23:52:57

Hallo ,

I can't find the way to put a login banner into the switch ...
( HUAWEI switch )
no module for this ,
some ideas ?

Thx
View more
  • x
  • convention:

Comment

You need to log in to comment to the post Login | Register
Comment

Notice: To protect the legitimate rights and interests of you, the community, and third parties, do not release content that may bring legal risks to all parties, including but are not limited to the following:
  • Politically sensitive content
  • Content concerning pornography, gambling, and drug abuse
  • Content that may disclose or infringe upon others ' commercial secrets, intellectual properties, including trade marks, copyrights, and patents, and personal privacy
Do not share your account and password with others. All operations performed using your account will be regarded as your own actions and all consequences arising therefrom will be borne by you. For details, see " Privacy."

My Followers

Login and enjoy all the member benefits

Login

Block
Are you sure to block this user?
Users on your blacklist cannot comment on your post,cannot mention you, cannot send you private messages.
Reminder
Please bind your phone number to obtain invitation bonus.