Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create set-ip.yml #295

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions set-ip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
- name: showinterface
host: all
gather_facts: no
tasks:
- name: setIpAddressLoopback0Router
iso_l3_interface:
name: loopback 0
ipv4: 10.10.10.10/24
- name: showip
ios_command:
commands:
- show ip int brief
register: show_ip
- debug: var=show_ip.stdout.lines
24 changes: 24 additions & 0 deletions test-cisco-command.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
- hosts: all
gather_facts: no
tasks:
- name: configure provider
set_fact:
provider:
username: cisco
password: cisco
- name: interface IP address
ios_config:
provider: "{{provider}}"
lines:
- ip address 192.168.1.10 255.255.255.0
- no shutdown
- full-duplex
parents: interface Ethernet 0/1
- name: loopback interface
ios_config:
provider: "{{provider}}"
lines:
- ip address 1.1.1.1 255.255.255.255
- no shutdown
parents: interface Loopback0
29 changes: 29 additions & 0 deletions test-show-clock.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
- hosts: ios_devices
gather_facts: no
connection: local

vars_prompt:
- name: "mgmt_username"
prompt: "Username"
private: no
- name: "mgmt_password"
prompt: "Password"

tasks:

- name: SYS | Define provider
set_fact:
provider:
host: "{{ inventory_hostname }}"
username: "{{ mgmt_username }}"
password: "{{ mgmt_password }}"

- name: IOS | Show clock
ios_command:
provider: "{{ provider }}"
commands:
- show clock
register: clock

- debug: msg="{{ clock.stdout }}"