Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---
- #Please be careful with this script, as it is very sensitive to formatting. Please use caution and backup before editing.
- #Script is designed to pull information for a customer on a cisco ios device and send it to a corporate contact via email who can then forward it over
- #DIAGNOSTICS AND GENERAL DEVICE INFORMATION POLL PLAYBOOK
- - hosts: "ec2-54-92-152-183.compute-1.amazonaws.com"
- gather_facts: false
- connection: network_cli
- become: yes
- tasks:
- - name: Information Discovery on Cisco IOS Device
- ios_command:
- commands:
- - "show run"
- - "show license"
- - "show inventory"
- - "show tech-support"
- become: yes
- retries: 10
- interval: 1
- match: any
- register: output_{{X}}
- debug:
- msg: "{{ output_{{X}}.stdout }}"
- verbosity: 3
- - name: "Sending Email via SMTP Server"
- mail:
- subject: Email regarding {{ X }}
- body: Here is the configuration you requested. Please refer to the attachment section of the email.
- username: example@gmail.com
- secure: always
- host: smtp.gmail.com
- password: passwordexample
- port: 587
- to: example@gmail.com
- from: example@gmail.com
- attach: home/myname/desktop/configs/output_{{X}}.txt
- vars:
- X:
- - ec2_instance_inventory
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement