《网络自动化 - 从这里开始.pdf》由会员分享,可在线阅读,更多相关《网络自动化 - 从这里开始.pdf(40页珍藏版)》请在三个皮匠报告上搜索。
1、#CiscoLive#CiscoLiveMel Delgado,Developer AdvocateComputeMelDEVNET-1076Start HereNetwork Automation 2023 Cisco and/or its affiliates.All rights reserved.Cisco PublicRise Above the WorkDEVNET 10763Agenda 2023 Cisco and/or its affiliates.All rights reserved.Cisco PublicIntroductionWhy AutomateAvailabl
2、e ToolsHow to StartConclusionDEVNET 10764 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveHype Cycle for Enterprise Networking 2022“Network automation adoption in the enterprise lags that of server automation,as more than 65%of enterprise networking activities are performe
3、d manually.”DEVNET 10765Why Automate?2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveWhy Automate?Eliminates toilQuickly deploy environments/configurationsDeployments are repeatableInfrastructure components become fungibleYou accomplish more in less timeState is declared i
4、n files and version controlledDEVNET 10767Toil-Noun1.hard and continuous work;exhausting labor or effort2.a laborious task3.Archaic.battle;strife;struggle 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveQuickly Deploy Environments/ConfigurationsLet the machines to the do t
5、he workAutomated deployments/configurations at scale deploy quicklyQuicker than humans in the loopAutomation is reviewable and shareable with peersPeer reviewOthers contributeDEVNET 10769 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveDeployments are RepeatableIdempotentA
6、utomation applied multiple times without changing the resultsDevelop a known stateDEVNET 107610 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveInfrastructure Components Become FungiblePets vs cattleEasily and quickly replace componentsRebuild a server(virtual or physical)
7、Redeploy a network deviceRedeploy application server backendDEVNET 107611 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveState is Declared and Version Controlled Treat your infrastructure as a coding problem to solveAutomation is implemented as codeInfrastructure as code(
8、IaC)The desired state of your environment is written and maintained as codeVersion controlled with GitShared with your team on GitHubDEVNET 107612 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveState is Declared and Version ControlledImperative vs DeclarativeImperative ap
9、proach involves running a series of commands describing how you want the computer/device to do something.Declarative approach describes what the result should be.Not how but what.Written in one or more filesFiles are stored in version control(GitHub)DEVNET 107613 2023 Cisco and/or its affiliates.All
10、 rights reserved.Cisco Public#CiscoLivePeople solve problems.Machines do repetitive workDEVNET 107614Tools 2023 Cisco and/or its affiliates.All rights reserved.Cisco PublicProgramming LanguagesPython#1 in the TIOBE Index for January 2023Easy to learnMany resources availableGo#12 in the TIOBE Index a
11、nd growing in popularityDEVNET 107616 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveProgramming LanguagesProsYou write exactly what you are looking to accomplish and nothing moreIn some cases,it is more performantThere is a large developer talent poolDEVNET 107617 2023 C
12、isco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveProgramming LanguagesConsYou may write many lines of code to accomplish what a configuration management tool could do with a few linesYou may need to write the logic to support:IdempotencyInventory managementSecurity(managing certi
13、ficates,etc)DEVNET 107618 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveConfiguration Management ToolsMake deployments and changes fasterReduces human error(as compared to imperative approach)Makes system/device managementScalablePredictableRepeatableDEVNET 107619 2023 C
14、isco and/or its affiliates.All rights reserved.Cisco Public#CiscoLivePopular Configuration Management ToolsAnsibleAnsibleSuite of software tools enabling infrastructure as codeWritten in PythonAgentlessOpen-sourceTerraformTerraformAn open-source infrastructure-as-code software tool created by HashiC
15、orp.Written in GoManages external resourcesDEVNET 107620How to Start 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveKnowing what to automate is just as important as knowing howDEVNET 107622 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveStart S
16、mall-NetworkingLearn enough about Ansible to:Learn enough about Ansible to:Make an unimpactful changeMake an unimpactful changeApply the change to one deviceApply the change to one devicePhysical network devicePhysical network deviceVirtual network device using CMLVirtual network device using CMLApp
17、ly the same change to more than one deviceApply the same change to more than one deviceDEVNET 107623 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveStart Small-NetworkingConfigurations to considerConfigurations to considerGet a copy of the running configuration and store
18、it as a local fileGet a copy of the running configuration and store it as a local fileAdd NTPAdd NTPAdd a VLANAdd a VLANAdd an MOTDAdd an MOTDDEVNET 107624 2023 Cisco and/or its affiliates.All rights reserved.Cisco PublicAnsibleCopy Running Configtasks:-name:Copy the running configuration to a varia
19、blecli_command:command:show runregister:backuptags:backup-name:Create a file with the running configuration before we get started.copy:content:backup.stdoutdest:inventory_hostname.backupTwo tasksCopy running configuration to a variable named backupCopy the content to a file named after the hostname
20、of the device.backupDEVNET 107625 2023 Cisco and/or its affiliates.All rights reserved.Cisco PublicAnsibleSet NTPtasks:-name:Define provider as required by nxosmodules as part of configuring NTPset_fact:provider:host:nexus_switch username:nexus_username password:nexus_password-name:Add NTP settings
21、to all switchesnxos_ntp:provider:provider server:ntp_server vrf_name:managementsource_int:mgmt0Two tasksDefine a providerAdd the NTP settings to all switches in inventoryDEVNET 107626 2023 Cisco and/or its affiliates.All rights reserved.Cisco Publictasks:-name:Define provider as required by nxos mod
22、ules as part of configuring MOTDset_fact:provider:host:nexus_switch username:nexus_username”password:nexus_password-name:configure the exec bannernxos_banner:provider:provider”banner:motdtext:banner_text”state:presentAnsibleSet MOTDTwo tasksDefine a providerAdd the NTP settings to all switches in in
23、ventoryDEVNET 107627 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public-name:Define provider as required by nxos modulesset_fact:provider:host:nexus_switch username:nexus_username password:nexus_password-name:Ensure vlans exist onboard all switchesnxos_vlan:provider:provider vlan_id:i
24、tem.id name:item.name state:presentwith_items:vlans AnsibleAdd VLANsTwo tasksDefine a providerAdd the NTP settings to all switches in inventoryDEVNET 107628Getting Started Kit 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveStarter KitVisual Studio CodeVisual Studio CodeAn
25、sibleAnsibleNetwork deviceNetwork devicePhysical(start with 1 then add more)Physical(start with 1 then add more)Virtual(CML)Virtual(CML)DEVNET 107630 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveStarter Kit Visual Studio CodeIDE IDE -Integrated Development Integrated De
26、velopment EnvironmentEnvironmentFree downloadFree downloadDEVNET 107631 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveStarter Kit AnsibleOpen SourceOpen SourceDownload for freeDownload for freeDEVWKS 1759DEVWKS 1759Ansible in 45 minutesAnsible in 45 minutesWednesday 1pWe
27、dnesday 1pDevNetDevNet Learning LabsLearning LabsDEVNET 107632 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveStarter Kit CMLAsk your account manager Ask your account manager about optionsabout optionsSimulates Cisco devicesSimulates Cisco devicesUse virtual devices as yo
28、ur Use virtual devices as your endpointendpointAvailable in the Available in the DevnetDevnetSandboxSandboxDEVNET 107633 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveAutomation is more of a mindset than a toolset 2022 Cisco and/or its affiliates.All rights reserved.Cisc
29、o Public#CiscoLiveDEVNET 107634 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveEnter your personal notes hereCisco Webex App Questions?Use Cisco Webex App to chat with the speaker after the sessionFind this session in the Cisco Live Mobile AppClick“Join the Discussion”Ins
30、tall the Webex App or go directly to the Webex spaceEnter messages/questions in the Webex spaceHowWebex spaces will be moderated by the speaker until June 9,2023.123435https:/ 2023 Cisco and/or its affiliates.All rights reserved.Cisco PublicDEVNET 107635 2023 Cisco and/or its affiliates.All rights r
31、eserved.Cisco Public#CiscoLiveFill out your session surveys!Attendees who fill out a minimum of four session surveys and the overall event survey will get Cisco Live-branded socks(while supplies last)!These points help you get on the leaderboard and increase your chances of winning daily and grand p
32、rizesAttendees will also earn 100 points in the Cisco Live Challenge for every survey completed.DEVNET 107636 2023 Cisco and/or its affiliates.All rights reserved.Cisco PublicContinue your educationVisit the Cisco Showcase for related demosBook your one-on-oneMeet the Engineer meetingAttend the inte
33、ractive education with DevNet,Capture the Flag,and Walk-in LabsVisit the On-Demand Library for more sessions at www.CiscoL 107637Thank you#CiscoLive 2023 Cisco and/or its affiliates.All rights reserved.Cisco Public#CiscoLiveGamify your Cisco Live experience!Get points Get points for attending this s
34、ession!for attending this session!Open the Cisco Events App.Click on Cisco Live Challenge in the side menu.Click on View Your Badges at the top.Click the+at the bottom of the screen and scan the QR code:How:123439 2023 Cisco and/or its affiliates.All rights reserved.Cisco PublicDEVNET 107639#CiscoLive