-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
38 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,35 @@ | ||
# ansible-napalm-samples | ||
GitHub Repo comparing NAPALM and Ansible on Cisco NXOSv | ||
# Ansible and NAPALM Samples | ||
This GitHub Repo focuses on comparing Ansible NAPALM on Cisco NXOS. | ||
|
||
# Example 1 - Adding an IP address to an interface | ||
|
||
## Ansible | ||
|
||
Ansible has a [nxos_config](http://docs.ansible.com/ansible/latest/nxos_config_module.html) specifically used for making config changes (either entire flat-files) or partials (in this case editing a single interface) | ||
``` | ||
- hosts: cisco | ||
connection: local | ||
tasks: | ||
- nxos_config: | ||
lines: | ||
- no switchport | ||
- ip address 172.16.1.1/24 | ||
parents: interface Ethernet1/20 | ||
provider: "{{login_info}}" | ||
``` | ||
|
||
To run a playbook use the `ansible-playbook` command: | ||
|
||
``` | ||
[root@localhost ~]# ansible-playbook ipaddress.yml | ||
PLAY [cisco] ***************************************************************************************************************************************************************************************** | ||
TASK [nxos_config] *********************************************************************************************************************************************************************************** | ||
ok: [n9k] | ||
PLAY RECAP ******************************************************************************************************************************************************************************************* | ||
n9k : ok=1 changed=0 unreachable=0 failed=0 | ||
``` | ||
|
||
# Example 2 - Backing up a Config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
login_info: | ||
username: admin | ||
password: Bullf00d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
--- | ||
- hosts: cisco | ||
gather_facts: False | ||
connection: local | ||
tasks: | ||
- nxos_config: | ||
|