Remove outdated roles

This commit is contained in:
2021-02-21 22:43:06 -05:00
parent a3858223c6
commit 2ab3aa04da
270 changed files with 0 additions and 12658 deletions

View File

@@ -1,41 +0,0 @@
---
- name: Install CloudForms on RHV Cluster
hosts: localhost
gather_facts: no
vars:
engine_fqdn: rhv.mgmt.toal.ca
engine_user: admin@internal
miq_qcow_url: https://cdn.example.com/cfme-rhevm-5.9.1.2-1.x86_64.qcow2
miq_vm_name: cfme_59
miq_vm_cluster: mycluster
miq_vm_cloud_init:
host_name: "{{ miq_vm_name }}"
miq_vm_disks:
database:
name: "{{ miq_vm_name }}_database"
size: 10GiB
interface: virtio_scsi
format: raw
log:
name: "{{ miq_vm_name }}_log"
size: 10GiB
interface: virtio_scsi
format: cow
tmp:
name: "{{ miq_vm_name }}_tmp"
size: 10GiB
interface: virtio_scsi
format: cow
miq_disabled_roles:
- smartstate
miq_enabled_roles:
- notifier
- ems_metrics_coordinator
- ems_metrics_collector
- ems_metrics_processor
- embedded_ansible
roles:
- ovirt.manageiq

View File

@@ -1,113 +0,0 @@
# IDE
.vscode/
# Ansible
*.log
*.retry
*.swp
!*.gitkeep
ansible.cfg
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/

View File

@@ -1,10 +0,0 @@
extends: default
rules:
braces:
max-spaces-inside: 1
level: error
brackets:
max-spaces-inside: 1
level: error
line-length: disable

View File

