Friday, January 26, 2018

ANSIBLE CONFIG ACL AND SAVE CONFIG






Tuesday, January 23, 2018

INSTALL PYTHON PACKAGE FROM TAR


You may use pip for that without using the network. See in the docs (search for "Install a particular source archive file"). Any of those should work:
pip install relative_path_to_seaborn.tar.gz    
pip install absolute_path_to_seaborn.tar.gz    
pip install file:///absolute_path_to_seaborn.tar.gz    
Or you may uncompress the archive and use setup.py directly with either pip or python:
cd directory_containing_setup.py
pip install .
python setup.py install
Of course, you should also download required packages and install them the same way before you proceed.
GIT CLONE DENIED DUE TO CERTIFICATE



ANSIBLE PLAYBOOK

Using lines instead of commands. Can run over and over again without error. With command it will generate error


---
- hosts: TEST253
  gather_facts: true
  connection: local

  tasks:
    - name: config acl
      ios_config:
        lines:
          - permit udp any any
          - permit tcp any any eq www
        host:  "{{ ansible_host }}"
        username: cisco
        password: cisco123
        parents: ip access-list exten TEST253
        match: exact
      register: config

   
mtadmin@ubuntu:/etc/ansible/playbook$ ansible-playbook config_acl_2.yaml

PLAY [TEST253] *****************************************************************

TASK [setup] *******************************************************************
ok: [TEST253]

TASK [config acl] **************************************************************
changed: [TEST253]

PLAY RECAP *********************************************************************
TEST253                    : ok=2    changed=1    unreachable=0    failed=0  

mtadmin@ubuntu:/etc/ansible/playbook$ ansible-playbook config_acl_2.yaml

PLAY [TEST253] *****************************************************************

TASK [setup] *******************************************************************
ok: [TEST253]

TASK [config acl] **************************************************************
changed: [TEST253]

PLAY RECAP *********************************************************************
TEST253                    : ok=2    changed=1    unreachable=0    failed=0  



Error with comand

mtadmin@ubuntu:/etc/ansible/playbook$ ansible-playbook config_acl.yaml

PLAY [TEST252] *****************************************************************

TASK [setup] *******************************************************************
ok: [TEST252]

TASK [config acl] **************************************************************
fatal: [TEST252]: FAILED! => {"changed": false, "failed": true, "msg": "matched error in response: permit tcp any any eq www\r\n                     ^\r\n% Invalid input detected at '^' marker.\r\n\r\nTEST-3850(config)#"}
                to retry, use: --limit @/etc/ansible/playbook/config_acl.retry

PLAY RECAP *********************************************************************

TEST252                    : ok=1    changed=0    unreachable=0    failed=1   
ANSIBLE PLAYBOOK FOR CISCO IOS

ios_config using commands

[TEST_3850_by_name]
TEST253 ansible_host=10.22.41.253
TEST252 ansible_host=10.22.41.252

===========================================

---
- hosts: TEST_3850_by_name
  gather_facts: true
  connection: local

  tasks:
    - name: config acl
      ios_config:
        commands:
          - ip access-list extended TEST252
          - permit tcp any any eq www
        host:  "{{ ansible_host }}"
        username: cisco
        password: cisco123
      register: config

               


mtadmin@ubuntu:/etc/ansible/playbook$ ansible-playbook config_acl.yaml --limit TEST253

PLAY [TEST_3850_by_name] *******************************************************

TASK [setup] *******************************************************************
ok: [TEST253]

TASK [config acl] **************************************************************
changed: [TEST253]

PLAY RECAP *********************************************************************
TEST253                    : ok=2    changed=1    unreachable=0    failed=0  

mtadmin@ubuntu:/etc/ansible/playbook$



========================================================================

---
- hosts: TEST253
  gather_facts: true
  connection: local

  tasks:
    - name: config acl
      ios_config:
        commands:
          - ip access-list extended TEST252
          - permit tcp any any eq www
        host:  "{{ ansible_host }}"
        username: cisco
        password: cisco123
      register: config

                 
mtadmin@ubuntu:/etc/ansible/playbook$ ansible-playbook config_acl_2.yaml

PLAY [TEST253] *****************************************************************

TASK [setup] *******************************************************************
ok: [TEST253]

TASK [config acl] **************************************************************
changed: [TEST253]

PLAY RECAP *********************************************************************
TEST253                    : ok=2    changed=1    unreachable=0    failed=0  

========================================================================


---
- hosts: TEST_3850_by_name
  gather_facts: true
  connection: local

  tasks:
    - name: config acl
      ios_config:
        commands:
          - ip access-list extended TEST252
          - permit tcp any any eq www
        host:  TEST252
        username: cisco
        password: cisco123
      register: config

   
