Chapter 6 Network Reconnaissance

For diagrams, tables, or exact code formatting, .

JOHN W. CAPOBIANCOPRINTED PAGE 103

Change / check out the new working branch. Create a new tactical playbook for IOS with the following YAML code: --- - name: IOS Save Running Configurations hosts: CAMPUS gather_facts: no tasks: - ios_command: provider: "{{ ioscli }}" commands: show run register: show_run_output - copy: content="{{ show_run_output }}" dest="./results/{{ inventory_hostname }}_running_config.txt" Save the file in VS Code as “ios_command_running_config.yml”. Commit it to the branch with a similar comment to “ios_command_running_config creation”. Change to the Linux environment. git pull Ensure the right branch is in focus. git checkout Run the new play by changing to the /playbooks/campus/recon/ folder. ansible-playbook ios_command_running_configuration.yml Observe the play: [automateyournetworkj@LINUX HOST]$ ansible-playbook ios_running_config.yml PLAY [IOS Save Running Configurations] *********************************************** TASK [ios_command]******************************************************************** ok: [CORE] ok: [DIST01] ok: [DIST02] ok: [ACCESS01] ok: [ACCESS02] ok: [ACCESS03]

TASK [copy]*************************************************************************** 
changed: [CORE] 
changed: [DIST01] 
changed: [DIST02] 
changed: [ACCESS01]