Skip to content

Commit

Permalink
Merge pull request #2229 from IPvSean/devel
Browse files Browse the repository at this point in the history
network workshop is fixed
  • Loading branch information
IPvSean authored Jan 17, 2025
2 parents deee2b5 + 3d52fd7 commit 3deb58c
Show file tree
Hide file tree
Showing 60 changed files with 272 additions and 155 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/jekyll-gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: Deploy Jekyll with GitHub Pages dependencies preinstalled
on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]
branches: ["devel"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand Down
14 changes: 14 additions & 0 deletions assets/css/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -431,4 +431,18 @@ a h3:hover {

#website_explanation {
display: none;
}

code {
background-color: #000000;
padding: 3px;
color: #ffffff;
}

code.language-yaml {
padding: 0;
}

code.language-bash {
padding: 0;
}
11 changes: 7 additions & 4 deletions exercises/ansible_network/1-explore/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ Selecting `2` for `Ansible version and collections` will show us all Ansible Col
Either use Visual Studio Code to open or use the `cat` command to view the contents of the `ansible-navigator.yml` file. The file is located in the home directory:

```bash
$ cat .ansible-navigator.yml
$ cat ~/.ansible-navigator.yml
---
ansible-navigator:
ansible:
Expand Down Expand Up @@ -272,11 +272,14 @@ For example:
```
$ ssh rtr1
Warning: Permanently added 'rtr1,35.175.115.246' (RSA) to the list of known hosts.
```

and use the show version to look at the Cisco IOS version:

```
rtr1#show ver
Cisco IOS XE Software, Version 16.09.02
Cisco IOS XE Software, Version 17.14.01a
Cisco IOS Software [IOSXE], Virtual XE Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 17.14.1a, RELEASE SOFTWARE (fc1)
```

>**Note**
Expand All @@ -285,7 +288,7 @@ Cisco IOS XE Software, Version 16.09.02
## Complete

You have completed lab exercise 1!
You have completed lab exercise 1!

You now understand:

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified exercises/ansible_network/1-explore/images/navigator-ee-menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions exercises/ansible_network/3-facts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ The documentation for the `debug` module is now displayed in you interactive ter

When referring to a non-built in module, there is three important fields:

```
```bash
namespace.collection.module
```
For example:
```
```bash
cisco.ios.facts
```

Expand All @@ -86,7 +86,7 @@ We will be using the facts module in our playbook.

### Step 2 - Creating the play

Ansible Playbooks are [**YAML** files](https://yaml.org/). YAML is a structured encoding format that is also extremely human readable (unlike it's subset - the JSON format)
Ansible Playbooks are <a target="_blank" href="https://yaml.org/">**YAML** files</a>. YAML is a structured encoding format that is also extremely human readable (unlike it's subset - the JSON format)

Create a new file in Visual Studio code:
![vscode new file](images/vscode_new_file.png)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified exercises/ansible_network/3-facts/images/vscode_save_as.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 22 additions & 22 deletions exercises/ansible_network/4-resource-module/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,18 @@ Ansible network resource modules simplify and standardize how you manage differe

Network resource modules provide a consistent experience across different network devices. This means you will get an identical experience across multiple vendors. For example the **VLANs** module will work identically for the following modules:

* `arista.eos.vlans`
* `cisco.ios.vlans`
* `cisco.nxos.vlans`
* `cisco.iosxr.vlans`
* `junipernetworks.junos.vlans`
* `arista.eos.eos_vlans`
* `cisco.ios.ios_vlans`
* `cisco.nxos.nxos_vlans`
* `cisco.iosxr.iosxr_vlans`
* `junipernetworks.junos.junos_vlans`

Configuring [VLANs](https://en.wikipedia.org/wiki/Virtual_LAN) on network devices is an extremely common task, and mis-configurations can cause headaches and outages. VLAN configurations also tend to be identical across multiple network switches resulting in a perfect use case for automation.

This exercise will cover:

* Configuring VLANs on Arista EOS
* Building an Ansible Playbook using the [arista.eos.vlans module](https://docs.ansible.com/ansible/latest/collections/arista/eos/eos_vlans_module.html).
* Building an Ansible Playbook using the [arista.eos.eos_vlans module](https://docs.ansible.com/ansible/latest/collections/arista/eos/eos_vlans_module.html).
* Understanding the `state: merged`
* Understanding the `state: gathered`

Expand All @@ -66,7 +66,7 @@ This exercise will cover:
rtr2#show vlan
VLAN Name Status Ports
----- -------------------------------- --------- -------------------------------
1 default active
1 default active
```

* Use the `show run | s vlan` to examine the VLAN running-confgiuration on the Arista device:
Expand Down Expand Up @@ -181,11 +181,11 @@ As you can see in the output above there is no VLAN configuration outside of the
changed: [rtr2]
PLAY RECAP *********************************************************************
rtr2 : ok=1 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
rtr4 : ok=1 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
rtr2 : ok=1 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
rtr4 : ok=1 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
```

* Re-running the playbook will demonstrate the concept of [idempotency](https://en.wikipedia.org/wiki/Idempotence)
* Re-running the playbook will demonstrate the concept of <a target="_blank" href="https://en.wikipedia.org/wiki/Idempotence">idempotency</a>

```bash
$ ansible-navigator run resource.yml --mode stdout
Expand All @@ -197,7 +197,7 @@ As you can see in the output above there is no VLAN configuration outside of the
ok: [rtr4]
PLAY RECAP *********************************************************************
rtr2 : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
rtr2 : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
rtr4 : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
```

Expand All @@ -221,11 +221,11 @@ As you can see in the output above there is no VLAN configuration outside of the
rtr2#show vlan
VLAN Name Status Ports
----- -------------------------------- --------- -------------------------------
1 default active
20 desktops active
30 servers active
40 printers active
50 DMZ active
1 default active
20 desktops active
30 servers active
40 printers active
50 DMZ active
```

* Use the `show run | s vlan` to examine the VLAN running-confgiuration on the Arista device:
Expand Down Expand Up @@ -275,7 +275,7 @@ As you can see, the resource module configured the Arista EOS network device wit

* The first task is identical except the `state: merged` has been switched to `gathered`, the `config` is no longer needed since we are reading in the configuration (verus applying it to the network device), and we are using the `register` to save the output from the module into a variable named `vlan_config`

* The second task is copying the `vlan_config` variable to a flat-file. The double currly brackets denotes that this is a variable.
* The second task is copying the `vlan_config` variable to a flat-file. The double currly brackets denotes that this is a variable.

* The `| to_nice_yaml` is a [filter](https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html), that will transform the JSON output (default) to YAML.

Expand Down Expand Up @@ -305,8 +305,8 @@ As you can see, the resource module configured the Arista EOS network device wit
changed: [rtr4]
PLAY RECAP *********************************************************************
rtr2 : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
rtr4 : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
rtr2 : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
rtr4 : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
```

### Step 8 - Examine the files
Expand All @@ -322,9 +322,9 @@ As you can see, the resource module configured the Arista EOS network device wit
## Takeaways

* Resource modules have a simple data structure that can be transformed to the network device syntax. In this case the VLAN dictionary is transformed into the Arista EOS network device syntax.
* Resource modules are Idempotent, and can be configured to check device state.
* Resource Modules are bi-directional, meaning that they can gather facts for that specific resource, as well as apply configuration. Even if you are not using resource modules to configure network devices, there is a lot of value for checking resource states.
* The bi-directional behavior also allows brown-field networks (existing networks) to quickly turn their running-configuration into structured data. This allows network engineers to get automation up running more quickly and get quick automation victories.
* Resource modules are **Idempotent**, and can be configured to check device state.
* Resource Modules are bi-directional, meaning that they can gather facts for that specific resource, as well as apply configuration. Even if you are not using resource modules to configure network devices, there is a lot of value for checking resource states.
* The bi-directional behavior also allows **brown-field networks** (existing networks) to quickly turn their running-configuration into structured data. This allows network engineers to get automation up running more quickly and get quick automation victories.

## Solution

Expand Down
Loading

0 comments on commit 3deb58c

Please sign in to comment.