mtadmin@ubuntu:/etc/ansible/playbook$ ansible-playbook config_acl.yaml

PLAY [TEST_3850_by_name] *******************************************************

TASK [setup] *******************************************************************
ok: [TEST252]
ok: [TEST253]

TASK [config acl] **************************************************************
fatal: [TEST253]: FAILED! => {"changed": false, "failed": true, "msg": "failed to connect to TEST252:22"}
fatal: [TEST252]: FAILED! => {"changed": false, "failed": true, "msg": "failed to connect to TEST252:22"}
                to retry, use: --limit @/etc/ansible/playbook/config_acl.retry

PLAY RECAP *********************************************************************
TEST252                    : ok=1    changed=0    unreachable=0    failed=1  
TEST253                    : ok=1    changed=0    unreachable=0    failed=1  

=========================================================================================



---
- hosts: TEST252
  gather_facts: true
  connection: local

  tasks:
    - name: config acl
      ios_config:
        commands:
          - ip access-list extended TEST252
          - permit tcp any any eq www
        host:  "{{ ansible_host }}"
        username: cisco
        password: cisco123
      register: config

- hosts: TEST253
  gather_facts: true
  connection: local

  tasks:
    - name: config acl
      ios_config:
        commands:
          - ip access-list extended TEST253
          - permit tcp any any eq www
        host:  "{{ ansible_host }}"
        username: cisco
        password: cisco123

      register: config

Friday, January 19, 2018

CISCO 3850-48P-L UPGRADE TO 16.6 FAILED

Tried to upgrade a Cisco 3850 to version 16.06.02 and it failed with following error messages.

TEST-3850#software install file usbflash0:cat3k_caa-universalk9.16.06.02.SPA.bin
Preparing install operation ...
[1]: Starting install operation
[1]: Expanding bundle usbflash0:cat3k_caa-universalk9.16.06.02.SPA.bin
[1]: Copying package files
[1]: Package files copied
[1]: Finished expanding bundle usbflash0:cat3k_caa-universalk9.16.06.02.SPA.bin
[1]: Verifying and copying expanded package files to flash:
[1]: Verified and copied expanded package files to flash:
[1]: Starting compatibility checks
[1]: % Candidate package compatibility checks failed because the following
       package dependencies were not satisfied. Operation aborted.



[1]: % An internal error was encountered. Operation aborted.



TRIED IT WITH THE  new AT THE END OF THE SOFTWARE INSTALL AND IT WORKED

TEST-3850#software install file usbflash0:cat3k_caa-universalk9.16.06.02.SPA.bin new
Preparing install operation ...
[1]: Starting install operation
[1]: Expanding bundle usbflash0:cat3k_caa-universalk9.16.06.02.SPA.bin
[1]: Copying package files
[1]: Package files copied
[1]: Finished expanding bundle usbflash0:cat3k_caa-universalk9.16.06.02.SPA.bin
[1]: Verifying and copying expanded package files to flash:
[1]: Verified and copied expanded package files to flash:
[1]: Starting compatibility checks
[1]: Finished compatibility checks
[1]: Starting application pre-installation processing
[1]: Finished application pre-installation processing
[1]: Old files list:
    Removed cat3k_caa-base.SPA.03.07.04E.pkg
    Removed cat3k_caa-drivers.SPA.03.07.04E.pkg
    Removed cat3k_caa-infra.SPA.03.07.04E.pkg
    Removed cat3k_caa-iosd-universalk9.SPA.152-3.E4.pkg
    Removed cat3k_caa-platform.SPA.03.07.04E.pkg
    Removed cat3k_caa-wcm.SPA.10.3.141.0.pkg
[1]: New files list:
    Added cat3k_caa-guestshell.16.06.02.SPA.pkg
    Added cat3k_caa-rpbase.16.06.02.SPA.pkg
    Added cat3k_caa-rpcore.16.06.02.SPA.pkg
    Added cat3k_caa-srdriver.16.06.02.SPA.pkg
    Added cat3k_caa-webui.16.06.02.SPA.pkg
[1]: Creating pending provisioning file
[1]: Finished installing software.  New software will load on reboot.
[1]: Committing provisioning file

[1]: Do you want to proceed with reload? [yes/no]:



%IOSXEBOOT-loader-boot: (rp/0): upgrade successful 4
MM [1] MCU version 111 sw ver 96
MM [2] MCU version 111 sw ver 96


Front-end Microcode IMG MGR: found 4 microcode images for 1 device.
Image for front-end 0: /tmp/microcode_update/front_end/fe_type_6_0 mismatch: 0
Image for front-end 0: /tmp/microcode_update/front_end/fe_type_6_1 mismatch: 1
Image for front-end 0: /tmp/microcode_update/front_end/fe_type_6_2 mismatch: 1
Image for front-end 0: /tmp/microcode_update/front_end/fe_type_6_3 mismatch: 0