@@ -1,120 +0,0 @@
=========================
Ansible Network cisco_ios
=========================
.. _cisco_ios_v2.7.1:
v2.7.1
======
.. _cisco_ios_v2.7.1_Minor Changes:
Minor Changes
-------------
- Adds parser for reload reason. `ios-#87 <https://github.com/ansible-network/cisco_ios/pull/87>`_.
- Fixed message ``missing required arg: config_manager_text``. `ios-#88 <https://github.com/ansible-network/cisco_ios/pull/88>`_.
- Remove set defaults task files. `ios-#89 <https://github.com/ansible-network/cisco_ios/pull/89>`_.
- Use default template if no specific peer provider folder is present. `ios-#90 <https://github.com/ansible-network/cisco_ios/pull/90>`_.
- Add unconfigure task hooks. `ios-#92 <https://github.com/ansible-network/cisco_ios/pull/92>`_.
.. _cisco_ios_v2.7.0:
v2.7.0
======
.. _cisco_ios_v2.7.0_Major Changes:
Major Changes
-------------
- Initial release of 2.7.0 ``cisco_ios`` Ansible role that is supported with Ansible 2.7.0
- Dependant role ``ansible-network.network-engine`` should be upgraded with version >= 2.7.2
.. _cisco_ios_v2.7.0_Bugfixes:
Bugfixes
--------
- multiline banner processing (cli_config issue) (#69)
- Ensure that subset is a list. Align docs with fact map (#47)
- Created test for show_interfaces parser (#58)
- fix for 'interfaces' facts (#55)
- fix for handling config text with lines containing only whitespace chars (#64)
.. _cisco_ios_v2.6.3:
v2.6.3
======
.. _cisco_ios_v2.6.3_New Features
New Features
------------
- NEW provider tasks and parsers for net_operations role
.. _cisco_ios_v2.6.3_Bugfixes:
Bugfixes
--------
- configure_user task should use config_manager_file instead of config_manager_text
- uptime facts from cisco IOS has separate keys for year, week, days hours and time
.. _cisco_ios_v2.6.2:
v2.6.2
======
.. _cisco_ios_v2.6.2_New Features
New Features
------------
- NEW Added CPF and Fiber Optic DOM parser
- NEW Added dependency role plugin check
.. _cisco_ios_v2.6.1:
v2.6.1
======
.. _cisco_ios_v2.6.1_New Action Plugins:
New Action Plugins
------------------
- NEW ``ios_user_manager`` action plugin
.. _cisco_ios_v2.6.1_New Tasks:
New Tasks
---------
- NEW ``configure_user`` task
.. _cisco_ios_v2.6.1_Bugfixes:
Bugfixes
--------
- Refactor vrf and bgp output and improve reliability (#29)
- better support for working with config_manager tasks
devel
=====
New Functions
-------------
- NEW `get_facts` retrive and parse facts from cisco ios devices
- NEW `config_manager/get` support for config_manager get function
- NEW `config_manager/load` support for config_manager load function
- NEW `config_manager/save` support for config_manager save function
- NEW `configure_user` support for configuring users on cisco ios devices
Major Changes
-------------
- Initial release of the `cisco_ios` role.

View File

@@ -1,674 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
{one line to give the program's name and a brief idea of what it does.}
Copyright (C) {year} {name of author}
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
{project} Copyright (C) {year} {fullname}
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

View File

@@ -1,37 +0,0 @@
# cisco_ios
This Ansible Network role provides a set of platform dependent fuctions that
are designed to work with Cisco IOS network devices. The functions included
int his role inlcuding both configuration and fact collection.
## Requirements
* Ansible 2.6 or later
* Ansible Network Engine Role 2.6.0 or later
## Functions
This section provides a list of the availabe functions that are including
in this role. Any of the provided functions can be implemented in Ansible
playbooks to perform automation activities on Cisco IOS devices.
Please see the documentation link for each function for details on how to use
the function in an Ansible playbook.
* get_facts [[source]](https://github.com/ansible-network/cisco_ios/blob/devel/tasks/get_facts.yaml) [[docs]](https://github.com/ansible-network/cisco_ios/blob/devel/docs/get_facts.md)
### Config Manager
* config_manager/get [[source]](https://github.com/ansible-network/cisco_ios/blob/devel/tasks/config_manager/get.yaml) [[docs]](https://github.com/ansible-network/cisco_ios/blob/devel/docs/config_manager/get.md)
* config_manager/load [[source]](https://github.com/ansible-network/cisco_ios/blob/devel/tasks/config_manager/load.yaml) [[docs]](https://github.com/ansible-network/cisco_ios/blob/devel/docs/config_manager/load.md)
### Cloud VPN
* cloud_vpn/configure_vpn_initiator [[source]](https://github.com/ansible-network/cisco_ios/blob/devel/tasks/cloud_vpn/configure_vpn_initiator.yaml) [[docs]](https://github.com/ansible-network/cisco_ios/blob/devel/docs/cloud_vpn/configure_vpn_initiator.md)
* cloud_vpn/configure_routing_initiator [[source]](https://github.com/ansible-network/cisco_ios/blob/devel/tasks/cloud_vpn/configure_routing_initiator.yaml) [[docs]](https://github.com/ansible-network/cisco_ios/blob/devel/docs/cloud_vpn/configure_routing_initiator.md)
## License
GPLv3
## Author Information
Ansible Network Community

View File

@@ -1,137 +0,0 @@
# (c) 2018, Ansible by Red Hat, inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
#
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'network'}
DOCUMENTATION = """
---
module: extract_banners
author: Ansible Network Team
short_description: remove banners from config text
description:
- The config text specified in C(config) will be used to extract banners
from it. Banners need to be executed on device in special manner. It
returns configs with banner removed and a dictionary of banners
version_added: "2.7"
options:
config:
description:
- Config text from which banners need to be extracted.
required: yes
default: null
"""
EXAMPLES = """
- name: extract multiline banners
extract_banners:
config: "{{ ios_config_text }}"
"""
RETURN = """
config:
description: returns the config with masked banners
returned: always
type: str
banners:
description: returns the extracted banners
returned: always
type: dict
"""
import re
from ansible.plugins.action import ActionBase
from ansible.module_utils._text import to_text
from ansible.errors import AnsibleError
try:
from __main__ import display
except ImportError:
from ansible.utils.display import Display
display = Display()
class ActionModule(ActionBase):
def run(self, tmp=None, task_vars=None):
''' handler for extract_banners '''
if task_vars is None:
task_vars = dict()
result = super(ActionModule, self).run(tmp, task_vars)
del tmp # tmp no longer has any effect
try:
config = self._task.args['config']
except KeyError as exc:
raise AnsibleError(to_text(exc))
# make config required argument
if not config:
raise AnsibleError('missing required argument `config`')
banners, masked_config = self._extract_banners(config)
result['config'] = masked_config
result['banners'] = banners
return result
def _extract_banners(self, config):
config_lines = config.split('\n')
found_banner_start = 0
banner_meta = []
for linenum, line in enumerate(config_lines):
if not found_banner_start:
banner_start = re.search(r'^banner\s+(\w+)\s+(.*)', line)
if banner_start:
banner_cmd = banner_start.group(1)
try:
banner_delimiter = banner_start.group(2)
banner_delimiter = banner_delimiter.strip()
banner_delimiter_esc = re.escape(banner_delimiter)
except Exception:
continue
banner_start_index = linenum
found_banner_start = 1
continue
if found_banner_start:
# Search for delimiter found in current banner start
regex = r'%s' % banner_delimiter_esc
banner_end = re.search(regex, line)
if banner_end:
found_banner_start = 0
kwargs = {
'banner_cmd': banner_cmd,
'banner_delimiter': banner_delimiter,
'banner_start_index': banner_start_index,
'banner_end_index': linenum,
}
banner_meta.append(kwargs)
# Build banners from extracted data
banner_lines = []
for banner in banner_meta:
banner_lines.append('banner %s %s' % (banner['banner_cmd'],
banner['banner_delimiter']))
banner_conf_lines = config_lines[banner['banner_start_index'] + 1: banner['banner_end_index']]
for index, conf_line in enumerate(banner_conf_lines):
banner_lines.append(conf_line)
banner_lines.append('%s' % banner['banner_delimiter'])
# Delete banner lines from config
for banner in banner_meta:
banner_lines_range = range(banner['banner_start_index'],
banner['banner_end_index'] + 1)
for index in banner_lines_range:
config_lines[index] = '! banner removed'
configs = '\n'.join(config_lines)
return (banner_lines, configs)

View File

@@ -1,111 +0,0 @@
# (c) 2018, Ansible by Red Hat, inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
#
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'network'}
import re
import base64
import hashlib
from ansible.plugins.action import ActionBase
class UserManager:
def __init__(self, new_users, user_config_data):
self.__new_users = new_users
self.__user_config_data = user_config_data
@staticmethod
def calculate_fingerprint(sshkey):
if ' ' in sshkey:
keyparts = sshkey.split(' ')
keyparts[1] = hashlib.md5(base64.b64decode(keyparts[1])).hexdigest().upper()
return ' '.join(keyparts)
else:
return 'ssh-rsa %s' % hashlib.md5(base64.b64decode(sshkey)).hexdigest().upper()
def _parse_view(self, data):
match = re.search(r'view (\S+)', data, re.M)
if match:
return match.group(1)
def _parse_sshkey(self, data):
match = re.search(r'key-hash (\S+ \S+(?: .+)?)$', data, re.M)
if match:
return match.group(1)
def _parse_privilege(self, data):
match = re.search(r'privilege (\S+)', data, re.M)
if match:
return int(match.group(1))
def generate_existing_users(self):
match = re.findall(r'(?:^(?:u|\s{2}u))sername (\S+)', self.__user_config_data, re.M)
if not match:
return []
existing_users = []
for user in set(match):
regex = r'username %s .+$' % user
cfg = re.findall(regex, self.__user_config_data, re.M)
cfg = '\n'.join(cfg)
sshregex = r'username %s\n\s+key-hash .+$' % user
sshcfg = re.findall(sshregex, self.__user_config_data, re.M)
sshcfg = '\n'.join(sshcfg)
obj = {
'name': user,
'sshkey': self._parse_sshkey(sshcfg),
'privilege': self._parse_privilege(cfg),
'view': self._parse_view(cfg)
}
filtered = {k: v for k, v in obj.items() if v is not None}
obj.clear()
obj.update(filtered)
existing_users.append(obj)
return existing_users
def filter_users(self):
want = self.__new_users
for user in want:
if 'sshkey' in user:
user['sshkey'] = self.calculate_fingerprint(user['sshkey'])
have = self.generate_existing_users()
filtered_users = [x for x in want if x not in have]
changed = True if len(filtered_users) > 0 else False
return changed, filtered_users
class ActionModule(ActionBase):
def run(self, tmp=None, task_vars=None):
if task_vars is None:
task_vars = dict()
result = super(ActionModule, self).run(tmp, task_vars)
try:
new_users = self._task.args['new_users']
user_config_data = self._task.args['user_config']
except KeyError as exc:
return {'failed': True, 'msg': 'missing required argument: %s' % exc}
result['changed'], result['stdout'] = UserManager(new_users, user_config_data).filter_users()
return result

View File

@@ -1,262 +0,0 @@
# (c) 2018, Ansible Inc,
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import copy
import os
import time
import re
import hashlib
import netaddr
import json
import socket
from ansible.module_utils._text import to_bytes, to_text
from ansible.module_utils.connection import Connection
from ansible.errors import AnsibleError
from ansible.plugins.action import ActionBase
from ansible.module_utils.six.moves.urllib.parse import urlsplit
from ansible.utils.path import unfrackpath
try:
from __main__ import display
except ImportError:
from ansible.utils.display import Display
display = Display()
class ActionModule(ActionBase):
def run(self, tmp=None, task_vars=None):
result = super(ActionModule, self).run(task_vars=task_vars)
try:
show_acl_output_buffer = self._task.args.get('show_acl_output_buffer')
except KeyError as exc:
return {'failed': True, 'msg': 'missing required argument: %s' % exc}
try:
parser = self._task.args.get('parser')
except KeyError as exc:
return {'failed': True, 'msg': 'missing required argument: %s' % exc}
try:
generated_flow_file = self._task.args.get('generated_flow_file')
except KeyError as exc:
return {'failed': True, 'msg': 'missing required argument: %s' % exc}
generated_flow_file = unfrackpath(generated_flow_file)
dest = generated_flow_file
parser = unfrackpath(parser)
if not os.path.exists(parser):
return {'failed': True, 'msg': 'path: %s does not exist.' % parser}
parser_file = parser
pd_json = self._parse_acl_with_textfsm(
parser_file, show_acl_output_buffer)
try:
changed = self._write_packet_dict(dest, pd_json)
except IOError as exc:
result['failed'] = True
result['msg'] = ('Exception received : %s' % exc)
result['changed'] = changed
if changed:
result['destination'] = dest
else:
result['dest_unchanged'] = dest
return result
def _create_packet_dict(self, cmd_out):
import warnings
with warnings.catch_warnings(record=True):
warnings.simplefilter("always")
from trigger.acl import parse
import netaddr
import json
import uuid
# pd is list of dictionary of packets
pd = []
lines = cmd_out.split('\n')
for index, line in enumerate(lines):
line = to_bytes(line, errors='surrogate_or_strict')
pd_it = {}
try:
p = parse(line)
except Exception:
continue
if p.terms:
match = p.terms[0].match
for key in match:
if key == 'source-address':
for m in match["source-address"]:
v = netaddr.IPNetwork(str(m))
# Return the host in middle of subnet
size_subnet = v.size
host_index = int(size_subnet / 2)
pd_it["src"] = str(v[host_index])
if key == 'destination-address':
for m in match["destination-address"]:
v = netaddr.IPNetwork(str(m))
# Return the host in middle of subnet
size_subnet = v.size
host_index = int(size_subnet / 2)
pd_it["dst"] = str(v[host_index])
if key == 'protocol':
for m in match['protocol']:
pd_it["proto"] = str(m)
if key == 'destination-port':
for m in match["destination-port"]:
pd_it['dst_port'] = str(m)
if key == 'source-port':
for m in match["source-port"]:
pd_it['src_port'] = str(m)
action = p.terms[0].action
for act in action:
pd_it["action"] = act
if pd_it is not None:
if "dst" not in pd_it:
pd_it["dst"] = "any"
if "src" not in pd_it:
pd_it["src"] = "any"
pd_it["service_line_index"] = str(index)
pd.append(pd_it)
return json.dumps(pd, indent=4)
def _write_packet_dict(self, dest, contents):
# Check for Idempotency
if os.path.exists(dest):
try:
with open(dest, 'r') as f:
old_content = f.read()
except IOError as ioexc:
raise IOError(ioexc)
sha1 = hashlib.sha1()
old_content_b = to_bytes(old_content, errors='surrogate_or_strict')
sha1.update(old_content_b)
checksum_old = sha1.digest()
sha1 = hashlib.sha1()
new_content_b = to_bytes(contents, errors='surrogate_or_strict')
sha1.update(new_content_b)
checksum_new = sha1.digest()
if checksum_old == checksum_new:
return (False)
try:
with open(dest, 'w') as f:
f.write(contents)
except IOError as ioexc:
raise IOError(ioexc)
return (True)
def _parse_acl_with_textfsm(self, parser_file, output):
import textfsm
tmp = open(parser_file)
re_table = textfsm.TextFSM(tmp)
results = re_table.ParseText(output)
fsm_results = []
for item in results:
facts = {}
facts.update(dict(zip(re_table.header, item)))
fsm_results.append(facts)
pd = []
parsed_acl = []
# Convert dictionary of terms into flows dictionary
for term in fsm_results:
pd_it = {}
original_terms = {}
for k, v in term.items():
if k == 'LINE_NUM' and v == '':
# Empty line with just name
continue
elif k == 'LINE_NUM' and v != '':
pd_it["service_line_index"] = v
original_terms["service_line_index"] = v
if k == 'PROTOCOL' and v != '':
pd_it["proto"] = v
original_terms['proto'] = v
if k == 'ACTION' and v != '':
pd_it["action"] = v
original_terms['action'] = v
if k == 'SRC_NETWORK' and v != '':
if 'SRC_WILDCARD' in term:
src_mask = term['SRC_WILDCARD']
src_invert_mask = sum([bin(255 - int(x)).count("1") for x in
src_mask.split(".")])
else:
src_invert_mask = '32'
cidr = "%s/%s" % (v, src_invert_mask)
src_ip = netaddr.IPNetwork(cidr)
size_subnet = src_ip.size
host_index = int(size_subnet / 2)
pd_it['src'] = str(src_ip[host_index])
original_terms['src'] = src_ip
if k == 'SRC_ANY' and v != '':
pd_it['src'] = "any"
original_terms['src'] = netaddr.IPNetwork('0.0.0.0/0')
if k == 'SRC_HOST' and v != '':
pd_it['src'] = v
original_terms['src'] = v
if k == 'SRC_PORT' and v != '':
if not v[0].isdigit():
v = str(socket.getservbyname(v))
pd_it['src_port'] = v
original_terms['src_port'] = v
if k == 'DST_NETWORK' and v != '':
if 'DST_WILDCARD' in term:
dst_mask = term['DST_WILDCARD']
dst_invert_mask = sum([bin(255 - int(x)).count("1") for x in
dst_mask.split(".")])
else:
dst_invert_mask = '32'
d_cidr = "%s/%s" % (v, dst_invert_mask)
dst_ip = netaddr.IPNetwork(d_cidr)
d_size_subnet = dst_ip.size
d_host_index = int(d_size_subnet / 2)
pd_it['dst'] = str(dst_ip[d_host_index])
original_terms['dst'] = dst_ip
if k == 'DST_ANY' and v != '':
pd_it['dst'] = "any"
original_terms['dst'] = netaddr.IPNetwork('0.0.0.0/0')
if k == 'DST_HOST' and v != '':
pd_it['dst'] = v
original_terms['dst'] = v
if k == 'DST_PORT' and v != '':
if not v[0].isdigit():
v = str(socket.getservbyname(v))
pd_it['dst_port'] = v
original_terms['dst_port'] = v
if pd_it:
pd.append(pd_it)
if original_terms:
parsed_acl.append(original_terms)
# Store parsed acl on this object for later processing
self._parsed_acl = parsed_acl
return json.dumps(pd, indent=4)

View File

@@ -1,7 +0,0 @@
# This is a cross-platform list tracking distribution packages needed by tests;
# see http://docs.openstack.org/infra/bindep/ for additional information.
gcc-c++ [test platform:rpm]
python3-devel [test platform:rpm]
python3 [test platform:rpm]
python36 [test !platform:fedora-28]

View File

@@ -1,5 +0,0 @@
---
cloud_vpn_initiator_user: ec2-user
cloud_vpn_initiator_ansible_connection: network_cli
cloud_vpn_initiator_outside_interface: GigabitEthernet1

View File

@@ -1,15 +0,0 @@
---
# defaults file for ansible-network.cisco_ios
#
ios_config_rollback_enabled: true
ios_config_use_terminal: true
ios_config_remove_temp_files: "{{ remove_temp_files | default(True) }}"
ios_config_replace: "{{ config_manager_replace | default(False) }}"
ios_config_source:
running: show running-config
startup: show startup-config
ios_get_facts_command_map: "{{ role_path }}/vars/get_facts_command_map.yaml"
ios_get_facts_subset: "{{ subset | default(['default']) }}"
ios_dependent_role_check: true

View File

@@ -1,24 +0,0 @@
# Configure VPN routing as initiator
The `cloud_vpn/configure_routing_initiator` function will configure the routing where
a VPN as initiator has been configured previously on Cisco IOS devices.
It is performed by calling the `cloud_vpn/configure_routing_initiator` task from the role.
The task will process variables needed for routing configuration and apply it to the device.
Below is an example to configure routing on a CSR device configured as initiator,
where the responder is AWS VPN.
```
- hosts: cisco_ios
tasks:
- name: Configure initiator routing
include_role:
name: ansible-network.cisco_ios
tasks_from: cloud_vpn/configure_routing_initiator
vars:
cloud_vpn_responder_provider: aws_vpn
cloud_vpn_responder_cidr: 192.168.0.0/24
```
## Notes
None

View File

@@ -1,33 +0,0 @@
# Configure VPN as initiator
The `cloud_vpn/configure_vpn_initiator` function will configure IPSEC VPN as initiator
on Cisco IOS devices.
It is performed by calling the `cloud_vpn/configure_vpn_initiator` task from the role.
The task will process variables needed for VPN configuration and apply it to the device.
Below is an example to configure an IPSEC VPN as initiator on CSR device, where
the responder is AWS VPN:
```
- hosts: cisco_ios
tasks:
- name: Configure IPSEC VPN as initiator
include_role:
name: ansible-network.cisco_ios
tasks_from: cloud_vpn/configure_vpn_initiator
vars:
cloud_vpn_name: myvpn
cloud_vpn_psk: mypsksecret
cloud_vpn_initiator_provider: csr
cloud_vpn_initiator_outside_interface: GigabitEthernet1
cloud_vpn_initiator_tunnel_ip: 169.254.56.25
cloud_vpn_initiator_tunnel_failover_ip: 169.254.56.29
cloud_vpn_responder_provider: aws_vpn
cloud_vpn_responder_public_ip: 18.191.132.220
cloud_vpn_responder_failover_ip: 18.191.132.221
cloud_vpn_responder_tunnel_ip: 169.254.56.26
cloud_vpn_responder_tunnel_failover_ip: 169.254.56.30
```
## Notes
None

View File

@@ -1,78 +0,0 @@
# Get configuration from device
The `config_manager/get` function will return the either the current active or current
saved configuration from an Cisco IOS devices. This function is only
supported over `network_cli` connections.
The `config_manager/get` function will also parse the device active configuration into
a set of host facts during its execution. All of the parsed facts are stored
in the ``cisco_ios.config`` top level facts key.
## How to get the device configuration
Retrieving the configuration from the device involves just calling the
`config_manager/get` function from the role. By default, the `config_manager/get` role will
return the device active (running) configuraiton. The text configuration will
be returned as a fact for the host. The configuration text is stored in the
`configuration` fact.
Below is an example of calling the `config_manager/get` function from the playbook.
```
- hosts: cisco_ios
roles:
- name ansible-network.cisco_ios
function: config_manager/get
```
The above playbook will return the current running config from each host listed
in the `cisco_ios` group in inventory.
### Get the current startup config
By default the `config_manager/get` function will return the device running
configuration. If you want to retrieve the device startup configuration, set
the value of `source` to `startup`.
```
- hosts: cisco_ios
roles:
- name ansible-network.cisco_ios
function: config_manager/get
source: startup
```
### Implement using tasks
The `config_manager/get` function can also be implemented in the `tasks` during the
playbook run using either the `include_role` or `import_role` modules as shown
below.
```
- hosts: cisco_ios
tasks:
- name: collect facts from cisco ios devices
include_role:
name: ansible-network.cisco_ios
tasks_from: config_manager/get
```
## How to add additional parsers
The configuration facts are returned by this function are parsed using the
parsers in the `parser_templates/config` folder. To add a new parser, simply
create a PR and add the new parser to the folder. Once merged, the
`config_manager/get` function will automatically use the new parser.
## Arguments
### source
Defines the configuration source to return from the device. This argument
accepts one of `running` or `startup`. When the value is set to `running`
(default), the current active configuration is returned. When the value is set
to `sartup`, the device saved configuration is returned.
The default value is `running`
## Notes
None

View File

@@ -1,86 +0,0 @@
# Load configuration onto device
The `config_manager/load` function will take a Cisco IOS configuration file and load it
onto the device. This function supports either merging the configuration with
the current active configuration or replacing the current active configuration
with the provided configuration file.
The `config_manager/load` function will return the full configuration diff in the
`ios_diff` fact.
NOTE: When performing a configuration replace function be sure to specify the
entire configuration to be loaded otherwise you could end up not being able to
reconnect to your IOS device after the configuration has been loaded.
## How to load and merge a configuration
Loading and merging a configuration file is the default operation for the
`config_manager/load` function. It will take the contents of a Cisco IOS configuration
file and merge it with the current device active configurations.
Below is an example of calling the `config_manager/load` function from the playbook.
```
- hosts: cisco_ios
roles:
- name ansible_network.cisco_ios
function: config_manager/load
config_manager_text: "{{ lookup('file', 'ios.cfg') }}"
```
The above playbook will load the specified configuration file onto each device
in the `cisco_ios` host group.
## How to replace the current active configuration
The `config_manager/load` function also supports replacing the current active
configuration with the configuration file located on the Ansible controller.
In order to replace the device's active configuration, set the value of the
`config_manager_replace` setting to `True`.
```
- hosts: cisco_ios
roles:
- name ansible_network.cisco_ios
function: config_manager/load
config_manager_text: "{{ lookup('file', 'ios.cfg') }}"
config_manager_replace: true
```
## Arguments
### config_manager_text
This value accepts the text form of the configuration to be loaded on to the remote device.
The configuration file should be the native set of commands used to configure the remote device.
The default value is `null`
### config_manager_replace
Specifies whether or not the source configuration should replace the current
active configuration on the target IOS device. When this value is set to
False, the source configuration is merged with the active configuration. When
this value is set to True, the source configuration will replace the current
active configuration
The default value is `False`
### ios_config_remove_temp_files
Configures the function to remove or not remove the temp files created when
preparing to load the configuration file. There are two locations for temp
files, one on the Ansible controller and one on the device. This argument
accepts a boolean value.
The default value is `True`
### ios_config_rollback_enabled
Configures whether or not automatic rollback is enabled during the execution of
the function. When enabled, if an error is enountered, then the configuration
is automatically returned to the original running-config. If disabled, then
the rollback operation is not performed automatically.
The default value is `True`

View File

@@ -1,166 +0,0 @@
# Get facts from device
The `get_facts` function can be used to collect facts from an Cisco IOS
devices. This function is only supported over `network_cli` connection
type and requires the `ansible_network_os` value set to `ios`.
## How to get facts from the device
To collect facts from the device, simply include this function in the playbook
using either the `roles` directive or the `tasks` directive. If no other
options are provided, then all of the available facts will be collected for the
device.
Below is an example of how to use the `roles` directive to collect all facts
from the IOS device.
```
- hosts: cisco_ios
roles:
- name ansible-network.cisco_ios
function: get_facts
```
The above playbook will return the facts for the host under the `cisco_ios`
top level key.
### Filter the subset of facts returned
By default all available facts will be returned by the `get_facts` function.
If you only want to return a subset of the facts, you can specify the `subset`
variable as a list of keys to return.
For instance, the below will return only `interfaces` and `system` facts.
```
- hosts: cisco_ios
roles:
- name ansible-network.cisco_ios
function: get_facts
subset:
- system
```
### Implement using tasks
The `get_facts` function can also be implemented using the `tasks` directive
instead of the `roles` directive. By using the `tasks` directive, you can
control when the fact collection is run.
Below is an example of how to use the `get_facts` function with `tasks`.
```
- hosts: cisco_ios
tasks:
- name: collect facts from cisco ios devices
import_role:
name: ansible-network.cisco_ios
tasks_from: get_facts
vars:
subset:
- system
- interfaces
```
## Adding new parsers
Over time new parsers can be added (or updated) to the role to add additional
or enhanced functionality. To add or update parsers perform the following
steps:
* Add (or update) command parser located ino `parse_templates/cli`
* Update the `vars/get_facts_command_map.yaml` file to map the CLI command
to the parser
The `get_facts_command_map.yaml` file provides a mapping between CLI command
and parser used to transform the output into Ansible facts.
### Understanding the mapping file
The command map file provides the mapping between show command and parser file.
The format of the file is a list of objects. Each object supports a set of
keys that can be configured to provide granular control over how each command
is implemented.
Command map entries support the following keys:
#### command
The `command` key is required and specifies the actual CLI command to execute
on the target device. The output from the command is then passed to the parser
for further processing.
#### parser
The `parser` key provides the name of the parser used to accept the output from
the command. The parser value shoule be the command parser filename either
relative to `parser_templates/cli` or absolute path. This value is required.
#### engine
This key accepts one of two values, either `command_parser` or `textfsm_parser`.
This value instructs the the parsing function as to which parsing engine to
use to parse the output from the CLI command.
This key is not required and, if not provided, the engine will assumed to be
`command_parser`
#### groups
Commands can be contained in one (or more) groups to make it easy for playbook
designers to filter specific facts to retreive from the network device. The
`groups` key must be a list and contain the groups the this command should be
associated with.
#### pre_hook
The `pre_hook` key provides the path to the set of tasks to include prior
to running the command on the CLI. This is useful if there is a need to check
if a command is available or supported on a particular version.
#### post_hook
The `post_hook` key provides the path to the set of tasks to include after the
command has been run on the target device and its results have been parsed by
the parser.
## Arguments
### ios_get_facts_subset
Defines the subset of facts to collection when the `get_facts` function is
called. This value must be a list value and contain only the sub keys for the
facts you wish to return.
The default value is `default`
#### Aliases
* subset
#### Current supported values for subset are
* default
* all
* interfaces
* bgp
* lldp
### ios_get_facts_command_map
Defines the command / parser mapping file to use when the call to `get_facts`
is made by the playbook. Normally this value does not need to be modified but
can be used to pass a custom command map to the function.
The default value is `vars/get_facts_command_map.yaml`
## Notes
None

View File

@@ -1,35 +0,0 @@
#
# (c) 2018 Red Hat, Inc.
#
# Copyright (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import re
INTERFACE_NAMES = {
'Gi': 'GigabitEthernet',
}
def expand_interface_name(name):
match = re.match('([a-zA-Z]*)', name)
if match and match.group(1) in INTERFACE_NAMES:
matched = match.group(1)
name = name.replace(matched, INTERFACE_NAMES[matched])
return name
class FilterModule(object):
"""Filters for working with output from network devices"""
filter_map = {
'expand_interface_name': expand_interface_name
}
def filters(self):
return self.filter_map

View File

@@ -1,2 +0,0 @@
---
# handlers file for ansible-network.cisco_ios

View File

@@ -1,13 +0,0 @@
---
# Playbook to ingest config manager args into ios provider specific args
#
- name: convert config_manager_text
set_fact:
ios_config_text: "{{ config_manager_text }}"
when: config_manager_text is defined
- name: convert config_manager_file
set_fact:
ios_config_file: "{{ config_manager_file }}"
when: config_manager_file is defined

View File

@@ -1,26 +0,0 @@
---
- name: validate ios_checkpoint_filename is defined
fail:
msg: "missing required var: ios_checkpoint_filename"
when: ios_checkpoint_filename is undefined
- name: get current files on disk
cli:
command: dir
register: ios_dir_listing
- name: remove old checkpoint file (if necessary)
cli:
command: "delete /force flash:/{{ ios_checkpoint_filename }}"
when: ios_checkpoint_filename in ios_dir_listing.stdout
# copy the current running-config to the local flash disk on the target device.
# This will be used both for restoring the current config if a failure happens
# as well as performing a configuration diff once the new config has been
# loaded.
- name: create a checkpoint of the current running-config
ios_command:
commands:
- command: "copy running-config flash:{{ ios_checkpoint_filename }}"
prompt: ["\\? "]
answer: "{{ ios_checkpoint_filename }}"

View File

@@ -1,15 +0,0 @@
---
- name: validate ios_checkpoint_filename is defined
fail:
msg: "missing required var: ios_checkpoint_filename"
when: ios_checkpoint_filename is undefined
- name: get current files on disk
cli:
command: dir
register: ios_dir_listing
- name: remove checkpoint file from remote device
cli:
command: "delete /force flash:/{{ ios_checkpoint_filename }}"
when: ios_checkpoint_filename in ios_dir_listing.stdout

View File

@@ -1,32 +0,0 @@
---
- name: validate ios_checkpoint_filename is defined
fail:
msg: "missing required var: ios_checkpoint_filename"
when: ios_checkpoint_filename is undefined
- name: get current files on disk
cli:
command: dir
register: ios_dir_listing
- name: verify checkpoint file exists
fail:
msg: "missing checkpoint file {{ ios_checkpoing_filename }}"
when: ios_checkpoint_filename not in ios_dir_listing.stdout
- name: checkpoint configuration restore pre hook
include_tasks: "{{ ios_checkpoint_restore_pre_hook }}"
when: ios_checkpoint_restore_pre_hook is defined
- name: restore checkpoint configuration
cli:
command: "config replace flash:/{{ ios_checkpoint_filename }} force"
register: ios_rollback_results
- name: checkpoint configuration restore post hook
include_tasks: "{{ ios_checkpoint_restore_post_hook }}"
when: ios_checkpoint_restore_post_hook is defined
- name: remove checkpoint file from remote device
cli:
command: "delete /force flash:/{{ ios_checkpoint_filename }}"

View File

@@ -1,59 +0,0 @@
---
- name: validate ios_config_text is defined
fail:
msg: "missing required arg: ios_config_text"
when: ios_config_text is undefined
- name: set the ios_config_temp_file name
set_fact:
ios_config_temp_file: "tmp_ansible"
- name: create temp working dir
tempfile:
state: directory
register: ios_config_temp_dir
- name: write the config text to disk
copy:
content: "{{ ios_config_text }}"
dest: "{{ ios_config_temp_dir.path }}/{{ ios_config_temp_file }}"
- name: get current list of files on remote device
cli:
command: dir
register: ios_dir_listing
- name: remove temporary files from target device
cli:
command: "delete /force flash:/{{ ios_config_temp_file }}"
when: ios_config_temp_file in ios_dir_listing.stdout
- name: enable the ios scp server
cli:
command: "{{ line }}"
loop:
- configure terminal
- ip scp server enable
- end
loop_control:
loop_var: line
- name: copy configuration to device
net_put:
src: "{{ ios_config_temp_dir.path }}/{{ ios_config_temp_file }}"
dest: "flash:/{{ ios_config_temp_file }}"
changed_when: false
- name: merge with current active configuration
cli:
command: "{{ line }}"
loop:
- "copy flash:/{{ ios_config_temp_file }} force"
- "delete /force flash:/{{ ios_config_temp_file }}"
loop_control:
loop_var: line
- name: remove local temp working dir
file:
path: "{{ ios_config_temp_dir.path }}"
state: absent

View File

@@ -1,59 +0,0 @@
---
- name: validate ios_config_text is defined
fail:
msg: "missing required arg: ios_config_text"
when: ios_config_text is undefined
- name: set the ios_config_temp_file name
set_fact:
ios_config_temp_file: "tmp_ansible"
- name: create temp working dir
tempfile:
state: directory
register: ios_config_temp_dir
- name: write the config text to disk
copy:
content: "{{ ios_config_text }}"
dest: "{{ ios_config_temp_dir.path }}/{{ ios_config_temp_file }}"
- name: get current list of files on remote device
cli:
command: dir
register: ios_dir_listing
- name: remove temporary files from target device
cli:
command: "delete /force flash:/{{ ios_config_temp_file }}"
when: ios_config_temp_file in ios_dir_listing.stdout and ios_config_remove_temp_files
- name: enable the ios scp server
cli:
command: "{{ line }}"
loop:
- configure terminal
- ip scp server enable
- end
loop_control:
loop_var: line
- name: copy configuration to device
net_put:
src: "{{ ios_config_temp_dir.path }}/{{ ios_config_temp_file }}"
dest: "flash:/{{ ios_config_temp_file }}"
changed_when: false
- name: replace current active configuration
cli:
command: "{{ line }}"
loop:
- "config replace flash:/{{ ios_config_temp_file }} force"
- "delete /force flash:/{{ ios_config_temp_file }}"
loop_control:
loop_var: line
- name: remove local temp working dir
file:
path: "{{ ios_config_temp_dir.path }}"
state: absent

View File

@@ -1,41 +0,0 @@
---
# this block is responsible for loading the configuration on to the target
# device line by line from config model.
- name: load configuration onto target device
block:
- name: load configuration lines into target device
block:
- name: extract banners from configs if present
extract_banners:
config: "{{ ios_config_text }}"
register: result
- name: load configuration lines into target device except banner
cli_config:
config: "{{ result['config'] }}"
register: ios_config_output
- name: enter configuration mode
cli:
command: "configure terminal"
- name: load banner lines into target device
cli_command:
command: "{{ item }}"
sendonly: true
with_items: "{{ result['banners'] }}"
register: banner_config_output
- name: exit configuration mode
cli:
command: end
rescue:
- name: exit configuration mode
cli:
command: end
- name: set host failed
fail:
msg: "error loading configuration lines"
when: not ansible_check_mode

View File

@@ -1,34 +0,0 @@
---
- name: set role basic facts
set_fact:
ansible_network_ios_path: "{{ role_path }}"
ansible_network_ios_version: "v2.7.0"
- name: display the role version to stdout
debug:
msg: "ansible_network.cisco_ios version is {{ ansible_network_ios_version }}"
- name: validate ansible_network_os == 'ios'
fail:
msg: "expected ansible_network_os to be `ios`, got `{{ ansible_network_os }}`"
when: ansible_network_os != 'ios'
- name: validate ansible_connection == 'network_cli'
fail:
msg: "expected ansible_network to be `network_cli`, got `{{ ansible_connection }}`"
when: ansible_connection != 'network_cli'
- name: Validate we have required installed version of dependent roles
verify_dependent_role_version:
role_path: "{{ role_path }}"
depends_map:
- name: 'ansible-network.network-engine'
version: "{{ ios_network_engine_req_ver_override }}"
when: ios_dependent_role_check is defined and ios_dependent_role_check
and ios_network_engine_req_ver_override is defined
- name: Validate we have required installed version of dependent roles from meta
verify_dependent_role_version:
role_path: "{{ role_path }}"
when: ios_dependent_role_check is defined and ios_dependent_role_check
and ios_network_engine_req_ver_override is not defined

View File

@@ -1,25 +0,0 @@
---
- name: run cli command pre hook
include_tasks: "{{ ios_run_cli_command_pre_hook }}"
when: ios_run_cli_command_pre_hook is defined and ios_run_cli_command_pre_hook
- name: run command and parse output
cli:
command: "{{ ios_command }}"
parser: "{{ parser }}"
engine: "{{ ios_parser_engine | default(None) }}"
name: "{{ ios_name | default(None) }} "
with_first_found:
- files:
- "{{ ios_parser }}"
paths:
- "{{ playbook_dir }}/parser_templates/ios"
- "~/.ansible/ansible_network/parser_templates/ios"
- "/etc/ansible/ansible_network/parser_templates/ios"
- "{{ role_path }}/parser_templates"
loop_control:
loop_var: parser
- name: run cli command post hook
include_tasks: "{{ ios_run_cli_command_post_hook }}"
when: ios_run_cli_command_post_hook is defined and ios_run_cli_command_post_hook

View File

@@ -1,102 +0,0 @@
---
- name: initialize function
include_tasks: includes/init.yaml
- name: validate ios_config_includes is defined
fail:
msg: "missing required arg: ios_config_includes"
when: ios_config_includes is undefined
- name: set ios checkpoint filename
set_fact:
ios_checkpoint_filename: "chk_ansible"
# initiate creating a checkpoint of the existing running-config
- name: create checkpoint of current configuration
include_tasks: "{{ role_path }}/includes/checkpoint/create.yaml"
- name: configure the target device
block:
# iterate over the set of includes to configure the device
- name: iterate over configuration tasks
include_tasks: "{{ task }}"
loop: "{{ ios_config_includes }}"
loop_control:
loop_var: task
rescue:
# since the host has failed during the configuration load, the role by
# default will initiate a restore sequence. the restore sequence will
# load the previous running-config with the replace option enabled.
- name: display message
debug:
msg: "error configuring device, starting rollback"
when: ios_config_rollback_enabled
- name: initiate configuration rollback
include_tasks: "{{ role_path }}/includes/checkpoint/restore.yaml"
- name: display message
debug:
msg: "successfully completed configuration rollback"
when: ios_config_rollback_enabled
- name: fail host due to config load error
fail:
msg: "error loading configuration onto target device"
- name: set the ios_active_config fact
set_fact:
ios_active_config: "cfg_ansible"
# check if any reminents are left over from a previous run and remove them
# prior to starting the configuration tasks.
- name: check if stale temporarary files exist on target device
cli:
command: dir
register: ios_dir_listing
- name: remove temporary files from target device
cli:
command: "delete /force flash:/{{ ios_active_config }}"
when: ios_active_config in ios_dir_listing.stdout
# copy the updated running-config to the local flash device to be used to
# generate a configuration diff between the before and after
# running-configurations.
- name: copy running-config to active config
ios_command:
commands:
- command: "copy running-config flash:{{ ios_active_config }}"
prompt: ["\\? "]
answer: "{{ ios_active_config }}"
# generate the configuration diff and display the diff to stdout. only set
# changed if there are lines in the diff that have changed
- name: generate ios diff
cli:
command: "show archive config differences flash:{{ ios_checkpoint_filename }} flash:{{ ios_active_config }}"
register: ios_config_diff
changed_when: "'No changes were found' not in ios_config_diff.stdout"
- name: display config diff
debug:
msg: "{{ ios_config_diff.stdout.splitlines() }}"
when: not ansible_check_mode
# refresh the list of files currently on the target network device flash
# drive and remote all temp files
- name: update local directory listing
cli:
command: dir
register: ios_dir_listing
- name: remove remote temp files from flash
cli:
command: "delete /force flash:/{{ filename }}"
loop:
- "{{ ios_active_config }}"
- "{{ ios_checkpoint_filename }}"
loop_control:
loop_var: filename
when: filename in ios_dir_listing.stdout

View File

@@ -1,65 +0,0 @@
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
#
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'network'}
DOCUMENTATION = """
---
module: ios_capabilities
version_added: "2.7"
short_description: Collect device capabilities from Cisco IOS
description:
- Collect basic fact capabilities from Cisco NX-OS devices and return
the capabilities as Ansible facts.
author:
- Ansible Netowrk Community (ansible-network)
options: {}
"""
EXAMPLES = """
- facts:
"""
RETURN = """
"""
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.connection import Connection
def main():
""" main entry point for Ansible module
"""
argument_spec = {}
module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
connection = Connection(module._socket_path)
facts = connection.get_capabilities()
facts = module.from_json(facts)
result = {
'changed': False,
'ansible_facts': {'cisco_ios': {'capabilities': facts['device_info']}}
}
module.exit_json(**result)
if __name__ == '__main__':
main()

View File

@@ -1,241 +0,0 @@
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
#
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'network'}
DOCUMENTATION = """
---
module: ios_command
version_added: "2.1"
author: "Peter Sprygada (@privateip)"
short_description: Run commands on remote devices running Cisco IOS
description:
- Sends arbitrary commands to an ios node and returns the results
read from the device. This module includes an
argument that will cause the module to wait for a specific condition
before returning or timing out if the condition is not met.
- This module does not support running commands in configuration mode.
Please use M(ios_config) to configure IOS devices.
extends_documentation_fragment: ios
notes:
- Tested against IOS 15.6
options:
commands:
description:
- List of commands to send to the remote ios device over the
configured provider. The resulting output from the command
is returned. If the I(wait_for) argument is provided, the
module is not returned until the condition is satisfied or
the number of retries has expired. If a command sent to the
device requires answering a prompt, it is possible to pass
a dict containing I(command), I(answer) and I(prompt).
Common answers are 'y' or "\\r" (carriage return, must be
double quotes). See examples.
required: true
wait_for:
description:
- List of conditions to evaluate against the output of the
command. The task will wait for each condition to be true
before moving forward. If the conditional is not true
within the configured number of retries, the task fails.
See examples.
aliases: ['waitfor']
version_added: "2.2"
match:
description:
- The I(match) argument is used in conjunction with the
I(wait_for) argument to specify the match policy. Valid
values are C(all) or C(any). If the value is set to C(all)
then all conditionals in the wait_for must be satisfied. If
the value is set to C(any) then only one of the values must be
satisfied.
default: all
choices: ['any', 'all']
version_added: "2.2"
retries:
description:
- Specifies the number of retries a command should by tried
before it is considered failed. The command is run on the
target device every retry and evaluated against the
I(wait_for) conditions.
default: 10
interval:
description:
- Configures the interval in seconds to wait between retries
of the command. If the command does not pass the specified
conditions, the interval indicates how long to wait before
trying the command again.
default: 1
"""
EXAMPLES = r"""
tasks:
- name: run show version on remote devices
ios_command:
commands: show version
- name: run show version and check to see if output contains IOS
ios_command:
commands: show version
wait_for: result[0] contains IOS
- name: run multiple commands on remote nodes
ios_command:
commands:
- show version
- show interfaces
- name: run multiple commands and evaluate the output
ios_command:
commands:
- show version
- show interfaces
wait_for:
- result[0] contains IOS
- result[1] contains Loopback0
- name: run commands that require answering a prompt
ios_command:
commands:
- command: 'clear counters GigabitEthernet0/1'
prompt: 'Clear "show interface" counters on this interface \[confirm\]'
answer: 'y'
- command: 'clear counters GigabitEthernet0/2'
prompt: '[confirm]'
answer: "\r"
"""
RETURN = """
stdout:
description: The set of responses from the commands
returned: always apart from low level errors (such as action plugin)
type: list
sample: ['...', '...']
stdout_lines:
description: The value of stdout split into a list
returned: always apart from low level errors (such as action plugin)
type: list
sample: [['...', '...'], ['...'], ['...']]
failed_conditions:
description: The list of conditionals that have failed
returned: failed
type: list
sample: ['...', '...']
"""
import re
import time
from ansible.module_utils.network.ios.ios import run_commands
from ansible.module_utils.network.ios.ios import ios_argument_spec, check_args
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.network.common.utils import ComplexList
from ansible.module_utils.network.common.parsing import Conditional
from ansible.module_utils.six import string_types
def to_lines(stdout):
for item in stdout:
if isinstance(item, string_types):
item = str(item).split('\n')
yield item
def parse_commands(module, warnings):
command = ComplexList(dict(
command=dict(key=True),
prompt=dict(),
answer=dict()
), module)
commands = command(module.params['commands'])
for item in list(commands):
configure_type = re.match(r'conf(?:\w*)(?:\s+(\w+))?', item['command'])
if module.check_mode:
if configure_type and configure_type.group(1) not in ('confirm', 'replace', 'revert', 'network'):
module.fail_json(
msg='ios_command does not support running config mode '
'commands. Please use ios_config instead'
)
return commands
def main():
"""main entry point for module execution
"""
argument_spec = dict(
commands=dict(type='list', required=True),
wait_for=dict(type='list', aliases=['waitfor']),
match=dict(default='all', choices=['all', 'any']),
retries=dict(default=10, type='int'),
interval=dict(default=1, type='int')
)
argument_spec.update(ios_argument_spec)
module = AnsibleModule(argument_spec=argument_spec,
supports_check_mode=True)
result = {'changed': False}
warnings = list()
check_args(module, warnings)
commands = parse_commands(module, warnings)
result['warnings'] = warnings
wait_for = module.params['wait_for'] or list()
conditionals = [Conditional(c) for c in wait_for]
retries = module.params['retries']
interval = module.params['interval']
match = module.params['match']
while retries > 0:
responses = run_commands(module, commands)
for item in list(conditionals):
if item(responses):
if match == 'any':
conditionals = list()
break
conditionals.remove(item)
if not conditionals:
break
time.sleep(interval)
retries -= 1
if conditionals:
failed_conditions = [item.raw for item in conditionals]
msg = 'One or more conditional statements have not been satisfied'
module.fail_json(msg=msg, failed_conditions=failed_conditions)
result.update({
'changed': False,
'stdout': responses,
'stdout_lines': list(to_lines(responses))
})
module.exit_json(**result)
if __name__ == '__main__':
main()

View File

@@ -1,48 +0,0 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2018 Red Hat
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'network'}
DOCUMENTATION = '''
---
module: ios_user_manager
short_description: Manage an aggregate of users in IOS device(s)
description:
- Allows the `cisco_ios` provider role to manage aggregate of users
by providing idempotency and other utility functions while running
the `configure_user` task
version_added: "2.7"
options:
new_users:
description:
- Aggregate of local users to be configured on IOS device(s)
required: true
user_config:
description:
- User config lines extracted from the devices' running-configuration
required: true
author:
- Nilashish Chakraborty (@NilashishC)
'''
RETURN = """
stdout:
description: Filtered set of users that should be configured on the device
returned: always apart from low-level errors (such as action plugin)
type: list
sample: [{"name": "ansible", "privilege": 15}, {"name": "test_user", "privilege": 15, "view": "sh_int"}]
"""
EXAMPLES = '''
- ios_user_manager:
new_users: "{{ users }}"
user_config: "{{ existing_user_config.stdout }}"
'''

View File

@@ -1 +0,0 @@
{install_date: 'Thu May 2 18:46:21 2019', version: v2.7.1}

View File

@@ -1,41 +0,0 @@
---
galaxy_info:
author: Ansible Network Community (ansible-network)
description: |
This role provides an implementation for automating the configuration of
Cisco IOS/IOS-XE devices. It provides implementations of Ansible Network
configuration abstractions.
company: Ansible
license: GPLv3
min_ansible_version: 2.7
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
# Optionally specify the branch Galaxy will use when accessing the GitHub
# repo for this role. During role install, if no tags are available,
# Galaxy will use this branch. During import Galaxy will access files on
# this branch. If Travis integration is configured, only notifications for this
# branch will be accepted. Otherwise, in all cases, the repo's default branch
# (usually master) will be used.
# github_branch:
#
# platforms is a list of platforms, and each platform has a name and a list of versions.
#
platforms:
- name: ios
version:
- any
galaxy_tags:
- network
- cisco
- ios
- iosxe
dependencies:
- src: ansible-network.network-engine
version: v2.7.3

View File

@@ -1,51 +0,0 @@
---
- name: parser meta data
parser_metadata:
version: 1.0
command: show cdp neighbors detail
network_os: ios
- name: match sections
pattern_match:
regex: "^-----.*"
match_all: true
match_greedy: true
register: context
- name: parse cdp neighbors
pattern_group:
- name: parse local port
pattern_match:
regex: '^Interface: ([^,]*)'
content: "{{ item }}"
register: local_port
- name: parse remote prort
pattern_match:
regex: 'Port ID \(outgoing port\): (.*)$'
content: "{{ item }}"
register: remote_port
- name: parse remote host
pattern_match:
regex: 'Device ID: (.*)$'
content: "{{ item }}"
register: remote_host
loop: "{{ context }}"
register: matches
- name: build cdp neighbor facts
loop: "{{ matches }}"
register: cdp
export: true
export_as: dict
extend: "{{ toplevel | default('cisco_ios') }}"
json_template:
template:
- key: "{{ item.local_port.matches.0 | expand_interface_name }}"
object:
- key: neighbor
value: "{{ item.remote_host.matches.0 }}"
- key: neighbor_port
value: "{{ item.remote_port.matches.0 }}"

View File

@@ -1,119 +0,0 @@
---
- name: parser meta data
parser_metadata:
version: 1.0
command: show interfaces
network_os: ios
- name: match sections
pattern_match:
regex: "^\\S+ is (up|down|administratively down),"
match_all: true
match_greedy: true
register: context
- name: match interface values
pattern_group:
- name: match name
pattern_match:
regex: "^(\\S+)"
content: "{{ item }}"
register: name
- name: match hardware
pattern_match:
regex: "Hardware is (.*(?=,)|.*)"
content: "{{ item }}"
register: type
- name: match mtu
pattern_match:
regex: "MTU (\\d+)"
content: "{{ item }}"
register: mtu
- name: match interface description
pattern_match:
regex: "Description: (.+)"
content: "{{ item }}"
register: description
- name: match administrative state
pattern_match:
regex: "(administratively down)"
content: "{{ item }}"
register: enabled
- name: match line protocol
pattern_match:
regex: "line protocol is (\\S+)"
content: "{{ item }}"
register: operstatus
- name: match in packets
pattern_match:
regex: "(\\d+) packets input, (\\d+)"
content: "{{ item }}"
register: in_pkts_octets
- name: match input broadcast
pattern_match:
regex: "Received (\\d+) broadcasts \\(\\d+"
content: "{{ item }}"
register: in_bcast_mcast
- name: match out packets
pattern_match:
regex: "(\\d+) packets output, (\\d+) bytes"
content: "{{ item }}"
register: out_pkts_octets
- name: match out errors
pattern_match:
regex: "(\\d+) output errors"
content: "{{ item }}"
register: out_errors
loop: "{{ context }}"
register: values
- name: template interface values
loop: "{{ values }}"
register: interfaces
export: true
export_as: dict
extend: cisco_ios
json_template:
template:
- key: "{{ item.name.matches.0 }}"
object:
- key: name
value: "{{ item.name.matches.0 }}"
- key: type
value: "{{ item.type.matches.0 }}"
- key: mtu
value: "{{ item.mtu.matches.0 }}"
- key: description
value: "{{ item.description.matches.0 }}"
- key: enabled
value: "{{ item.enabled.matches.0 is undefined }}"
- key: admin-status
value: "{{ item.enabled.matches.0 is undefined | ternary ('enabled', 'disabled') }}"
- key: oper-status
value: "{{ item.operstatus.matches.0 }}"
- key: counters
object:
- key: in-octets
value: "{{ item.in_pkts_octets.matches.0 }}"
- key: in-unicast-pkts
value: "{{ item.in_pkts_octets.matches.1 }}"
- key: in-broadcast-pkts
value: "{{ item.in_bcast_mcast.matches.0 }}"
- key: in-multicast-pkts
value: "{{ item.in_bcast_mcast.matches.1 }}"
- key: out-octets
value: "{{ item.out_pkts_octets.matches.0 }}"
- key: out-unicast-pkts
value: "{{ item.out_pkts_octets.matches.1 }}"
- key: out-errors
value: "{{ item.out_errors.matches.0 }}"

View File

@@ -1,75 +0,0 @@
---
- name: parser meta data
parser_metadata:
version: 1.0
command: show interfaces transceiver
network_os: ios
- name: match sections
pattern_match:
regex: '(^\S{2}\d+/\d/\d+).*'
match_all: true
match_greedy: true
register: context
- name: match interface transceiver
pattern_group:
- name: match transceiver
pattern_match:
regex: '(^\S{2}\d+/\d/\d+)'
content: "{{ item }}"
register: transceiver
- name: match temperature
pattern_match:
regex: '(^\S{2}\d+/\d/\d+)\s*(\d+\.\d+)\s*(\d+\.\d+)\s*(\d+\.\d+)*\s*(-?\d+\.\d+)\s*(-?\d+\.\d+)*\s*([-\+]*)$'
content: "{{ item }}"
register: temperature
- name: match voltage
pattern_match:
regex: '(^\S{2}\d+/\d/\d+)\s*(\d+\.\d+)\s*(\d+\.\d+)\s*(\d+\.\d+)*\s*(-?\d+\.\d+)\s*(-?\d+\.\d+)*\s*([-\+]*)$'
content: "{{ item }}"
register: voltage
- name: match TxPower
pattern_match:
regex: '(^\S{2}\d+/\d/\d+)\s*(\d+\.\d+)\s*(\d+\.\d+)\s*(\d+\.\d+)*\s*(-?\d+\.\d+)\s*(-?\d+\.\d+)*\s*([-\+]*)$'
content: "{{ item }}"
register: txpower
- name: match RxPower
pattern_match:
regex: '(^\S{2}\d+/\d/\d+)\s*(\d+\.\d+)\s*(\d+\.\d+)\s*(\d+\.\d+)*\s*(-?\d+\.\d+)\s*(-?\d+\.\d+)*\s*([-\+]*)$'
content: "{{ item }}"
register: rxpower
- name: match Alarm
pattern_match:
regex: '(^\S{2}\d+/\d/\d+)\s*(\d+\.\d+)\s*(\d+\.\d+)\s*(\d+\.\d+)*\s*(-?\d+\.\d+)\s*(-?\d+\.\d+)*\s*([-\+]*)$'
content: "{{ item }}"
register: alarm
loop: "{{ context }}"
register: values
- name: template interface values
loop: "{{ values }}"
register: transceiver
export: true
export_as: dict
extend: cisco_ios
json_template:
template:
- key: "{{ item.transceiver.matches.0 | expand_interface_name}}"
object:
- key: temperature
value: "{{ item.temperature.matches.1 }}"
- key: voltage
value: "{{ item.voltage.matches.2 }}"
- key: tx
value: "{{ item.txpower.matches.4 }}"
- key: rx
value: "{{ item.rxpower.matches.5 }}"
- key: alarm
value: "{{ item.rxpower.matches.6 }}"

View File

@@ -1,77 +0,0 @@
---
- name: show_ip_bgp_summary
parser_metadata:
version: 1.0
command: show ip bgp summary
network_os: ios
- name: match not active
register: not_active
pattern_match:
regex: "BGP not active"
match_all: true
- name: set_vars bgp state active
set_vars:
process_state: "active"
- name: set_vars bgp state not active
set_vars:
process_state: "not active"
when: "not_active.0.matches == 'BGP not active'"
- name: match sections
register: context
pattern_match:
regex: "Neighbor.+"
match_all: true
match_greedy: true
when: process_state == 'active'
- name: match lines
register: lines
pattern_match:
regex: "^[0-9a-f.]+"
content: "{{ context.0 }}"
match_all: true
match_greedy: true
when: process_state == 'active'
- name: match neighbors
register: matched_neighbors
loop: "{{ lines }}"
pattern_match:
regex: "(?P<ip>[0-9a-f.]+)\\s+(?P<version>\\d+)\\s+(?P<asn>\\d+)\\s+(?P<msgrcvd>\\d+)\\s+(?P<msgsent>\\d+)\\s+(?P<tblver>\\d+)\\s+(?P<inq>\\d+)\\s+(?P<outq>\\d+)\\s+(?P<timer>\\S+)\\s+(?P<state>\\S+)"
content: "{{ item }}"
when: process_state == 'active'
- name: template bgp values
extend: cisco_ios.vrf.DEFAULT.protocols
register: bgp
export: true
export_as: dict
json_template:
template:
- key: "process_state"
value: "{{ process_state }}"
- name: template bgp neighbor entries
extend: cisco_ios.vrf.DEFAULT.protocols.bgp
register: neighbors
export: true
export_as: dict
loop: "{{ matched_neighbors }}"
when: process_state == 'active'
json_template:
template:
- key: "{{ item.ip }}"
object:
- key: state_pfxrcd
value: "{{ item.state }}"
- key: asn
value: "{{ item.asn }}"
- key: timer
value: "{{ item.timer }}"
- key: ip_version
value: "{{ item.version }}"

View File

@@ -1,138 +0,0 @@
---
- name: show_ip_vrf_detail
parser_metadata:
version: 1.0
command: show ip vrf detail
network_os: ios
- name: match vrf sections
register: vrf_section
pattern_match:
regex: "^VRF \\S+(?: \\(VRF Id = \\d+\\)|); default RD"
match_all: true
match_greedy: true
- name: match vrf section values
loop: "{{ vrf_section }}"
register: vrf_section_values
pattern_group:
- name: match name
pattern_match:
regex: "^VRF (\\S+)(?: \\(VRF Id = \\d+\\)|); default RD"
content: "{{ item }}"
register: name
- name: match description
pattern_match:
regex: "^ Description: (.*)"
content: "{{ item }}"
register: description
- name: match route distinguisher
pattern_match:
regex: ".*; default RD (\\d+:\\d+|<not set>)"
content: "{{ item }}"
register: rd
- name: match interface section
pattern_match:
regex: "^ Interfaces:([\\s\\S]*)(?:Address family|VRF Table ID)"
content: "{{ item }}"
match_all: true
match_greedy: false
register: interface_section
- name: match export route target section
pattern_match:
regex: "(?:No|)Export VPN route-target communities([\\s\\S]*) (?:No |)Import VPN"
content: "{{ item }}"
match_all: true
match_greedy: false
register: export_rt_section
- name: match import route target section
pattern_match:
regex: "Import VPN route-target communities([\\s\\S]*) (?:No |)import"
content: "{{ item }}"
match_all: true
match_greedy: false
register: import_rt_section
- name: match vrf nested section values
loop: "{{ vrf_section_values }}"
register: vrf_nested_section_values
loop_control:
loop_var: vrf_item
pattern_group:
- name: match vrf name
pattern_match:
regex: "(.*)"
content: "{{ vrf_item.name.matches.0 }}"
register: name
- name: match description
pattern_match:
regex: "(.*)"
content: "{{ vrf_item.description.matches.0 }}"
register: description
- name: match route distinguisher
pattern_match:
regex: "(.*)"
content: "{{ vrf_item.rd.matches.0 }}"
register: rd
- name: match interfaces
pattern_match:
regex: "\\s+(\\S+)\\s"
content: "{{ vrf_item.interface_section.0.matches }}"
match_all: true
register: interface
- name: match export route targets
pattern_match:
regex: "\\s+RT:(\\d+:\\d+)"
content: "{{ vrf_item.export_rt_section.0.matches }}"
match_all: true
register: export_rt
- name: match import route targets
pattern_match:
regex: "\\s+RT:(\\d+:\\d+)"
content: "{{ vrf_item.import_rt_section.0.matches }}"
match_all: true
register: import_rt
- name: template export json object
export: true
loop: "{{ vrf_nested_section_values }}"
loop_control:
loop_var: vrf_nested_item
register: vrf
extend: cisco_ios
export_as: dict
json_template:
template:
- key: "{{ vrf_nested_item.name.matches.0 }}"
object:
- key: name
value: "{{ vrf_nested_item.name.matches.0 }}"
- key: description
value: "{{ vrf_nested_item.description.matches.0 }}"
- key: rd
value: "{{ vrf_nested_item.rd.matches.0 }}"
- key: export_rt
elements: "{{ export_rt_item.matches }}"
repeat_for: "{{ vrf_nested_item.export_rt }}"
repeat_var: export_rt_item
- key: import_rt
elements: "{{ import_rt_item.matches }}"
repeat_for: "{{ vrf_nested_item.import_rt }}"
repeat_var: import_rt_item
- key: interface
elements: "{{ interface_item.matches }}"
repeat_for: "{{ vrf_nested_item.interface }}"
repeat_var: interface_item

View File

@@ -1,52 +0,0 @@
---
- name: parser meta data
parser_metadata:
version: 1.0
command: show lldp neighbors detail
network_os: ios
- name: match sections
pattern_match:
regex: "^-----.*"
match_all: true
match_greedy: true
register: context
- name: parse lldp neighbors
pattern_group:
- name: parse local port
pattern_match:
regex: "Local Intf: (.+)"
content: "{{ item }}"
register: local_port
- name: parse remote prort
pattern_match:
regex: "Port id: (.+)"
content: "{{ item }}"
register: remote_port
- name: parse remote host
pattern_match:
regex: "System Name: (.+)"
content: "{{ item }}"
register: remote_host
loop: "{{ context }}"
register: matches
- name: build lldp neighbor facts
register: lldp
export: true
extend: "{{ toplevel | default('cisco_ios') }}"
json_template:
template:
- key: neighbors
elements:
- key: port
value: "{{ item.local_port.matches.0 | expand_interface_name }}"
- key: neighbor
value: "{{ item.remote_host.matches.0 }}"
- key: neighbor_port
value: "{{ item.remote_port.matches.0 }}"
repeat_for: "{{ matches }}"

View File

@@ -1,109 +0,0 @@
---
- name: parser meta data
parser_metadata:
version: 1.0
command: show version
network_os: ios
- name: match softare version
pattern_match:
regex: "Cisco IOS Software.*, Version (\\S+),"
register: version
- name: match model
pattern_match:
regex: "[Cc]isco (.+) \\("
register: model
- name: match hostname
pattern_match:
regex: "^(\\S+) uptime is"
register: hostname
- name: match image
pattern_match:
regex: "^System image file is (\\S+)"
register: image
- name: match restart conditions
pattern_match:
regex: "^System restarted at (?P<time>\\d+:\\d+:\\d+) (?P<tz>\\S+)"
register: restart_conditions
- name: match reload reason
pattern_match:
regex: "^Last reload reason: (\\S+)"
register: reload_reason
- name: match uptime
pattern_match:
regex: "uptime is (.+)"
register: uptime
- name: match uptime years
pattern_match:
regex: "uptime is (\\d+) year"
register: uptime_years
- name: match uptime weeks
pattern_match:
regex: "(\\d+) week"
register: uptime_weeks
- name: match uptime days
pattern_match:
regex: "(\\d+) day"
register: uptime_days
- name: match uptime hours
pattern_match:
regex: "(\\d+) hour"
register: uptime_hours
- name: match uptime minutes
pattern_match:
regex: "(\\d+) minute"
register: uptime_minutes
- name: match configuration register
pattern_match:
regex: "register is (.+)"
register: confreg
- name: build ios system state facts
json_template:
template:
- key: version
value: "{{ version.matches.0 }}"
- key: hostname
value: "{{ hostname.matches.0 }}"
- key: image_file
value: "{{ image.matches.0 }}"
- key: model
value: "{{ model.matches.0 }}"
- key: restart_time
value: "{{ restart_conditions.time }}"
- key: restart_tz
value: "{{ restart_conditions.tz }}"
- key: reload_reason
value: "{{ reload_reason.matches.0 | lower }}"
- key: uptime
value: "{{ uptime.matches.0 }}"
- key: uptime_split
object:
- key: years
value: "{{ uptime_years.matches.0 | default(0) | int }}"
- key: weeks
value: "{{ uptime_weeks.matches.0 | default(0) | int }}"
- key: days
value: "{{ uptime_days.matches.0 | default(0) | int }}"
- key: hours
value: "{{ uptime_hours.matches.0 | default(0) | int }}"
- key: minutes
value: "{{ uptime_minutes.matches.0 | default(0) | int }}"
- key: configuration_register
value: "{{ confreg.matches.0 }}"
register: system
export: true
export_as: dict
extend: cisco_ios

View File

@@ -1,87 +0,0 @@
---
- name: match sections
pattern_match:
regex: "^ip"
match_all: true
match_greedy: true
register: context
- name: match prefix values
pattern_group:
- name: match name
pattern_match:
regex: "ip prefix-list (?P<acl_name>.+): (\\d+) entries"
content: "{{ item }}"
register: name
- name: match entries
pattern_match:
regex: "seq (\\d+) (permit|deny) (\\S+)(?: (le|ge) (\\d+))*"
content: "{{ item }}"
match_all: true
register: entry
loop: "{{ context }}"
register: entries
- name: template entries
json_template:
template:
- key: name
value: "{{ item.name.acl_name }}"
- key: entries
elements:
- key: sequence
value: "{{ it.matches.0 }}"
- key: action
value: "{{ it.matches.1 }}"
- key: prefix
value: "{{ it.matches.2 }}"
- key: operator
value: "{{ it.matches.4 }}"
- key: length
value: "{{ it.matches.5 }}"
repeat_for: "{{ item.entry }}"
repeat_var: it
register: prefix_list_list
export: true
loop: "{{ entries }}"
- name: template entries
json_template:
template:
- key: "{{ item.name.acl_name }}"
object:
- key: entries
elements:
- key: sequence
value: "{{ it.matches.0 }}"
- key: action
value: "{{ it.matches.1 }}"
- key: prefix
value: "{{ it.matches.2 }}"
- key: operator
value: "{{ it.matches.3 }}"
- key: length
value: "{{ it.matches.4 }}"
repeat_for: "{{ item.entry }}"
repeat_var: it
loop: "{{ entries }}"
export: true
export_as: dict
extend: cisco_ios.config
register: prefix_list_dict
- name: template acl and prefix
json_template:
template:
- key: acl
elements:
- key: acl_name
value: "{{ item.name.acl_name }}"
- key: prefix
value: "{{ it.matches.2 }}"
repeat_for: "{{ item.entry }}"
repeat_var: it
register: prefix_list_basic
export: true
loop: "{{ entries }}"

View File

@@ -1,90 +0,0 @@
---
- name: match sections
pattern_match:
regex: "interface"
match_all: true
match_greedy: true
register: section
- name: match interface config values
pattern_group:
- name: match name
pattern_match:
regex: "interface (.*)"
content: "{{ item }}"
register: name
- name: match description
pattern_match:
regex: "description (.*)"
content: "{{ item }}"
register: description
- name: match admin state
pattern_match:
regex: "(shutdown)"
content: "{{ item }}"
register: enabled
- name: match ip_helper
pattern_match:
regex: "ip helper-address (.*)"
match_all: true
content: "{{ item }}"
register: ip_helper
- name: match cdp enable
pattern_match:
regex: "(no) cdp enable"
content: "{{ item }}"
register: cdp_enable
- name: match speed
pattern_match:
regex: 'speed (.+)'
content: "{{ item }}"
register: speed
- name: match duplex
pattern_match:
regex: 'duplex (.+)'
content: "{{ item }}"
register: duplex
- name: match ip_address
pattern_match:
regex: "ip address (.*)"
match_all: true
content: "{{ item }}"
register: ip_address
loop: "{{ section }}"
register: values
- name: template interface values
loop: "{{ values }}"
register: interface-config
export: true
export_as: dict
extend: cisco_ios.config
json_template:
template:
- key: "{{ item.name.matches.0 }}"
object:
- key: name
value: "{{ item.name.matches.0 }}"
- key: ip_addess
value: "{{ item.ip_address | map(attribute='matches') | list }}"
- key: description
value: "{{ item.description.matches.0 }}"
- key: ip_helper
value: "{{ item.ip_helper | map(attribute='matches') | list }}"
- key: enabled
value: "{{ not item.enabled.matches }}"
- key: mtu
value: "{{ item.mtu.matches.0 }}"
- key: speed
value: "{{ item.speed.matches.0 }}"
- key: duplex
value: "{{ item.duplex.matches.0 }}"
- key: cdp
value: "{{ not item.cdp_enable.matches }}"

View File

@@ -1,23 +0,0 @@
---
- name: parse hostname
pattern_match:
regex: "hostname (.+)"
register: hostname
- name: parse domain-name
pattern_match:
regex: "ip domain-name (.+)"
register: domain_name
- name: parse ip routing
pattern_match:
regex: "(ip routing)"
register: routing
- name: set global config facts
set_vars:
hostname: "{{ hostname.matches.0 }}"
domain_name: "{{ domain_name.matches.0 }}"
routing: "{{ routing.matches.0 is defined }}"
export: true
extend: cisco_ios.config

View File

@@ -1,38 +0,0 @@
---
Value Required,Filldown ACL_TYPE (Standard|Extended)
Value Required,Filldown ACL_NAME (\S+)
Value LINE_NUM (\d+)
Value ACTION (permit|deny)
Value PROTOCOL ([a-z]+)
Value SRC_HOST (\d+\.\d+\.\d+\.\d+)
Value SRC_ANY (any)
Value SRC_NETWORK (\d+\.\d+\.\d+\.\d+)
Value SRC_WILDCARD (\d+\.\d+\.\d+\.\d+)
Value SRC_PORT_MATCH (eq|neq|range|lt|gt)
Value SRC_PORT ((?<!range\s).+?)
Value SRC_PORT_RANGE_START ((?<=range\s)\S+)
Value SRC_PORT_RANGE_END (\S+)
Value DST_HOST (\d+\.\d+\.\d+\.\d+)
Value DST_ANY (any)
Value DST_NETWORK (\d+\.\d+\.\d+\.\d+)
Value DST_WILDCARD (\d+\.\d+\.\d+\.\d+)
Value DST_PORT_MATCH (eq|neq|range|lt|gt)
Value DST_PORT ((?<!range\s).+?)
Value DST_PORT_RANGE_START ((?<=range\s)\S+)
Value DST_PORT_RANGE_END (\S+)
Value FLAGS_MATCH (match-all|match-any)
Value TCP_FLAG (((\+|-|)ack(\s*?)|(\+|-|)established(\s*?)|(\+|-|)fin(\s*?)|(\+|-|)fragments(\s*?)|(\+|-|)psh(\s*?)|(\+|-|)rst(\s*?)|(\+|-|)syn(\s*?)|urg(\s*?))+)
Value LOG (log-input|log)
Value TIME (\S+)
Value STATE (inactive|active)
Value MATCHES (\d+)
Value MATCH (\d+)
Start
^(Standard|Extended) -> Continue.Clearall
^${ACL_TYPE}\s+IP\s+access\s+list\s+${ACL_NAME}\s* -> Record
^\s+${LINE_NUM}\s+${ACTION}\s+${PROTOCOL}\s+(host\s+${SRC_HOST}|${SRC_ANY}|${SRC_NETWORK}\s+${SRC_WILDCARD})(\s+${SRC_PORT_MATCH}\s+|)(${SRC_PORT_RANGE_START}\s+${SRC_PORT_RANGE_END}|${SRC_PORT}|)\s+(host\s+${DST_HOST}|${DST_ANY}|${DST_NETWORK}\s+${DST_WILDCARD})(\s+${DST_PORT_MATCH}\s+(${DST_PORT_RANGE_START}\s+${DST_PORT_RANGE_END}|${DST_PORT}|)|\s+(${FLAGS_MATCH}\s+|)${TCP_FLAG}|)(\s+${LOG}|)(\s+time-range\s+${TIME}\s+\(${STATE}\)|)(?:\s+\(${MATCHES}\s+matches\)|)(?:\s+\(${MATCH}\s+match\)|)\s*$$ -> Record
^\s+${LINE_NUM}\s+${ACTION}\s+(${SRC_NETWORK},\s+wildcard\s+bits\s+${SRC_WILDCARD}|${SRC_HOST}|${SRC_ANY})(\s+${LOG}|)(\s+time-range\s+${TIME}\s+\(${STATE}\)|)(?:\s+\(${MATCHES}\s+matches\)|)\s*$$ -> Record
^.* -> Error "Could not parse line:"
EOF

View File

@@ -1,10 +0,0 @@
---
Value src (\d+.\d+.\d+.\d+)
Value dst (\d+.\d+.\d+.\d+)
Value proto (\S+)
Value src_port (\d+)
Value dst_port (\d+)
Value num_packets (\d+)
Start
^.*permitted ${proto} ${src}\(${src_port}\)(?:\s|-|>)*${dst}\(${dst_port}\), ${num_packets} packet.* -> Record

View File

@@ -1,3 +0,0 @@
---
- name: Run provider add host initiator tasks
include_tasks: "{{ role_path }}/tasks/cloud_vpn/providers/{{ cloud_vpn_initiator_provider }}/initiator/add_host.yaml"

View File

@@ -1,3 +0,0 @@
---
- name: Run provider add host responder tasks
include_tasks: "{{ role_path }}/tasks/cloud_vpn/providers/{{ cloud_vpn_responder_provider }}/responder/add_host.yaml"

View File

@@ -1,3 +0,0 @@
---
- name: Run provider configure routing initiator tasks
include_tasks: "{{ role_path }}/tasks/cloud_vpn/providers/{{ cloud_vpn_initiator_provider }}/initiator/configure_routing.yaml"

View File

@@ -1,3 +0,0 @@
---
- name: Run provider configure routing tasks
include_tasks: "{{ role_path }}/tasks/cloud_vpn/providers/{{ cloud_vpn_responder_provider }}/responder/configure_routing.yaml"

View File

@@ -1,3 +0,0 @@
---
- name: Run provider configure vpn initiator tasks
include_tasks: "{{ role_path }}/tasks/cloud_vpn/providers/{{ cloud_vpn_initiator_provider }}/initiator/configure_vpn.yaml"

View File

@@ -1,3 +0,0 @@
---
- name: Run provider configure vpn tasks
include_tasks: "{{ role_path }}/tasks/cloud_vpn/providers/{{ cloud_vpn_responder_provider }}/responder/configure_vpn.yaml"

View File

@@ -1,17 +0,0 @@
---
- add_host:
name: initiator
ansible_host: "{{ cloud_vpn_initiator_public_ip }}"
ansible_user: "{{ cloud_vpn_initiator_user }}"
ansible_connection: "{{ cloud_vpn_initiator_ansible_connection }}"
ansible_network_os: ios
ansible_ssh_private_key_file: "{{ cloud_vpn_initiator_ssh_private_key_file }}"
- name: Wait for SSH port to be reachable
wait_for:
host: "{{ cloud_vpn_initiator_public_ip }}"
port: 22
- name: Pause for SSH daemon to settle and accept connections
pause:
seconds: "{{ cloud_vpn_pause_before_config_seconds }}"

View File

@@ -1,13 +0,0 @@
---
- name: Push routing configuration to CSR device
ios_config:
src: "{{ lookup('first_found', params) }}"
vars:
params:
files:
- "configure_routing_{{ cloud_vpn_routing }}.j2"
paths:
- "templates/cloud_vpn/providers/csr/initiator/{{ cloud_vpn_responder_provider }}"
- templates/cloud_vpn/providers/csr/initiator
delegate_to: initiator

View File

@@ -1,13 +0,0 @@
---
- name: Push VPN configuration to CSR device
ios_config:
src: "{{ lookup('first_found', params) }}"
vars:
params:
files:
- configure_vpn.j2
paths:
- "templates/cloud_vpn/providers/csr/initiator/{{ cloud_vpn_responder_provider }}"
- templates/cloud_vpn/providers/csr/initiator
delegate_to: initiator

View File

@@ -1,6 +0,0 @@
---
- name: Show initiator IP and user
debug:
msg: "Initiator can be reached at {{ cloud_vpn_initiator_user}}@{{ cloud_vpn_initiator_public_ip }}"
when: cloud_vpn_initiator_user is defined

View File

@@ -1,3 +0,0 @@
---
- name: Run provider show login info initiator tasks
include_tasks: "{{ role_path }}/tasks/cloud_vpn/providers/{{ cloud_vpn_initiator_provider }}/initiator/show_login_info.yaml"

View File

@@ -1,3 +0,0 @@
---
- name: Run provider show login info responder tasks
include_tasks: "{{ role_path }}/tasks/cloud_vpn/providers/{{ cloud_vpn_responder_provider }}/responder/show_login_info.yaml"

View File

@@ -1,17 +0,0 @@
---
- name: initialize function
include_tasks: includes/init.yaml
- name: run command and return configuration
cli:
command: "{{ ios_config_source[source | default('running')] }}"
register: configuration
- name: set the configuration fact
set_fact:
configuration: "{{ configuration.stdout }}"
- name: parse system configuration
command_parser:
dir: "{{ role_path }}/parser_templates/config_manager"
content: "{{ configuration }}"

View File

@@ -1,109 +0,0 @@
---
- name: initialize function
include_tasks: includes/init.yaml
- name: validate config_manager_text is defined
fail:
msg: "missing required arg: config_manager_text"
when: config_manager_text is undefined
- name: set ios checkpoint filename
set_fact:
ios_checkpoint_filename: "chk_ansible"
# initiate creating a checkpoint of the existing running-config
- name: create checkpoint of current configuration
include_tasks: "{{ role_path }}/includes/checkpoint/create.yaml"
# if running in check mode, the configuration should not be loaded on
# the target device because that could have undesired results, so
# just print a warning message here.
- name: display message due to check mode
debug:
msg: not loading configuration due to check mode
when: ansible_check_mode
- name: load configuration onto target device
block:
- name: replace current active configuration
include_tasks: "{{ role_path }}/includes/configure/replace.yaml"
when: ios_config_replace
vars:
ios_config_text: "{{ config_manager_text }}"
- name: merge with current active configuration
include_tasks: "{{ role_path }}/includes/configure/merge.yaml"
when: not ios_config_replace and not ios_config_use_terminal
vars:
ios_config_text: "{{ config_manager_text }}"
- name: load configuration using configure terminal
include_tasks: "{{ role_path }}/includes/configure/terminal.yaml"
when: not ios_config_replace and ios_config_use_terminal
vars:
ios_config_text: "{{ config_manager_text }}"
rescue:
# since the host has failed during the configuration load, the role by
# default will initiate a restore sequence. the restore sequence will
# load the previous running-config with the replace option enabled.
- name: display message
debug:
msg: "error configuring device, starting rollback"
when: ios_config_rollback_enabled
- name: initiate configuration rollback
include_tasks: "{{ role_path }}/includes/checkpoint/restore.yaml"
- name: display message
debug:
msg: "successfully completed configuration rollback"
when: ios_config_rollback_enabled
- name: fail host due to config load error
fail:
msg: "error loading configuration onto target device"
- name: set the ios_active_config fact
set_fact:
ios_active_config: "cfg_ansible"
# copy the updated running-config to the local flash device to be used to
# generate a configuration diff between the before and after
# running-configurations.
- name: copy running-config to active config
ios_command:
commands:
- command: "copy running-config flash:{{ ios_active_config }}"
prompt: ["\\? "]
answer: "{{ ios_active_config }}"
# generate the configuration diff and display the diff to stdout. only set
# changed if there are lines in the diff that have changed
- name: generate ios diff
cli:
command: "show archive config differences flash:{{ ios_checkpoint_filename }} flash:{{ ios_active_config }}"
register: ios_config_diff
changed_when: "'No changes were found' not in ios_config_diff.stdout"
- name: display config diff
debug:
msg: "{{ ios_config_diff.stdout.splitlines() }}"
when: not ansible_check_mode
# refresh the list of files currently on the target network device flash
# drive and remote all temp files
- name: update local directory listing
cli:
command: dir
register: ios_dir_listing
- name: remove remote temp files from flash
cli:
command: "delete /force flash:/{{ filename }}"
loop:
- "{{ ios_active_config }}"
- "{{ ios_checkpoint_filename }}"
loop_control:
loop_var: filename
when: filename in ios_dir_listing.stdout

View File

@@ -1,7 +0,0 @@
---
- name: initialize function
include_tasks: includes/init.yaml
- name: run command and return configuration
cli:
command: "copy running-config startup-config"

View File

@@ -1,49 +0,0 @@
---
- name: "check if user(s) to configure is provided"
fail:
msg: "no user provided to configure"
when: users is not defined
delegate_to: localhost
- name: "check for required fact - name"
fail:
msg: "missing required fact: name"
with_items: "{{ users }}"
when: ( user.name is not defined )
loop_control:
loop_var: user
delegate_to: localhost
- name: "fetch existing user account details"
block:
- name: "fetch user config with section"
cli:
command: show running-config | section user
register: user_config
rescue:
- name: "fallback fetching full running-config"
cli:
command: show running-config
register: user_config
- name: "filter out users through user_manager"
ios_user_manager:
new_users: "{{ users }}"
user_config: "{{ user_config.stdout }}"
register: filtered_users
delegate_to: localhost
- name: "set users to be configured"
set_fact:
users: "{{ filtered_users.stdout }}"
delegate_to: localhost
- name: "fetch template for configuring user(s)"
set_fact:
config_manager_text: "{{ lookup('config_template', 'configure_user.j2') }}"
when: users
delegate_to: localhost
- include_tasks: config_manager/load.yaml
when: users
delegate_to: localhost

View File

@@ -1,25 +0,0 @@
---
- name: validate required connection is configured
fail:
msg: "expected connection value to be set to network_cli, got {{ ansible_connection }}"
when: ansible_connection != 'network_cli'
- name: Validate subset var is a list
fail:
msg: "subset must be in the form a list, not string"
when: subset is defined and subset is string
- name: collect platform capabilities as facts
ios_capabilities:
- name: run command and parse output
include_tasks: includes/run_cli.yaml
vars:
ios_command: "{{ item.command }}"
ios_parser: "cli/{{ item.parser }}"
ios_parser_engine: "{{ item.engine | default('command_parser') }}"
ios_name: "{{ item.name | default(None) }}"
ios_run_cli_command_pre_hook: "{{ item.pre_hook | default(None) }}"
ios_run_cli_command_post_hook: "{{ item.post_hook | default(None) }}"
loop: "{{ lookup('file', ios_get_facts_command_map) | from_yaml }}"
when: ios_get_facts_subset | intersect(item.groups)

View File

@@ -1,22 +0,0 @@
---
# tasks file for ansible-network.cisco_ios
#
- name: initialize function
include_tasks: includes/init.yaml
- name: set role supported functions
set_fact:
ios_functions:
- get_facts
- config_manager/get
- config_manager/load
- config_manager/save
- noop
- name: validate the requested function is supported
fail:
msg: "invalid function specified, expected one of {{ ios_functions }}, got {{ function }}"
when: function | default('noop') not in ios_functions
- name: include function specific tasks and run
include_tasks: "{{ function | default('noop') }}.yaml"

View File

@@ -1,14 +0,0 @@
---
# IOS providrs for handling acl parsing
#
- name: get output of command 'show ip access-list <id>'
cli_command:
command: show ip access-lists {{ acl_id }}
register: acl_out_buffer
- name: parse acl and validate. create flow info if acl does not have any discrepancy
parse_validate_acl:
show_acl_output_buffer: "{{ acl_out_buffer.stdout }}"
parser: "{{ role_path }}/parser_templates/net_operations/show_ip_access_list.yaml"
generated_flow_file: "{{ generated_flow_file }}"

View File

@@ -1,29 +0,0 @@
---
# IOS providrs for configuring sink before starting traffic test
- name: Configure an access list for catch-all permit
ios_config:
lines:
- permit ip any any log
parents: ip access-list extended ansible_sink
before: no ip access-list extended ansible_sink
register: result
- name: Attach ACl to sink interface
ios_config:
lines:
- ip access-group ansible_sink in
parents: interface {{ sink_capture_interface }}
- name: Configure Access-list log update interval (1 msec)
ios_config:
lines:
- ip access-list logging interval 1
- name: Clear the logs
ios_command:
commands:
- command: 'clear logging'
prompt: 'Clear logging buffer'
answer: "\r\n"
ignore_errors: true

View File

@@ -1,32 +0,0 @@
---
# IOS providrs for handling packet dict generation
#
- name: Delay 10 seconds for log file to be updated
wait_for: timeout=10
- name: Get logs from device
ios_command:
commands: "show logging"
register: result
- name: write logs to disk
copy:
contentr: "{{ result.stdout[0] }}"
dest: /tmp/ansible_acl_logs.txt
- name: parse logs file with help of textfsm
textfsm_parser:
content: "{{ lookup('file', '/tmp/ansible_acl_logs.txt') }}"
file: "{{role_path }}/parser_templates/net_operations/show_logs_acl_logs.yaml"
name: flows_dict
register: result
tags: textfsm
- name: write parsed packets info to disk
copy:
content: "{{ result.ansible_facts.flows_dict | to_nice_json }}"
dest: "{{ sink_path_flow_output }}"
- debug:
msg: "{{ result }}"
tags: debug

View File

@@ -1,4 +0,0 @@
---
- name: role noop
debug:
msg: "{{ role_path }}"

View File

@@ -1,13 +0,0 @@
router bgp {{ cloud_vpn_initiator_bgp_asn }}
neighbor {{ cloud_vpn_responder_tunnel_failover_ip }} remote-as {{ cloud_vpn_responder_bgp_asn }}
neighbor {{ cloud_vpn_responder_tunnel_failover_ip }} activate
neighbor {{ cloud_vpn_responder_tunnel_failover_ip }} timers 10 30 30
address-family ipv4 unicast
neighbor {{ cloud_vpn_responder_tunnel_failover_ip }} remote-as {{ cloud_vpn_responder_bgp_asn }}
neighbor {{ cloud_vpn_responder_tunnel_failover_ip }} timers 10 30 30
neighbor {{ cloud_vpn_responder_tunnel_failover_ip }} default-originate
neighbor {{ cloud_vpn_responder_tunnel_failover_ip }} activate
neighbor {{ cloud_vpn_responder_tunnel_failover_ip }} soft-reconfiguration inbound
network 0.0.0.0
exit
exit

View File

@@ -1,2 +0,0 @@
ip route {{ cloud_vpn_responder_cidr | ipaddr('network') }} {{ cloud_vpn_responder_cidr | ipaddr('netmask') }} Tunnel1 track 100
ip route {{ cloud_vpn_responder_cidr | ipaddr('network') }} {{ cloud_vpn_responder_cidr | ipaddr('netmask') }} Tunnel2 track 200

View File

@@ -1,115 +0,0 @@
crypto isakmp policy 200
encryption aes 128
authentication pre-share
group 2
lifetime 28800
hash sha
exit
crypto keyring {{ cloud_vpn_name }}-0
local-address {{ cloud_vpn_initiator_outside_interface }}
pre-shared-key address {{ cloud_vpn_responder_public_ip }} key {{ cloud_vpn_psk }}
exit
crypto isakmp profile {{ cloud_vpn_name }}-0
local-address {{ cloud_vpn_initiator_outside_interface }}
match identity address {{ cloud_vpn_responder_public_ip }}
keyring {{ cloud_vpn_name }}-0
exit
crypto ipsec transform-set {{ cloud_vpn_name }}-0 esp-aes 128 esp-sha-hmac
mode tunnel
exit
crypto ipsec profile {{ cloud_vpn_name }}-0
set pfs group2
set security-association lifetime seconds 3600
set transform-set {{ cloud_vpn_name }}-0
exit
crypto ipsec df-bit clear
crypto isakmp keepalive 10 10 on-demand
crypto ipsec security-association replay window-size 128
crypto ipsec fragmentation before-encryption
interface Tunnel1
ip address {{ cloud_vpn_initiator_tunnel_ip }} 255.255.255.252
ip virtual-reassembly
tunnel source {{ cloud_vpn_initiator_outside_interface }}
tunnel destination {{ cloud_vpn_responder_public_ip }}
tunnel mode ipsec ipv4
tunnel protection ipsec profile {{ cloud_vpn_name }}-0
! This option causes the router to reduce the Maximum Segment Size of
! TCP packets to prevent packet fragmentation.
ip tcp adjust-mss 1379
no shutdown
exit
ip sla 100
icmp-echo {{ cloud_vpn_responder_tunnel_ip }} source-interface Tunnel1
timeout 5000
frequency 5
exit
ip sla schedule 100 life forever start-time now
track 100 ip sla 100 reachability
crypto isakmp policy 201
encryption aes 128
authentication pre-share
group 2
lifetime 28800
hash sha
exit
crypto keyring {{ cloud_vpn_name }}-1
local-address {{ cloud_vpn_initiator_outside_interface }}
pre-shared-key address {{ cloud_vpn_responder_failover_ip }} key {{ cloud_vpn_psk }}
exit
crypto isakmp profile {{ cloud_vpn_name }}-1
local-address {{ cloud_vpn_initiator_outside_interface }}
match identity address {{ cloud_vpn_responder_failover_ip }}
keyring {{ cloud_vpn_name }}-1
exit
crypto ipsec transform-set {{ cloud_vpn_name }}-1 esp-aes 128 esp-sha-hmac
mode tunnel
exit
crypto ipsec profile {{ cloud_vpn_name }}-1
set pfs group2
set security-association lifetime seconds 3600
set transform-set {{ cloud_vpn_name }}-1
exit
crypto ipsec df-bit clear
crypto isakmp keepalive 10 10 on-demand
crypto ipsec security-association replay window-size 128
crypto ipsec fragmentation before-encryption
interface Tunnel2
ip address {{ cloud_vpn_initiator_tunnel_failover_ip }} 255.255.255.252
ip virtual-reassembly
tunnel source {{ cloud_vpn_initiator_outside_interface }}
tunnel destination {{ cloud_vpn_responder_failover_ip }}
tunnel mode ipsec ipv4
tunnel protection ipsec profile {{ cloud_vpn_name }}-1
! This option causes the router to reduce the Maximum Segment Size of
! TCP packets to prevent packet fragmentation.
ip tcp adjust-mss 1379
no shutdown
exit
ip sla 200
icmp-echo {{ cloud_vpn_responder_tunnel_failover_ip }} source-interface Tunnel2
timeout 5000
frequency 5
exit
ip sla schedule 200 life forever start-time now
track 200 ip sla 200 reachability

View File

@@ -1,13 +0,0 @@
router bgp {{ cloud_vpn_initiator_bgp_asn }}
neighbor {{ cloud_vpn_responder_tunnel_ip }} remote-as {{ cloud_vpn_responder_bgp_asn }}
neighbor {{ cloud_vpn_responder_tunnel_ip }} activate
neighbor {{ cloud_vpn_responder_tunnel_ip }} timers 10 30 30
address-family ipv4 unicast
neighbor {{ cloud_vpn_responder_tunnel_ip }} remote-as {{ cloud_vpn_responder_bgp_asn }}
neighbor {{ cloud_vpn_responder_tunnel_ip }} timers 10 30 30
neighbor {{ cloud_vpn_responder_tunnel_ip }} default-originate
neighbor {{ cloud_vpn_responder_tunnel_ip }} activate
neighbor {{ cloud_vpn_responder_tunnel_ip }} soft-reconfiguration inbound
network 0.0.0.0
exit
exit

View File

@@ -1 +0,0 @@
ip route {{ cloud_vpn_responder_cidr | ipaddr('network') }} {{ cloud_vpn_responder_cidr | ipaddr('netmask') }} Tunnel1 track 100

View File

@@ -1,57 +0,0 @@
crypto isakmp policy 200
encryption aes 128
authentication pre-share
group 2
lifetime 28800
hash sha
exit
crypto keyring {{ cloud_vpn_name }}
local-address {{ cloud_vpn_initiator_outside_interface }}
pre-shared-key address {{ cloud_vpn_responder_public_ip }} key {{ cloud_vpn_psk }}
exit
crypto isakmp profile {{ cloud_vpn_name }}
local-address {{ cloud_vpn_initiator_outside_interface }}
match identity address {{ cloud_vpn_responder_public_ip }}
keyring {{ cloud_vpn_name }}
exit
crypto ipsec transform-set {{ cloud_vpn_name }} esp-aes 128 esp-sha-hmac
mode tunnel
exit
crypto ipsec profile {{ cloud_vpn_name }}
set pfs group2
set security-association lifetime seconds 3600
set transform-set {{ cloud_vpn_name }}
exit
crypto ipsec df-bit clear
crypto isakmp keepalive 10 10 on-demand
crypto ipsec security-association replay window-size 128
crypto ipsec fragmentation before-encryption
interface Tunnel1
ip address {{ cloud_vpn_initiator_tunnel_ip }} 255.255.255.252
ip virtual-reassembly
tunnel source {{ cloud_vpn_initiator_outside_interface }}
tunnel destination {{ cloud_vpn_responder_public_ip }}
tunnel mode ipsec ipv4
tunnel protection ipsec profile {{ cloud_vpn_name }}
! This option causes the router to reduce the Maximum Segment Size of
! TCP packets to prevent packet fragmentation.
ip tcp adjust-mss 1379
no shutdown
exit
ip sla 100
icmp-echo {{ cloud_vpn_responder_tunnel_ip }} source-interface Tunnel1
timeout 5000
frequency 5
exit
ip sla schedule 100 life forever start-time now
track 100 ip sla 100 reachability

View File

@@ -1,30 +0,0 @@
{% for user in users %}
{% if user.state is defined and user.state == 'absent' %}
no username {{ user.name }}
ip ssh pubkey-chain
no username {{ user.name }}
{% else %}
{% if user.password is not defined %}
username {{ user.name }} nopassword
{% elif user.password %}
username {{ user.name }} secret {{ user.password }}
{% endif %}
{% if user.privilege is defined %}
username {{ user.name }} privilege {{ user.privilege|string }}
{% endif %}
{% if user.view is defined %}
username {{ user.name }} view {{ user.view }}
{% endif %}
{% if user.sshkey is defined %}
ip ssh pubkey-chain
username {{ user.name }}
key-hash {{ user.sshkey }}
{% endif %}
{% endif %}
{% endfor %}

View File

@@ -1,2 +0,0 @@
flake8
yamllint

View File

@@ -1,12 +0,0 @@
---
- name: get config for verification
include_role:
name: "{{ config_manager_role }}"
vars:
ansible_network_provider: "{{ cisco_ios_role }}"
function: get
register: result
- assert:
that:
- routing == false

View File

@@ -1,61 +0,0 @@
---
- name: Include vars for load function tests
include_vars:
file: "{{ playbook_dir }}/../vars/load.yml"
- block:
- name: cleanup device configs
include_role:
name: "{{ config_manager_role }}"
vars:
ansible_network_provider: "{{ cisco_ios_role }}"
function: load
config_manager_text: "{{ setup_configs }}"
ios_config_rollback_enabled: false
ignore_errors: true
- name: load config via text string
include_role:
name: "{{ config_manager_role }}"
vars:
ansible_network_provider: "{{ cisco_ios_role }}"
function: load
config_manager_text: "{{ config_text_valid }}"
- assert:
that:
- "'No changes were found' not in ios_config_diff.stdout"
- name: set config_manager_text with all valid config to induce change in running-config
set_fact:
config_valid: "{{lookup('file', config_files_path + '/csr01_config_valid.j2')}}"
- name: load valid configurations into device using config file
include_role:
name: "{{ config_manager_role }}"
vars:
ansible_network_provider: "{{ cisco_ios_role }}"
function: load
config_manager_text: "{{ config_valid }}"
- assert:
that:
- "'No changes were found' not in ios_config_diff.stdout"
- name: set config_manager_text from lookup of a file with few invalid configs to test rollback
set_fact:
config_with_errors: "{{lookup('file', config_files_path + '/csr01_config_error.j2')}}"
- block:
- name: test rollback in case of wrong config using file
include_role:
name: "{{ config_manager_role }}"
vars:
ansible_network_provider: "{{ cisco_ios_role }}"
function: load
config_manager_text: "{{ config_with_errors }}"
register: result
rescue:
- assert:
that:
- "'Rollback Done' in ios_rollback_results.stdout"

View File

@@ -1,13 +0,0 @@
---
- hosts: csr01
gather_facts: false
tasks:
- name: Include vars
include_vars:
file: "{{ playbook_dir }}/../vars/default.yml"
- name: executing 'get' function tests
include_tasks: get.yml
- name: executing 'load' function tests
include_tasks: load.yml

View File

@@ -1,5 +0,0 @@
no router ospf 10
!
router ospf 10
network 14.1.1.0 0.0.0.255 area 1
neighbor 13.1.1.0 0.0.0.255 area 1

View File

@@ -1,5 +0,0 @@
no router ospf 10
!
router ospf 10
network 14.1.1.0 0.0.0.255 area 1
network 13.1.1.0 0.0.0.255 area 1

View File

@@ -1,6 +0,0 @@
---
# Vars for test env of ansible-network.cisco_ios role
config_manager_role: "{{ playbook_dir }}/../../../../../ansible-network.config_manager"
cisco_ios_role: "{{ playbook_dir }}/../../../../../ansible-network.cisco_ios"
config_files_path: "{{ playbook_dir }}/../templates/"

View File

@@ -1,9 +0,0 @@
---
# Vars specific to load test suite
#
setup_configs: "no interface loopback 100 \n
no router ospf 10 "
config_text_valid: "interface loopback 100 \n
description configured by config_manager role"

View File

@@ -1,3 +0,0 @@
---
- import_playbook: config_manager/tasks/main.yml

View File

@@ -1 +0,0 @@
localhost ansible_connection=local

View File

@@ -1,377 +0,0 @@
GigabitEthernet0/0/0 is up, line protocol is up
Hardware is 6XGE-BUILT-IN, address is e4aa.5df7.d500 (bia e4aa.5df7.d500)
Description: internal DMZ
Internet address is 1.1.1.1/27
MTU 1500 bytes, BW 1000000 Kbit/sec, DLY 10 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation ARPA, loopback not set
Keepalive not supported
Full Duplex, 1000Mbps, link type is auto, media type is SX
output flow-control is on, input flow-control is on
ARP type: ARPA, ARP Timeout 04:00:00
Last input 00:00:00, output 00:00:39, output hang never
Last clearing of "show interface" counters never
Input queue: 0/375/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue: 0/40 (size/max)
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
812732 packets input, 74259217 bytes, 0 no buffer
Received 6787 broadcasts (0 IP multicasts)
0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
0 watchdog, 775394 multicast, 0 pause input
21312 packets output, 8435730 bytes, 0 underruns
0 output errors, 0 collisions, 2 interface resets
39083 unknown protocol drops
0 babbles, 0 late collision, 0 deferred
0 lost carrier, 0 no carrier, 0 pause output
0 output buffer failures, 0 output buffers swapped out
GigabitEthernet0/0/1 is up, line protocol is up
Hardware is 6XGE-BUILT-IN, address is e4aa.5df7.d501 (bia e4aa.5df7.d501)
Description: external DMZ
Internet address is 2.2.2.2/27
MTU 1500 bytes, BW 1000000 Kbit/sec, DLY 10 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation ARPA, loopback not set
Keepalive not supported
Full Duplex, 1000Mbps, link type is auto, media type is SX
output flow-control is on, input flow-control is on
ARP type: ARPA, ARP Timeout 04:00:00
Last input 00:00:00, output 00:00:00, output hang never
Last clearing of "show interface" counters never
Input queue: 0/375/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue: 0/40 (size/max)
5 minute input rate 1000 bits/sec, 1 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
2661846 packets input, 183686421 bytes, 0 no buffer
Received 1753578 broadcasts (0 IP multicasts)
0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
0 watchdog, 833407 multicast, 0 pause input
65792 packets output, 11180901 bytes, 0 underruns
0 output errors, 0 collisions, 2 interface resets
40944 unknown protocol drops
0 babbles, 0 late collision, 0 deferred
0 lost carrier, 0 no carrier, 0 pause output
0 output buffer failures, 0 output buffers swapped out
GigabitEthernet0/0/2 is administratively down, line protocol is down
Hardware is 6XGE-BUILT-IN, address is e4aa.5df7.d502 (bia e4aa.5df7.d502)
Internet address is 3.3.3.3/29
MTU 1500 bytes, BW 1000000 Kbit/sec, DLY 10 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation ARPA, loopback not set
Keepalive not supported
Full Duplex, 1000Mbps, link type is auto, media type is unknown media type
output flow-control is unsupported, input flow-control is unsupported
ARP type: ARPA, ARP Timeout 04:00:00
Last input never, output never, output hang never
Last clearing of "show interface" counters never
Input queue: 0/375/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue: 0/40 (size/max)
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
0 packets input, 0 bytes, 0 no buffer
Received 0 broadcasts (0 IP multicasts)
0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
0 watchdog, 0 multicast, 0 pause input
0 packets output, 0 bytes, 0 underruns
0 output errors, 0 collisions, 1 interface resets
0 unknown protocol drops
0 babbles, 0 late collision, 0 deferred
0 lost carrier, 0 no carrier, 0 pause output
0 output buffer failures, 0 output buffers swapped out
GigabitEthernet0/0/3 is administratively down, line protocol is down
Hardware is 6XGE-BUILT-IN, address is e4aa.5df7.d503 (bia e4aa.5df7.d503)
MTU 1500 bytes, BW 1000000 Kbit/sec, DLY 10 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation ARPA, loopback not set
Keepalive not supported
Full Duplex, 1000Mbps, link type is auto, media type is unknown media type
output flow-control is unsupported, input flow-control is unsupported
ARP type: ARPA, ARP Timeout 04:00:00
Last input never, output never, output hang never
Last clearing of "show interface" counters never
Input queue: 0/375/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue: 0/40 (size/max)
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
0 packets input, 0 bytes, 0 no buffer
Received 0 broadcasts (0 IP multicasts)
0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
0 watchdog, 0 multicast, 0 pause input
0 packets output, 0 bytes, 0 underruns
0 output errors, 0 collisions, 1 interface resets
0 unknown protocol drops
0 babbles, 0 late collision, 0 deferred
0 lost carrier, 0 no carrier, 0 pause output
0 output buffer failures, 0 output buffers swapped out
GigabitEthernet0/0/3.2001 is administratively down, line protocol is down
Hardware is 6XGE-BUILT-IN, address is e4aa.5df7.d503 (bia e4aa.5df7.d503)
MTU 1500 bytes, BW 1000000 Kbit/sec, DLY 10 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation QinQ Virtual LAN, outer ID 2001, inner ID 100
ARP type: ARPA, ARP Timeout 04:00:00
Keepalive not supported
Last clearing of "show interface" counters never
GigabitEthernet0/0/4 is administratively down, line protocol is down
Hardware is 6XGE-BUILT-IN, address is e4aa.5df7.d504 (bia e4aa.5df7.d504)
MTU 1500 bytes, BW 1000000 Kbit/sec, DLY 10 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation ARPA, loopback not set
Keepalive not supported
Full Duplex, 1000Mbps, link type is auto, media type is unknown media type
output flow-control is unsupported, input flow-control is unsupported
ARP type: ARPA, ARP Timeout 04:00:00
Last input never, output never, output hang never
Last clearing of "show interface" counters never
Input queue: 0/375/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue: 0/40 (size/max)
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
0 packets input, 0 bytes, 0 no buffer
Received 0 broadcasts (0 IP multicasts)
0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
0 watchdog, 0 multicast, 0 pause input
0 packets output, 0 bytes, 0 underruns
0 output errors, 0 collisions, 1 interface resets
0 unknown protocol drops
0 babbles, 0 late collision, 0 deferred
0 lost carrier, 0 no carrier, 0 pause output
0 output buffer failures, 0 output buffers swapped out
GigabitEthernet0/0/5 is administratively down, line protocol is down
Hardware is 6XGE-BUILT-IN, address is e4aa.5df7.d505 (bia e4aa.5df7.d505)
MTU 1500 bytes, BW 1000000 Kbit/sec, DLY 10 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation ARPA, loopback not set
Keepalive not supported
Full Duplex, 1000Mbps, link type is auto, media type is unknown media type
output flow-control is unsupported, input flow-control is unsupported
ARP type: ARPA, ARP Timeout 04:00:00
Last input never, output never, output hang never
Last clearing of "show interface" counters never
Input queue: 0/375/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue: 0/40 (size/max)
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
0 packets input, 0 bytes, 0 no buffer
Received 0 broadcasts (0 IP multicasts)
0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
0 watchdog, 0 multicast, 0 pause input
0 packets output, 0 bytes, 0 underruns
0 output errors, 0 collisions, 1 interface resets
0 unknown protocol drops
0 babbles, 0 late collision, 0 deferred
0 lost carrier, 0 no carrier, 0 pause output
0 output buffer failures, 0 output buffers swapped out
GigabitEthernet0 is up, line protocol is up
Hardware is RP management port, address is e4aa.5df7.d540 (bia e4aa.5df7.d540)
Description: mgmt Interface
Internet address is 4.4.4.4/24
MTU 1500 bytes, BW 1000000 Kbit/sec, DLY 10 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation ARPA, loopback not set
Keepalive set (10 sec)
Full Duplex, 1000Mbps, link type is auto, media type is RJ45
output flow-control is unsupported, input flow-control is unsupported
ARP type: ARPA, ARP Timeout 04:00:00
Last input 00:00:00, output 00:00:00, output hang never
Last clearing of "show interface" counters never
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue: 0/40 (size/max)
5 minute input rate 4000 bits/sec, 7 packets/sec
5 minute output rate 1000 bits/sec, 1 packets/sec
6604971 packets input, 491265219 bytes, 0 no buffer
Received 4891144 broadcasts (0 IP multicasts)
0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
0 watchdog, 0 multicast, 0 pause input
190759 packets output, 22542951 bytes, 0 underruns
0 output errors, 0 collisions, 0 interface resets
18617 unknown protocol drops
0 babbles, 0 late collision, 0 deferred
0 lost carrier, 0 no carrier, 0 pause output
0 output buffer failures, 0 output buffers swapped out
Loopback0 is up, line protocol is up
Hardware is Loopback
MTU 1514 bytes, BW 8000000 Kbit/sec, DLY 5000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation LOOPBACK, loopback not set
Keepalive set (10 sec)
Last input never, output never, output hang never
Last clearing of "show interface" counters never
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue: 0/0 (size/max)
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
0 packets input, 0 bytes, 0 no buffer
Received 0 broadcasts (0 IP multicasts)
0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
0 packets output, 0 bytes, 0 underruns
0 output errors, 0 collisions, 0 interface resets
0 unknown protocol drops
0 output buffer failures, 0 output buffers swapped out
Tunnel0 is up, line protocol is down
Hardware is Tunnel
Description: Pim Register Tunnel (Encap) for RP 5.5.5.5
MTU 9972 bytes, BW 100 Kbit/sec, DLY 50000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation TUNNEL, loopback not set
Keepalive not set
Tunnel linestate evaluation down - no IPv4 tunnel source address
Tunnel source UNKNOWN, destination 5.5.5.5
Tunnel protocol/transport PIM/IPv4
Tunnel TTL 255
Tunnel transport MTU 1472 bytes
Tunnel is transmit only
Tunnel transmit bandwidth 8000 (kbps)
Tunnel receive bandwidth 8000 (kbps)
Last input never, output never, output hang never
Last clearing of "show interface" counters 1w5d
Input queue: 0/375/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue: 0/0 (size/max)
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
0 packets input, 0 bytes, 0 no buffer
Received 0 broadcasts (0 IP multicasts)
0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
0 packets output, 0 bytes, 0 underruns
0 output errors, 0 collisions, 0 interface resets
0 unknown protocol drops
0 output buffer failures, 0 output buffers swapped out
Tunnel1 is up, line protocol is up
Hardware is Tunnel
Description: tunnel for gloabl routing for c-hub
Internet address will be negotiated using IKEv2 Modeconfig
MTU 9976 bytes, BW 100 Kbit/sec, DLY 50000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation TUNNEL, loopback not set
Keepalive not set
Tunnel linestate evaluation up
Tunnel source 6.6.6.6 (GigabitEthernet0/0/1), destination 7.7.7.7
Tunnel Subblocks:
src-track:
Tunnel1 source tracking subblock associated with GigabitEthernet0/0/1
Set of tunnels with source GigabitEthernet0/0/1, 2 members (includes iterators), on interface <OK>
Tunnel protocol/transport GRE/IP
Key disabled, sequencing disabled
Checksumming of packets disabled
Tunnel TTL 255, Fast tunneling enabled
Path MTU Discovery, ager 10 mins, min MTU 92
Tunnel transport MTU 1476 bytes
Tunnel transmit bandwidth 8000 (kbps)
Tunnel receive bandwidth 8000 (kbps)
Last input never, output never, output hang never
Last clearing of "show interface" counters 1w5d
Input queue: 0/375/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue: 0/0 (size/max)
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
0 packets input, 0 bytes, 0 no buffer
Received 0 broadcasts (0 IP multicasts)
0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
0 packets output, 0 bytes, 0 underruns
0 output errors, 0 collisions, 0 interface resets
0 unknown protocol drops
0 output buffer failures, 0 output buffers swapped out
Tunnel2 is administratively down, line protocol is down
Hardware is Tunnel
Description: tunnel for gloabl routing for SJC
Internet address will be negotiated using IKEv2 Modeconfig
MTU 10000 bytes, BW 100 Kbit/sec, DLY 50000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation TUNNEL, loopback not set
Keepalive not set
Tunnel linestate evaluation down - interface not up
Tunnel source 8.8.8.8 (GigabitEthernet0/0/1), destination 9.9.9.9
Tunnel Subblocks:
src-track:
Tunnel2 source tracking subblock associated with GigabitEthernet0/0/1
Set of tunnels with source GigabitEthernet0/0/1, 2 members (includes iterators), on interface <OK>
Tunnel protocol/transport GRE/IP
Key disabled, sequencing disabled
Checksumming of packets disabled
Tunnel TTL 255, Fast tunneling enabled
Path MTU Discovery, ager 10 mins, min MTU 92
Tunnel transport MTU 1476 bytes
Tunnel transmit bandwidth 8000 (kbps)
Tunnel receive bandwidth 8000 (kbps)
Last input never, output never, output hang never
Last clearing of "show interface" counters 1w5d
Input queue: 0/375/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue: 0/0 (size/max)
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
0 packets input, 0 bytes, 0 no buffer
Received 0 broadcasts (0 IP multicasts)
0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
0 packets output, 0 bytes, 0 underruns
0 output errors, 0 collisions, 0 interface resets
0 unknown protocol drops
0 output buffer failures, 0 output buffers swapped out
Virtual-Access1 is down, line protocol is down
Hardware is Virtual Access interface
MTU 1500 bytes, BW 100000 Kbit/sec, DLY 100000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation PPP, LCP Closed
Base VtMgr vaccess
Vaccess status 0x0, loopback not set
Keepalive set (10 sec)
DTR is pulsed for 5 seconds on reset
Last input never, output never, output hang never
Last clearing of "show interface" counters 1w5d
Input queue: 0/4096/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue: 0/40 (size/max)
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
0 packets input, 0 bytes, 0 no buffer
Received 0 broadcasts (0 IP multicasts)
0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
0 packets output, 0 bytes, 0 underruns
0 output errors, 0 collisions, 0 interface resets
0 unknown protocol drops
0 output buffer failures, 0 output buffers swapped out
0 carrier transitions
Virtual-Template1 is down, line protocol is down
Hardware is Virtual Template interface
MTU 1500 bytes, BW 100000 Kbit/sec, DLY 100000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation PPP, LCP Closed, loopback not set
Keepalive set (10 sec)
DTR is pulsed for 5 seconds on reset
Last input never, output never, output hang never
Last clearing of "show interface" counters 1w5d
Input queue: 0/375/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue: 0/40 (size/max)
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
0 packets input, 0 bytes, 0 no buffer
Received 0 broadcasts (0 IP multicasts)
0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
0 packets output, 0 bytes, 0 underruns
0 output errors, 0 collisions, 0 interface resets
0 unknown protocol drops
0 output buffer failures, 0 output buffers swapped out
0 carrier transitions

View File

@@ -1,33 +0,0 @@
---
- name: 03.16.08.S.txt - parse `show interfaces`
command_parser:
file: "{{ playbook_dir }}/../parser_templates/cli/show_interfaces.yaml"
content: "{{ lookup('file', '{{ playbook_dir }}/parser_templates/cli/show_interfaces/03.16.08.S.txt') }}"
register: result
- name: 03.16.08.S.txt - test `show interfaces` parser
assert:
that:
- "'GigabitEthernet0' in interfaces"
- "'GigabitEthernet0/0/1' in interfaces"
- "'GigabitEthernet0/0/3.2001' in interfaces"
- "'GigabitEthernet0/0/5' in interfaces"
- "'Tunnel0' in interfaces"
- "'Virtual-Access1' in interfaces"
- interfaces['GigabitEthernet0']['admin-status'] == 'enabled'
- interfaces['GigabitEthernet0/0/1']['admin-status'] == 'enabled'
- interfaces['Tunnel0']['admin-status'] == 'enabled'
- interfaces['Tunnel0']['oper-status'] == 'down'
- interfaces['GigabitEthernet0']['counters']['in-broadcast-pkts'] == 4891144
- interfaces['GigabitEthernet0']['counters']['in-multicast-pkts'] == None
- interfaces['Virtual-Access1']['mtu'] == 1500
- interfaces['Tunnel2']['description'] == 'tunnel for gloabl routing for SJC'
- interfaces['GigabitEthernet0/0/5']['type'] == '6XGE-BUILT-IN'
- interfaces['Tunnel0']['type'] == 'Tunnel'
- "{{ interfaces|length == 14 }}"
### Done
- name: all tests complete
debug:
msg: "All tests for `show interfaces` passed"

View File

@@ -1,16 +0,0 @@
BGP router identifier 172.16.200.13, local AS number 64512
BGP table version is 79501, main routing table version 79501
2769 network entries using 686712 bytes of memory
5538 path entries using 664560 bytes of memory
3903/1952 BGP path/bestpath attribute entries using 967944 bytes of memory
1945 BGP AS-PATH entries using 77868 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 2397084 total bytes of memory
2766 received paths for inbound soft reconfiguration
BGP activity 18292/15523 prefixes, 74591/69053 paths, scan interval 60 secs
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
10.15.17.2 4 64785 748767 766529 79501 0 0 7w1d 1125
10.1.19.2 4 1234 0 0 1 0 0 00:00:30 Active
72.31.0.13 4 65004 0 0 1 0 0 10:32:44 Idle

View File

@@ -1,16 +0,0 @@
BGP router identifier 172.16.32.1, local AS number 65123
BGP table version is 3317, main routing table version 3317
140 network entries using 16380 bytes of memory
276 path entries using 14352 bytes of memory
1184/12 BGP path/bestpath attribute entries using 165760 bytes of memory
108 BGP AS-PATH entries using 2832 bytes of memory
84 BGP community entries using 2016 bytes of memory
74 BGP extended community entries using 1920 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 203260 total bytes of memory
BGP activity 2362466/2358636 prefixes, 9381389/9370747 paths, scan interval 60 secs
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
172.31.32.10 4 64910 5784429 5675902 3317 0 0 23w5d 114
172.16.32.1 4 65123 6281459 6288574 3317 0 0 28w5d 136

View File

@@ -1,14 +0,0 @@
BGP router identifier 10.29.19.69, local AS number 65312
BGP table version is 8405, main routing table version 8405
1390 network entries using 189040 bytes of memory
1390 path entries using 72280 bytes of memory
1016/1016 BGP path/bestpath attribute entries using 125984 bytes of memory
1008 BGP AS-PATH entries using 24516 bytes of memory
2 BGP extended community entries using 48 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 411868 total bytes of memory
BGP activity 3131/1741 prefixes, 4889/3499 paths, scan interval 60 secs
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
10.29.19.70 4 7474 78662 72306 8405 0 0 4d22h 1385

View File

@@ -1,95 +0,0 @@
---
### BGP not active
- name: not active - parse `show ip bgp summary`
command_parser:
file: "{{ playbook_dir }}/../parser_templates/cli/show_ip_bgp_summary.yaml"
content: "{{ lookup('file', '{{ playbook_dir }}/parser_templates/cli/show_ip_bgp_summary/bgp_not_active.txt') }}"
register: result
- name: not active - test `show ip bgp summary` parser
assert:
that:
- bgp['process_state'] == 'not active'
- name: clear facts
meta: clear_facts
### IOS 15.1(2)T5.txt
- name: 15.1(2)T5.txt - parse `show ip bgp summary`
command_parser:
file: "{{ playbook_dir }}/../parser_templates/cli/show_ip_bgp_summary.yaml"
content: "{{ lookup('file', '{{ playbook_dir }}/parser_templates/cli/show_ip_bgp_summary/15.1(2)T5.txt') }}"
register: result
- name: 15.1(2)T5.txt - test `show ip bgp summary` parser
assert:
that:
- "'10.29.19.70' in bgp['neighbors']"
- bgp['neighbors']['10.29.19.70']['state_pfxrcd'] | int == 1385
- bgp['neighbors']['10.29.19.70']['asn'] | int == 7474
- bgp['neighbors']['10.29.19.70']['ip_version'] | int == 4
- bgp['neighbors']['10.29.19.70']['timer'] == '4d22h'
- name: clear facts
meta: clear_facts
### IOS 12.2(33)SXH5.txt
- name: 12.2(33)SXH5.txt - parse `show ip bgp summary`
command_parser:
file: "{{ playbook_dir }}/../parser_templates/cli/show_ip_bgp_summary.yaml"
content: "{{ lookup('file', '{{ playbook_dir }}/parser_templates/cli/show_ip_bgp_summary/12.2(33)SXH5.txt') }}"
register: result
- name: 12.2(33)SXH5.txt - test `show ip bgp summary` parser
assert:
that:
- "'172.31.32.10' in bgp['neighbors']"
- "'172.16.32.1' in bgp['neighbors']"
- bgp['neighbors']['172.31.32.10']['state_pfxrcd'] | int == 114
- bgp['neighbors']['172.31.32.10']['asn'] | int == 64910
- bgp['neighbors']['172.31.32.10']['ip_version'] | int == 4
- bgp['neighbors']['172.31.32.10']['timer'] == '23w5d'
- bgp['neighbors']['172.16.32.1']['state_pfxrcd'] | int == 136
- bgp['neighbors']['172.16.32.1']['asn'] | int == 65123
- bgp['neighbors']['172.16.32.1']['ip_version'] | int == 4
- "'{{ bgp['neighbors']['172.16.32.1']['timer'] | string }}' == '28w5d'"
- name: clear facts
meta: clear_facts
### IOS-XE 03.14.00.S
- name: 03.14.00.S.txt - parse `show ip bgp summary`
command_parser:
file: "{{ playbook_dir }}/../parser_templates/cli/show_ip_bgp_summary.yaml"
content: "{{ lookup('file', '{{ playbook_dir }}/parser_templates/cli/show_ip_bgp_summary/03.14.00.S.txt') }}"
register: result
- name: 03.14.00.S.txt - test `show ip bgp summary` parser
assert:
that:
- "'10.15.17.2' in bgp['neighbors']"
- "'10.1.19.2' in bgp['neighbors']"
- "'72.31.0.13' in bgp['neighbors']"
- bgp['neighbors']['10.15.17.2']['state_pfxrcd'] | int == 1125
- bgp['neighbors']['10.15.17.2']['asn'] | int == 64785
- bgp['neighbors']['10.15.17.2']['ip_version'] | int == 4
- bgp['neighbors']['10.15.17.2']['timer'] == '7w1d'
- bgp['neighbors']['10.1.19.2']['state_pfxrcd'] == 'Active'
- bgp['neighbors']['10.1.19.2']['asn'] | int == 1234
- bgp['neighbors']['10.1.19.2']['ip_version'] | int == 4
- "'{{ bgp['neighbors']['10.1.19.2']['timer'] | string }}' == '00:00:30'"
- bgp['neighbors']['72.31.0.13']['state_pfxrcd'] == 'Idle'
- bgp['neighbors']['72.31.0.13']['asn'] | int == 65004
- bgp['neighbors']['72.31.0.13']['ip_version'] | int == 4
- "'{{ bgp['neighbors']['72.31.0.13']['timer'] | string }}' == '10:32:44'"
### Done
- name: all tests complete
debug:
msg: "All tests for `show ip bgp summary` passed"

View File

@@ -1,47 +0,0 @@
VRF Mgmt-intf (VRF Id = 1); default RD <not set>; default VPNID <not set>
New CLI format, supports multiple address-families
Flags: 0x1808
Interfaces:
Gi0
Address family ipv4 unicast (Table ID = 0x1):
Flags: 0x0
No Export VPN route-target communities
No Import VPN route-target communities
No import route-map
No global export route-map
No export route-map
VRF label distribution protocol: not configured
VRF label allocation mode: per-prefix
VRF Def (VRF Id = 2); default RD 65000:20; default VPNID <not set>
Description: Def VPN
Old CLI format, supports IPv4 only
Flags: 0xC
Interfaces:
Lo20 Tu20 Gi0/0/1.211
Gi0/0/2.1721
Address family ipv4 unicast (Table ID = 0x7):
Flags: 0x0
No Export VPN route-target communities
No Import VPN route-target communities
No import route-map
No global export route-map
No export route-map
VRF label distribution protocol: not configured
VRF label allocation mode: per-prefix
VRF XYzzz0-1-9 (VRF Id = 3); default RD 65000:19; default VPNID <not set>
Description: XYzzz0-1-9 VPN
Old CLI format, supports IPv4 only
Flags: 0xC
Interfaces:
Lo19 Tu19 Gi0/0/1.19
Address family ipv4 unicast (Table ID = 0x4):
Flags: 0x0
No Export VPN route-target communities
No Import VPN route-target communities
No import route-map
No global export route-map
No export route-map
VRF label distribution protocol: not configured
VRF label allocation mode: per-prefix

View File

@@ -1,47 +0,0 @@
VRF ABC; default RD 65000:12; default VPNID <not set>
Description: ABC VPN
Interfaces:
Te7/3.16
VRF Table ID = 45
Export VPN route-target communities
RT:65000:12
Import VPN route-target communities
RT:65000:12
No import route-map
No export route-map
VRF label distribution protocol: not configured
VRF label allocation mode: per-prefix
vrf-conn-aggr for connected and BGP aggregates (Label 1706)
VRF Def; default RD 65000:13; default VPNID <not set>
Description: Def VPN
Interfaces:
Vl190 Vl193 Lo10
Vl85 Vl194 Vl19
Vl191 Te7/3.194
VRF Table ID = 1
Export VPN route-target communities
RT:65000:13 RT:65000:120 RT:65000:130
RT:123:123
Import VPN route-target communities
RT:65000:13 RT:65000:14
No import route-map
No export route-map
VRF label distribution protocol: not configured
VRF label allocation mode: per-prefix
vrf-conn-aggr for connected and BGP aggregates (Label 16)
VRF XYzzz0-1-9; default RD 65111:100; default VPNID <not set>
Description: A random description
Interfaces:
Vl777 Gi7/3.30
VRF Table ID = 6
Export VPN route-target communities
RT:65000:100
Import VPN route-target communities
RT:65000:100
No import route-map
No export route-map
VRF label distribution protocol: not configured
VRF label allocation mode: per-prefix
vrf-conn-aggr for connected and BGP aggregates (Label 1446)

View File

@@ -1,58 +0,0 @@
---
### IOS 12.2(33)SXH5
- name: parse 12.2(33)SXH5 - `show ip vrf detail`
command_parser:
file: "{{ playbook_dir }}/../parser_templates/cli/show_ip_vrf_detail.yaml"
content: "{{ lookup('file', '{{ playbook_dir }}/parser_templates/cli/show_ip_vrf_detail/12.2(33)SXH5.txt') }}"
register: result
- name: test 12.2(33)SXH5 - `show ip vrf detail`
assert:
that:
- "'ABC' in vrfs"
- "'XYzzz0-1-9' in vrfs"
- "'Def' in vrfs"
- vrfs.ABC.rd == '65000:12'
- vrfs.ABC.description == 'ABC VPN'
- vrfs['ABC']['export_rt'] == ['65000:12']
- vrfs['ABC']['import_rt'] == ['65000:12']
- vrfs['ABC']['interface'] == ['Te7/3.16']
- vrfs['Def']['rd'] == '65000:13'
- vrfs['Def']['description'] == 'Def VPN'
- vrfs['Def']['export_rt'] == ['65000:13','65000:120','65000:130','123:123']
- vrfs['Def']['import_rt'] == ['65000:13','65000:14']
- vrfs['Def']['interface'] == ['Vl190','Vl193','Lo10','Vl85','Vl194','Vl19','Vl191','Te7/3.194']
- vrfs['XYzzz0-1-9']['rd'] == '65111:100'
- vrfs['XYzzz0-1-9']['description'] == 'A random description'
- vrfs['XYzzz0-1-9']['export_rt'] == ['65000:100']
- vrfs['XYzzz0-1-9']['import_rt'] == ['65000:100']
- vrfs['XYzzz0-1-9']['interface'] == ['Vl777','Gi7/3.30']
- name: clear facts
meta: clear_facts
### IOS 03.14.00.S
- name: parse 03.14.00.S - `show ip vrf detail`
command_parser:
file: "{{ playbook_dir }}/../parser_templates/cli/show_ip_vrf_detail.yaml"
content: "{{ lookup('file', '{{ playbook_dir }}/parser_templates/cli/show_ip_vrf_detail/03.14.00.S.txt') }}"
register: result
- name: test `03.14.00.S - show ip vrf detail`
assert:
that:
- "'Mgmt-intf' in vrfs"
- "'Def' in vrfs"
- "'XYzzz0-1-9' in vrfs"
- vrfs['Def']['rd'] == '65000:20'
- vrfs['Def']['description'] == 'Def VPN'
- vrfs['Def']['interface'] == ['Lo20','Tu20','Gi0/0/1.211','Gi0/0/2.1721']
- vrfs['XYzzz0-1-9']['rd'] == '65000:19'
- vrfs['XYzzz0-1-9']['interface'] == ['Lo19','Tu19','Gi0/0/1.19']
### Done
- name: all tests complete
debug:
msg: "All tests for `show ip vrf detail` passed"

View File

@@ -1,65 +0,0 @@
Cisco IOS Software, C2900 Software (C2900-UNIVERSALK9-M), Version 15.1(4)M4, RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2012 by Cisco Systems, Inc.
Compiled Tue 20-Mar-12 18:57 by prod_rel_team
ROM: System Bootstrap, Version 15.0(1r)M16, RELEASE SOFTWARE (fc1)
CANVLPST_R2 uptime is 9 weeks, 5 days, 17 hours, 53 minutes
System returned to ROM by reload at 18:48:21 UTC Tue Oct 9 2018
System restarted at 18:49:38 UTC Tue Oct 9 2018
System image file is "flash:c2900-universalk9-mz.SPA.151-4.M4.bin"
Last reload type: Normal Reload
Last reload reason: Reload Command
This product contains cryptographic features and is subject to United
States and local country laws governing import, export, transfer and
use. Delivery of Cisco cryptographic products does not imply
third-party authority to import, export, distribute or use encryption.
Importers, exporters, distributors and users are responsible for
compliance with U.S. and local country laws. By using this product you
agree to comply with applicable laws and regulations. If you are unable
to comply with U.S. and local laws, return this product immediately.
A summary of U.S. laws governing Cisco cryptographic products may be found at:
http://www.cisco.com/wwl/export/crypto/tool/stqrg.html
If you require further assistance please contact us by sending email to
export@cisco.com.
Cisco CISCO2921/K9 (revision 1.0) with 2547648K/73728K bytes of memory.
Processor board ID FGL171712S5
3 Gigabit Ethernet interfaces
1 terminal line
1 Virtual Private Network (VPN) Module
DRAM configuration is 64 bits wide with parity enabled.
255K bytes of non-volatile configuration memory.
999936K bytes of ATA System CompactFlash 0 (Read/Write)
License Info:
License UDI:
-------------------------------------------------
Device# PID SN
-------------------------------------------------
*0 CISCO2921/K9 FGL171712S5
Technology Package License Information for Module:'c2900'
-----------------------------------------------------------------
Technology Technology-package Technology-package
Current Type Next reboot
------------------------------------------------------------------
ipbase ipbasek9 Permanent ipbasek9
security securityk9 Permanent securityk9
uc uck9 Permanent uck9
data datak9 Permanent datak9
Configuration register is 0x2102

View File

@@ -1,65 +0,0 @@
Cisco IOS XE Software, Version 03.14.00.S - Standard Support Release
Cisco IOS Software, ISR Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 15.5(1)S, RELEASE SOFTWARE (fc5)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2014 by Cisco Systems, Inc.
Compiled Thu 20-Nov-14 18:28 by mcpre
Cisco IOS-XE software, Copyright (c) 2005-2014 by cisco Systems, Inc.
All rights reserved. Certain components of Cisco IOS-XE software are
licensed under the GNU General Public License ("GPL") Version 2.0. The
software code licensed under GPL Version 2.0 is free software that comes
with ABSOLUTELY NO WARRANTY. You can redistribute and/or modify such
GPL code under the terms of GPL Version 2.0. For more details, see the
documentation or "License Notice" file accompanying the IOS-XE software,
or the applicable URL provided on the flyer accompanying the IOS-XE
software.
ROM: IOS-XE ROMMON
ios-xe-1 uptime is 21 weeks, 23 hours, 27 minutes
Uptime for this control processor is 21 weeks, 23 hours, 28 minutes
System returned to ROM by reload at 09:55:44 UTC Wed Jun 13 2018
System restarted at 09:58:28 UTC Wed Jun 13 2018
System image file is "bootflash:isr4400-universalk9.03.14.00.S.155-1.S-std.SPA.bin"
Last reload reason: Reload Command
This product contains cryptographic features and is subject to United
States and local country laws governing import, export, transfer and
use. Delivery of Cisco cryptographic products does not imply
third-party authority to import, export, distribute or use encryption.
Importers, exporters, distributors and users are responsible for
compliance with U.S. and local country laws. By using this product you
agree to comply with applicable laws and regulations. If you are unable
to comply with U.S. and local laws, return this product immediately.
A summary of U.S. laws governing Cisco cryptographic products may be found at:
http://www.cisco.com/wwl/export/crypto/tool/stqrg.html
If you require further assistance please contact us by sending email to
export@cisco.com.
Technology Package License Information:
-----------------------------------------------------------------
Technology Technology-package Technology-package
Current Type Next reboot
------------------------------------------------------------------
appx appxk9 Permanent appxk9
uc None None None
security securityk9 Permanent securityk9
ipbase ipbasek9 Permanent ipbasek9
cisco ISR4431/K9 (1RU) processor with 7825388K/6147K bytes of memory.
Processor board ID FGL2051117T
4 Gigabit Ethernet interfaces
32768K bytes of non-volatile configuration memory.
16777216K bytes of physical memory.
14659583K bytes of flash memory at bootflash:.
Configuration register is 0x2102

Some files were not shown because too many files have changed in this diff Show More