Tuesday, October 29, 2019

Configure VTY lines using ansible

Hi

I am configuring VTY lines on some devices with AAA.

But the ios_config module always changes the configuration when it is already configured.

 - name: RUN 'Changing line vty' ios_config: lines: - authorization exec VTY_author - login authentication VTY_authen parents: - "" with_items: - line vty 0 15 

The reason is the configuration will be split up i 2 or more parts by the IOS:

line vty 0 4 authorization exec VTY_author login authentication VTY_authen transport input ssh line vty 5 15 authorization exec VTY_author login authentication VTY_authen transport input ssh 

My problem is on some devices the vty lines are split up into more than this.

line vty 0 authorization exec VTY_author login authentication VTY_authen line vty 1 authorization exec VTY_author login authentication VTY_authen length 0 line vty 2 4 authorization exec VTY_author login authentication VTY_authen line vty 5 15 authorization exec VTY_author login authentication VTY_authen ! 

Any good advice on how to avoid this?

Or do I have to make an "show run | inc line vty" and loop through it in my task?



No comments:

Post a Comment