Front-end Microcode IMG MGR: Preparing to program device microcode...
Front-end Microcode IMG MGR: Preparing to program device[0], index=0 ...594412 bytes.... Skipped[0].
Front-end Microcode IMG MGR: Preparing to program device[0], index=1 ...393734 bytes.
Front-end Microcode IMG MGR: Programming device 0...rwRrrrrrrw..0%.........................................................................10%........................................................................20%..........................................................................30%........................................................................40%..........................................................................50%........................................................................60%..........................................................................70%.........................................................................80%..........................................................................90%........................................................................100%
Front-end Microcode IMG MGR: Preparing to program device[0], index=2 ...25186 bytes.
Front-end Microcode IMG MGR: Programming device 0...rrrrrrw..0%....10%....20%......30%...40%......50%....60%......70%...80%......90%....100%wRr!
Front-end Microcode IMG MGR: Microcode programming complete for device 0.
Front-end Microcode IMG MGR: Preparing to program device[0], index=3 ...86370 bytes.... Skipped[3].
Front-end Microcode IMG MGR: Microcode programming complete in 247 seconds

Both links down, not waiting for other switches
Switch number is 1

              Restricted Rights Legend



TEST-3850#sh ver
Cisco IOS XE Software, Version 16.06.02
Cisco IOS Software [Everest], Catalyst L3 Switch Software (CAT3K_CAA-UNIVERSALK9-M), Version 16.6.2, RELEASE SOFTWARE (fc2)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2017 by Cisco Systems, Inc.
Compiled Wed 01-Nov-17 04:27 by mcpre


Cisco IOS-XE software, Copyright (c) 2005-2017 by cisco Systems, Inc.
All rights reserved.  Certain components of Cisco IOS-XE software are
licensed under the GNU General Public License ("GPL") Version 2.0.  The
software code licensed under GPL Version 2.0 is free software that comes
with ABSOLUTELY NO WARRANTY.  You can redistribute and/or modify such
GPL code under the terms of GPL Version 2.0.  For more details, see the
documentation or "License Notice" file accompanying the IOS-XE software,
or the applicable URL provided on the flyer accompanying the IOS-XE
software.


ROM: IOS-XE ROMMON
BOOTLDR: CAT3K_CAA Boot Loader (CAT3K_CAA-HBOOT-M) Version 1.18, RELEASE SOFTWARE (P)

TEST-3850 uptime is 1 minute
Uptime for this control processor is 9 minutes
System returned to ROM by Power Failure
System image file is "flash:packages.conf"
Last reload reason: Power Failure



This product contains cryptographic features and is subject to United
States and local country laws governing import, export, transfer and
use. Delivery of Cisco cryptographic products does not imply
third-party authority to import, export, distribute or use encryption.
Importers, exporters, distributors and users are responsible for
compliance with U.S. and local country laws. By using this product you
agree to comply with applicable laws and regulations. If you are unable
to comply with U.S. and local laws, return this product immediately.

A summary of U.S. laws governing Cisco cryptographic products may be found at:
http://www.cisco.com/wwl/export/crypto/tool/stqrg.html

If you require further assistance please contact us by sending email to
export@cisco.com.


Technology Package License Information:

-----------------------------------------------------------------
Technology-package                   Technology-package
Current             Type             Next reboot
------------------------------------------------------------------
lanbasek9           Permanent        lanbasek9

cisco WS-C3850-48P (MIPS) processor (revision X0) with 853402K/6147K bytes of memory.
Processor board ID FCW1943D1AG
1 Virtual Ethernet interface
52 Gigabit Ethernet interfaces
4 Ten Gigabit Ethernet interfaces
2048K bytes of non-volatile configuration memory.
4194304K bytes of physical memory.
250456K bytes of Crash Files at crashinfo:.
1609272K bytes of Flash at flash:.
983024K bytes of USB Flash at usbflash0:.
0K bytes of WebUI ODM Files at webui:.

Base Ethernet MAC Address          : 18:8b:45:4f:c8:00
Motherboard Assembly Number        : 73-15800-07
Motherboard Serial Number          : FOC19432LAD
Model Revision Number              : X0
Motherboard Revision Number        : B0
Model Number                       : WS-C3850-48P
System Serial Number               : FCW1943D1AG


Switch Ports Model              SW Version        SW Image              Mode
------ ----- -----              ----------        ----------            ----
*    1 56    WS-C3850-48P       16.6.2            CAT3K_CAA-UNIVERSALK9 INSTALL


Configuration register is 0x102



*****NOTE******

ON IOS-XE 16 what used to be "software" command are now "request platform software"