This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
docpublic:systemes:ansible_cisco [2023/01/08 16:38] adminjp [linux keys] |
docpublic:systemes:ansible_cisco [2023/01/08 18:14] (current) adminjp [Playbook ansible cisco cli cmd] |
||
|---|---|---|---|
| Line 32: | Line 32: | ||
| + | |||
| + | association de la clée privée avec le routeur cisco | ||
| + | |||
| + | < | ||
| + | [ansnet@ansmnode .ssh]$ cat config | ||
| + | host routeur | ||
| + | | ||
| + | | ||
| + | User ansiblenet | ||
| + | </ | ||
| + | |||
| + | avec une definition de l' | ||
| + | |||
| + | < | ||
| + | [ansnet@ansmnode .ssh]$ cat /etc/hosts | grep routeur | ||
| + | 192.168.1.7 routeur | ||
| + | </ | ||
| ===== compte Cisco avec clé ssh ===== | ===== compte Cisco avec clé ssh ===== | ||
| Line 48: | Line 65: | ||
| routeur(conf-ssh-pubkey-data)# | routeur(conf-ssh-pubkey-data)# | ||
| routeur(conf-ssh-pubkey-data)# | routeur(conf-ssh-pubkey-data)# | ||
| + | ..... | ||
| routeur(conf-ssh-pubkey-data)# | routeur(conf-ssh-pubkey-data)# | ||
| routeur(conf-ssh-pubkey-data)# | routeur(conf-ssh-pubkey-data)# | ||
| Line 56: | Line 73: | ||
| </ | </ | ||
| - | + | ===== acces ssh cisco ===== | |
| + | |||
| + | Maintenant que tout est en place, il est possible de se connecter en ssh en utilisasant le clée ssh pour l' | ||
| + | |||
| + | < | ||
| + | [ansnet@ansmnode .ssh]$ | ||
| + | |||
| + | |||
| + | routeur# | ||
| + | Current privilege level is 10 | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== Playbook ansible cisco cli cmd ===== | ||
| + | |||
| + | playbook ansible qui lance une commande cisco en cli affichant les stats de CPU QOS | ||
| + | |||
| + | < | ||
| + | routeur# | ||
| + | |||
| + | CPU Queue Statistics | ||
| + | ============================================================================================ | ||
| + | (default) (set) | ||
| + | QId PlcIdx | ||
| + | -------------------------------------------------------------------------------------------- | ||
| + | 0 11 DOT1X Auth Yes | ||
| + | 1 1 L2 Control | ||
| + | 2 14 Forus traffic | ||
| + | 3 0 ICMP GEN Yes | ||
| + | 4 2 Routing Control | ||
| + | 5 14 Forus Address resolution | ||
| + | 6 0 ICMP Redirect | ||
| + | 7 16 Inter FED Traffic | ||
| + | 8 4 L2 LVX Cont Pack Yes | ||
| + | 9 19 EWLC Control | ||
| + | 10 | ||
| + | 11 | ||
| + | 12 | ||
| + | 13 | ||
| + | 14 | ||
| + | 15 | ||
| + | ... | ||
| + | |||
| + | </ | ||
| + | |||
| + | c'est une commande complexe pour laquelle je n'ai pas trouvé d'OID snmp, ce qui aurai bcp plus simple ... | ||
| + | |||
| + | le playbook ansible ci-dessous realise l' | ||
| + | |||
| + | < | ||
| + | [ansnet@ansmnode .ssh]$ cat / | ||
| + | --- | ||
| + | |||
| + | - name: Playbook to show qos queue stats internal cpu policer on Cisco 9K | ||
| + | connection: network_cli | ||
| + | hosts: routeur | ||
| + | remote_user: | ||
| + | gather_facts: | ||
| + | |||
| + | tasks: | ||
| + | - name: Show platform hardware qos queue stats internal cpu policer on Device | ||
| + | ios_command: | ||
| + | commands: | ||
| + | - show platform hardware fed switch active qos queue stats internal cpu policer | ||
| + | vars: | ||
| + | ansible_ssh_user: | ||
| + | ansible_ssh_pass: | ||
| + | ansible_network_os: | ||
| + | # ansible_ssh_private_key_file: | ||
| + | |||
| + | register: config | ||
| + | |||
| + | - name: Save output to output folder | ||
| + | copy: | ||
| + | content: "{{ config.stdout[0] }}" | ||
| + | dest: "/ | ||
| + | </ | ||
| + | |||
| + | reste a parser le ficher txt pour en retirer les valeurs a grapher . | ||
| + | |||
| ==== references URLs ==== | ==== references URLs ==== | ||