mirror of
https://github.com/ansible-collections/community.routeros.git
synced 2025-08-31 07:09:23 +02:00
Compare commits
318 commits
Author | SHA1 | Date | |
---|---|---|---|
|
8a2bb5e746 | ||
|
f6aeae1abd | ||
|
fb070e4ac6 | ||
|
db716c1368 | ||
|
3b05f8a4cd | ||
|
e40a3b011c | ||
|
e301f822d7 | ||
|
7395011b0c | ||
|
8edc8018a7 | ||
|
e78df4a4cf | ||
|
c9d15bc43a | ||
|
008b5f893a | ||
|
b70b4a72b3 | ||
|
1f38be9e56 | ||
|
e988b18acf | ||
|
6e9d2e1379 | ||
|
1c182725ce | ||
|
9099fcd698 | ||
|
852e21a2f2 | ||
|
bb7eadbc9f | ||
|
d9be02bdb8 | ||
|
3475751b30 | ||
|
6008397375 | ||
|
b751d79a98 | ||
|
aa83116c78 | ||
|
4571d777de | ||
|
c7b2275f2c | ||
|
49e4b83594 | ||
|
88806047e3 | ||
|
221a697af9 | ||
|
ab1026504c | ||
|
bfd6b0bb13 | ||
|
f5b952751e | ||
|
5b81c157fe | ||
|
08152376de | ||
|
3af45c33f1 | ||
|
e52978b6d2 | ||
|
d1db4bec92 | ||
|
180e87fd5d | ||
|
81237dbde4 | ||
|
770e4d2c8d | ||
|
4b9925ac23 | ||
|
e286d768c0 | ||
|
9dba8082f9 | ||
|
3a34752296 | ||
|
a920caa16a | ||
|
9d382a1b10 | ||
|
2b1be7f011 | ||
|
8736996317 | ||
|
30a79061f3 | ||
|
ab446b4449 | ||
|
be9a7ed3ad | ||
|
6aaead1d4a | ||
|
ffc928242b | ||
|
f54244b7d0 | ||
|
3ba33ccd99 | ||
|
e302fed6cf | ||
|
9e4b6c197d | ||
|
a9f787fd76 | ||
|
f6d50f8cc5 | ||
|
388366542d | ||
|
575af30d88 | ||
|
85d24d180e | ||
|
11454b802e | ||
|
364ef6c5fe | ||
|
1466c9f984 | ||
|
dcdca90dd0 | ||
|
4241179471 | ||
|
71882863a5 | ||
|
44e6bb6f7a | ||
|
2a3460827d | ||
|
1e0c582b98 | ||
|
539119c57d | ||
|
77de6d90bf | ||
|
995ab18e7b | ||
|
a7340eae1a | ||
|
0bf4b3ef8c | ||
|
c3e57efa9d | ||
|
8dbad9a8d4 | ||
|
c27c1906aa | ||
|
249b1a92e2 | ||
|
14d89a3cfa | ||
|
d44262d820 | ||
|
5936c1ecef | ||
|
5fdbd52303 | ||
|
e18de43407 | ||
|
26e3aa3e0a | ||
|
031490c974 | ||
|
c5e913fc13 | ||
|
b499d9d7d9 | ||
|
945e4d4d45 | ||
|
22ff089787 | ||
|
5adc664b04 | ||
|
c864078549 | ||
|
ff7e6162d7 | ||
|
fed11d36f7 | ||
|
136250a802 | ||
|
1942b3ddbb | ||
|
89b34bdd79 | ||
|
8158d90d79 | ||
|
6c2101d4d8 | ||
|
274e249f26 | ||
|
b4ea8b2fe7 | ||
|
5fb0bf0212 | ||
|
1a2faec1c0 | ||
|
0a9b749508 | ||
|
49cd8a2b2f | ||
|
1859ef9d35 | ||
|
877c9fa4fe | ||
|
78466d0de4 | ||
|
6986e2fc25 | ||
|
64ee613a0d | ||
|
ba806c0593 | ||
|
8c62d46198 | ||
|
5ee2af49b8 | ||
|
971145b284 | ||
|
f1232ee637 | ||
|
a6361844cd | ||
|
05de3f2f05 | ||
|
d7b7f32e16 | ||
|
f45c85b818 | ||
|
3c717e40f9 | ||
|
c2b43ac395 | ||
|
a6d2580a9e | ||
|
91fef4e3a9 | ||
|
dc7fa11f5d | ||
|
2f46ff03fd | ||
|
d1be11ec08 | ||
|
f43a5ce446 | ||
|
6aebd8e359 | ||
|
f5e8213498 | ||
|
331a97b12d | ||
|
1953a79942 | ||
|
24caea65d1 | ||
|
6116cde9dd | ||
|
3862d1cea7 | ||
|
4a078c5913 | ||
|
9d34cca66b | ||
|
018125ddfa | ||
|
c6be3918ec | ||
|
18deb0b46b | ||
|
55817c112a | ||
|
6fde8f3baf | ||
|
78d2fdd0f2 | ||
|
62a795f995 | ||
|
59f6591621 | ||
|
99581a00f7 | ||
|
506b3eba39 | ||
|
8351bff0e9 | ||
|
a3fbe88f2f | ||
|
edcd760dbf | ||
|
10a419465a | ||
|
d8ae2f41d2 | ||
|
3d737d679d | ||
|
2ea1fef535 | ||
|
84009262d0 | ||
|
ffd5a6370c | ||
|
f616004caf | ||
|
afdda50ab0 | ||
|
232a013c64 | ||
|
10fbc564a7 | ||
|
6f7abfa8bc | ||
|
542a362cee | ||
|
d1401bdb58 | ||
|
b56ba388f9 | ||
|
3777b283b2 | ||
|
d5a2686d20 | ||
|
79dabbb67e | ||
|
56ce47aef5 | ||
|
9c75b9c5cd | ||
|
1d6feda0b7 | ||
|
e4e5f64b46 | ||
|
4fff1f1bbb | ||
|
a1492b4405 | ||
|
9b1b28599f | ||
|
332955aff5 | ||
|
c5e51f9a93 | ||
|
482e5b2b7e | ||
|
ac89aa0ab7 | ||
|
eda8f64e8d | ||
|
ad6faf275d | ||
|
7de154e907 | ||
|
dac3b79a17 | ||
|
92c6226394 | ||
|
479f3106bf | ||
|
1beddb5854 | ||
|
a823d66b33 | ||
|
8a4b37c909 | ||
|
46d77ccc5c | ||
|
6a68469209 | ||
|
a6979c7f3d | ||
|
226649ac13 | ||
|
9b4774c78d | ||
|
29a01ea240 | ||
|
efbc05ef73 | ||
|
dc110500db | ||
|
170240480c | ||
|
d235437f8f | ||
|
f6ed27c588 | ||
|
81c4186497 | ||
|
d601e10e22 | ||
|
2bbaf26484 | ||
|
cf6c79e1b3 | ||
|
4d8ebaeb8d | ||
|
2350913075 | ||
|
dcc1cf441d | ||
|
4b0995135c | ||
|
1ed4690240 | ||
|
38ac303f93 | ||
|
193218446a | ||
|
b7569b9dfd | ||
|
adff9bbf8c | ||
|
11d83bffe6 | ||
|
b0a4743de8 | ||
|
343c4883c0 | ||
|
2164261e09 | ||
|
1aa41ad375 | ||
|
e4a21311a1 | ||
|
2e1159b4c4 | ||
|
3b127b12fa | ||
|
ed2f326a6a | ||
|
53bb84ba2a | ||
|
d6f90e6937 | ||
|
6e62283120 | ||
|
e570c582d0 | ||
|
553a77aa91 | ||
|
13e68fc906 | ||
|
61c6b1dca8 | ||
|
ce7b2ef144 | ||
|
9d505ce903 | ||
|
2333efcf0f | ||
|
2e78a207e9 | ||
|
08c8c7ecc8 | ||
|
1fb6915819 | ||
|
b7ef2fe1f8 | ||
|
af28e6419f | ||
|
d098c209e7 | ||
|
9cfb31ab18 | ||
|
42ea132d60 | ||
|
2b8c66b983 | ||
|
4ec0945e55 | ||
|
dd1e48c388 | ||
|
e5eff0b90e | ||
|
a7f47c0419 | ||
|
0caec0f2c3 | ||
|
189088611d | ||
|
c1bd819db5 | ||
|
07a3311792 | ||
|
c1a6ae8658 | ||
|
4329928474 | ||
|
071f742100 | ||
|
720debb323 | ||
|
4d86ba1a7d | ||
|
ab87a27018 | ||
|
bbf5be5d71 | ||
|
d39b3522ab | ||
|
1dfa79c5ef | ||
|
622680fe3f | ||
|
e7dafebc7a | ||
|
7166a0b35c | ||
|
f38b01d7bb | ||
|
d2caf56215 | ||
|
709abfb13f | ||
|
586edbc211 | ||
|
62da7dd4e3 | ||
|
8e3b19759d | ||
|
282439b356 | ||
|
d37ec11ac5 | ||
|
f935a41b8a | ||
|
5fa47579af | ||
|
215576fa1b | ||
|
78f1236942 | ||
|
f58727e53b | ||
|
338a8f2cd6 | ||
|
4376906ed0 | ||
|
4ed2fc82e5 | ||
|
38e00caedb | ||
|
61b28ba22d | ||
|
0f5ac3f061 | ||
|
14ba81ac60 | ||
|
d1ff3b2730 | ||
|
309e2b1910 | ||
|
5af14a8940 | ||
|
23b3aa3beb | ||
|
1353055fe2 | ||
|
b539ed6aa4 | ||
|
4194ae9ba6 | ||
|
c48f4c74ce | ||
|
29247faaa3 | ||
|
60427fff5e | ||
|
ad9d7c3829 | ||
|
9567bbf292 | ||
|
78d8cfb1ad | ||
|
9fc22be186 | ||
|
558eb501d2 | ||
|
1e36dfa2d0 | ||
|
c2e58c3ae4 | ||
|
3b3d2171b4 | ||
|
fc0d483848 | ||
|
835cec5e24 | ||
|
29b604464a | ||
|
bbcd9fecef | ||
|
6526588f13 | ||
|
5affbf6b05 | ||
|
7500dceb8e | ||
|
fb0340c6e6 | ||
|
3c0ad57eb5 | ||
|
776b599ffe | ||
|
47bbf95fa3 | ||
|
d77cd95f91 | ||
|
615b9e6952 | ||
|
a642f0b9eb | ||
|
f797b4a231 | ||
|
a2ace3fb79 | ||
|
96c6feff8e | ||
|
ec98df2f49 | ||
|
98bb520ce7 | ||
|
af6524a1fd |
128 changed files with 11911 additions and 3525 deletions
6
.git-blame-ignore-revs
Normal file
6
.git-blame-ignore-revs
Normal file
|
@ -0,0 +1,6 @@
|
|||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
# Reformat YAML: https://github.com/ansible-collections/community.routeros/pull/369
|
||||
08152376de116e7d933d19ee25318f7a2eb222ae
|
15
.github/dependabot.yml
vendored
Normal file
15
.github/dependabot.yml
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
groups:
|
||||
ci:
|
||||
patterns:
|
||||
- "*"
|
212
.github/workflows/ansible-test.yml
vendored
212
.github/workflows/ansible-test.yml
vendored
|
@ -1,212 +0,0 @@
|
|||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
name: CI
|
||||
on:
|
||||
# Run CI against all pushes (direct commits, also merged PRs), Pull Requests
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- stable-*
|
||||
pull_request:
|
||||
# Run CI once per day (at 05:15 UTC)
|
||||
schedule:
|
||||
- cron: '15 5 * * *'
|
||||
|
||||
jobs:
|
||||
|
||||
###
|
||||
# Sanity tests (REQUIRED)
|
||||
#
|
||||
# https://docs.ansible.com/ansible/latest/dev_guide/testing_sanity.html
|
||||
|
||||
sanity:
|
||||
name: Sanity (Ⓐ${{ matrix.ansible }})
|
||||
strategy:
|
||||
matrix:
|
||||
ansible:
|
||||
# It's important that Sanity is tested against all stable-X.Y branches
|
||||
# Testing against `devel` may fail as new tests are added.
|
||||
- stable-2.9
|
||||
- stable-2.10
|
||||
- stable-2.11
|
||||
- stable-2.12
|
||||
- stable-2.13
|
||||
- devel
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
# ansible-test requires the collection to be in a directory in the form
|
||||
# .../ansible_collections/community/routeros/
|
||||
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: ansible_collections/community/routeros
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v3
|
||||
with:
|
||||
# it is just required to run that once as "ansible-test sanity" in the docker image
|
||||
# will run on all python versions it supports.
|
||||
python-version: '3.10'
|
||||
|
||||
# Install the head of the given branch (devel, stable-2.10)
|
||||
- name: Install ansible-base (${{ matrix.ansible }})
|
||||
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check
|
||||
|
||||
- name: Install collection dependencies
|
||||
run: git clone --depth=1 --single-branch https://github.com/ansible-collections/ansible.netcommon.git ansible_collections/ansible/netcommon
|
||||
# NOTE: we're installing with git to work around Galaxy being a huge PITA (https://github.com/ansible/galaxy/issues/2429)
|
||||
# run: ansible-galaxy collection install ansible.netcommon -p .
|
||||
|
||||
# run ansible-test sanity inside of Docker.
|
||||
# The docker container has all the pinned dependencies that are required
|
||||
# and all python versions ansible supports.
|
||||
- name: Run sanity tests
|
||||
run: ansible-test sanity --docker -v --color --coverage
|
||||
working-directory: ./ansible_collections/community/routeros
|
||||
|
||||
# ansible-test support producing code coverage date
|
||||
- name: Generate coverage report
|
||||
run: ansible-test coverage xml -v --requirements --group-by command --group-by version
|
||||
working-directory: ./ansible_collections/community/routeros
|
||||
|
||||
# See the reports at https://codecov.io/gh/ansible_collections/ansible-collections/community.routeros
|
||||
- uses: codecov/codecov-action@v3
|
||||
with:
|
||||
fail_ci_if_error: false
|
||||
|
||||
###
|
||||
# Unit tests (OPTIONAL)
|
||||
#
|
||||
# https://docs.ansible.com/ansible/latest/dev_guide/testing_units.html
|
||||
|
||||
units:
|
||||
runs-on: ubuntu-latest
|
||||
name: Units (Ⓐ${{ matrix.ansible }})
|
||||
strategy:
|
||||
# As soon as the first unit test fails, cancel the others to free up the CI queue
|
||||
fail-fast: true
|
||||
matrix:
|
||||
ansible:
|
||||
- stable-2.9
|
||||
- stable-2.10
|
||||
- stable-2.11
|
||||
- stable-2.12
|
||||
- stable-2.13
|
||||
- devel
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: ansible_collections/community/routeros
|
||||
|
||||
- name: Set up Python ${{ matrix.ansible }}
|
||||
uses: actions/setup-python@v3
|
||||
with:
|
||||
python-version: '3.10'
|
||||
|
||||
- name: Install ansible-base (${{ matrix.ansible }})
|
||||
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check
|
||||
|
||||
- name: Install collection dependencies
|
||||
run: git clone --depth=1 --single-branch https://github.com/ansible-collections/ansible.netcommon.git ansible_collections/ansible/netcommon
|
||||
# NOTE: we're installing with git to work around Galaxy being a huge PITA (https://github.com/ansible/galaxy/issues/2429)
|
||||
# run: ansible-galaxy collection install ansible.netcommon -p .
|
||||
|
||||
# Run the unit tests
|
||||
- name: Run unit tests for all Python versions
|
||||
run: ansible-test units -v --color --docker --coverage
|
||||
working-directory: ./ansible_collections/community/routeros
|
||||
|
||||
# ansible-test support producing code coverage date
|
||||
- name: Generate coverage report
|
||||
run: ansible-test coverage xml -v --requirements --group-by command --group-by version
|
||||
working-directory: ./ansible_collections/community/routeros
|
||||
|
||||
# See the reports at https://codecov.io/gh/ansible_collections/ansible-collections/community.routeros
|
||||
- uses: codecov/codecov-action@v3
|
||||
with:
|
||||
fail_ci_if_error: false
|
||||
|
||||
###
|
||||
# Integration tests (RECOMMENDED)
|
||||
#
|
||||
# https://docs.ansible.com/ansible/latest/dev_guide/testing_integration.html
|
||||
|
||||
integration:
|
||||
runs-on: ubuntu-latest
|
||||
name: I (Ⓐ${{ matrix.ansible }}+py${{ matrix.python }})
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
ansible:
|
||||
- devel
|
||||
python:
|
||||
- 3.9
|
||||
- "3.10"
|
||||
- "3.11"
|
||||
include:
|
||||
# 2.9
|
||||
- ansible: stable-2.9
|
||||
python: 2.7
|
||||
- ansible: stable-2.9
|
||||
python: 3.5
|
||||
# 2.10
|
||||
- ansible: stable-2.10
|
||||
python: 3.5
|
||||
# 2.11
|
||||
- ansible: stable-2.11
|
||||
python: 2.7
|
||||
- ansible: stable-2.11
|
||||
python: 3.6
|
||||
# 2.12
|
||||
- ansible: stable-2.12
|
||||
python: 3.8
|
||||
- ansible: stable-2.12
|
||||
python: "3.10"
|
||||
# 2.13
|
||||
- ansible: stable-2.13
|
||||
python: 3.8
|
||||
- ansible: stable-2.13
|
||||
python: "3.10"
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: ansible_collections/community/routeros
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v3
|
||||
with:
|
||||
# it is just required to run that once as "ansible-test integration" in the docker image
|
||||
# will run on all python versions it supports.
|
||||
python-version: '3.10'
|
||||
|
||||
- name: Install ansible-core (${{ matrix.ansible }})
|
||||
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check
|
||||
|
||||
- name: Install collection dependencies
|
||||
run: git clone --depth=1 --single-branch https://github.com/ansible-collections/ansible.netcommon.git ansible_collections/ansible/netcommon
|
||||
# NOTE: we're installing with git to work around Galaxy being a huge PITA (https://github.com/ansible/galaxy/issues/2429)
|
||||
# run: ansible-galaxy collection install ansible.netcommon -p .
|
||||
|
||||
# Run the integration tests
|
||||
- name: Run integration test
|
||||
run: ansible-test integration -v --color --retry-on-error --continue-on-error --diff --python ${{ matrix.python }} --docker --coverage
|
||||
working-directory: ./ansible_collections/community/routeros
|
||||
|
||||
# ansible-test support producing code coverage date
|
||||
- name: Generate coverage report
|
||||
run: ansible-test coverage xml -v --requirements --group-by command --group-by version
|
||||
working-directory: ./ansible_collections/community/routeros
|
||||
|
||||
# See the reports at https://codecov.io/gh/ansible-collections/community.routeros
|
||||
- uses: codecov/codecov-action@v3
|
||||
with:
|
||||
fail_ci_if_error: false
|
50
.github/workflows/docs-pr.yml
vendored
50
.github/workflows/docs-pr.yml
vendored
|
@ -5,12 +5,15 @@
|
|||
|
||||
name: Collection Docs
|
||||
concurrency:
|
||||
group: docs-${{ github.head_ref }}
|
||||
group: docs-pr-${{ github.head_ref }}
|
||||
cancel-in-progress: true
|
||||
on:
|
||||
'on':
|
||||
pull_request_target:
|
||||
types: [opened, synchronize, reopened, closed]
|
||||
|
||||
env:
|
||||
GHP_BASE_URL: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}
|
||||
|
||||
jobs:
|
||||
build-docs:
|
||||
permissions:
|
||||
|
@ -18,14 +21,42 @@ jobs:
|
|||
name: Build Ansible Docs
|
||||
uses: ansible-community/github-docs-build/.github/workflows/_shared-docs-build-pr.yml@main
|
||||
with:
|
||||
collection-name: community.routeros
|
||||
init-lenient: false
|
||||
init-fail-on-error: true
|
||||
ansible-ref: devel
|
||||
squash-hierarchy: true
|
||||
init-project: Community.Routeros Collection
|
||||
init-copyright: Community.Routeros Contributors
|
||||
init-title: Community.Routeros Collection Documentation
|
||||
init-html-short-title: Community.Routeros Collection Docs
|
||||
init-extra-html-theme-options: |
|
||||
documentation_home_url=https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/branch/main/
|
||||
render-file-line: '> * `$<status>` [$<path_tail>](https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/pr/${{ github.event.number }}/$<path_tail>)'
|
||||
provide-link-targets: |
|
||||
ansible_collections.ansible.netcommon.network_cli_connection__parameter-ssh_type
|
||||
|
||||
publish-docs-gh-pages:
|
||||
# for now we won't run this on forks
|
||||
if: github.repository == 'ansible-collections/community.routeros'
|
||||
permissions:
|
||||
contents: write
|
||||
pages: write
|
||||
id-token: write
|
||||
needs: [build-docs]
|
||||
name: Publish Ansible Docs
|
||||
uses: ansible-community/github-docs-build/.github/workflows/_shared-docs-build-publish-gh-pages.yml@main
|
||||
with:
|
||||
artifact-name: ${{ needs.build-docs.outputs.artifact-name }}
|
||||
action: ${{ (github.event.action == 'closed' || needs.build-docs.outputs.changed != 'true') && 'teardown' || 'publish' }}
|
||||
publish-gh-pages-branch: true
|
||||
secrets:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
comment:
|
||||
permissions:
|
||||
pull-requests: write
|
||||
runs-on: ubuntu-latest
|
||||
needs: build-docs
|
||||
needs: [build-docs, publish-docs-gh-pages]
|
||||
name: PR comments
|
||||
steps:
|
||||
- name: PR comment
|
||||
|
@ -43,13 +74,20 @@ jobs:
|
|||
|
||||
Thank you for contribution!✨
|
||||
|
||||
This PR has been merged and your docs changes will be incorporated when they are next published.
|
||||
This PR has been merged and the docs are now incorporated into `main`:
|
||||
${{ env.GHP_BASE_URL }}/branch/main
|
||||
body: |
|
||||
## Docs Build 📝
|
||||
|
||||
Thank you for contribution!✨
|
||||
|
||||
The docsite for **this PR** is available for download as an artifact from this run:
|
||||
The docs for **this PR** have been published here:
|
||||
${{ env.GHP_BASE_URL }}/pr/${{ github.event.number }}
|
||||
|
||||
You can compare to the docs for the `main` branch here:
|
||||
${{ env.GHP_BASE_URL }}/branch/main
|
||||
|
||||
The docsite for **this PR** is also available for download as an artifact from this run:
|
||||
${{ needs.build-docs.outputs.artifact-url }}
|
||||
|
||||
File changes:
|
||||
|
|
55
.github/workflows/docs-push.yml
vendored
Normal file
55
.github/workflows/docs-push.yml
vendored
Normal file
|
@ -0,0 +1,55 @@
|
|||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
name: Collection Docs
|
||||
concurrency:
|
||||
group: docs-push-${{ github.sha }}
|
||||
cancel-in-progress: true
|
||||
'on':
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- stable-*
|
||||
tags:
|
||||
- '*'
|
||||
# Run CI once per day (at 05:15 UTC)
|
||||
schedule:
|
||||
- cron: '15 5 * * *'
|
||||
# Allow manual trigger (for newer antsibull-docs, sphinx-ansible-theme, ... versions)
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-docs:
|
||||
permissions:
|
||||
contents: read
|
||||
name: Build Ansible Docs
|
||||
uses: ansible-community/github-docs-build/.github/workflows/_shared-docs-build-push.yml@main
|
||||
with:
|
||||
collection-name: community.routeros
|
||||
init-lenient: true
|
||||
init-fail-on-error: true
|
||||
squash-hierarchy: true
|
||||
init-project: Community.Routeros Collection
|
||||
init-copyright: Community.Routeros Contributors
|
||||
init-title: Community.Routeros Collection Documentation
|
||||
init-html-short-title: Community.Routeros Collection Docs
|
||||
init-extra-html-theme-options: |
|
||||
documentation_home_url=https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/branch/main/
|
||||
|
||||
publish-docs-gh-pages:
|
||||
# for now we won't run this on forks
|
||||
if: github.repository == 'ansible-collections/community.routeros'
|
||||
permissions:
|
||||
contents: write
|
||||
pages: write
|
||||
id-token: write
|
||||
needs: [build-docs]
|
||||
name: Publish Ansible Docs
|
||||
uses: ansible-community/github-docs-build/.github/workflows/_shared-docs-build-publish-gh-pages.yml@main
|
||||
with:
|
||||
artifact-name: ${{ needs.build-docs.outputs.artifact-name }}
|
||||
publish-gh-pages-branch: true
|
||||
secrets:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
118
.github/workflows/ee.yml
vendored
118
.github/workflows/ee.yml
vendored
|
@ -1,118 +0,0 @@
|
|||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
name: execution environment
|
||||
on:
|
||||
# Run CI against all pushes (direct commits, also merged PRs), Pull Requests
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- stable-*
|
||||
pull_request:
|
||||
# Run CI once per day (at 05:15 UTC)
|
||||
# This ensures that even if there haven't been commits that we are still testing against latest version of ansible-builder
|
||||
schedule:
|
||||
- cron: '15 5 * * *'
|
||||
|
||||
env:
|
||||
NAMESPACE: community
|
||||
COLLECTION_NAME: routeros
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build and test EE (Ⓐ${{ matrix.runner_tag }})
|
||||
strategy:
|
||||
matrix:
|
||||
runner_tag:
|
||||
- devel
|
||||
- stable-2.12-latest
|
||||
- stable-2.11-latest
|
||||
- stable-2.9-latest
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: ansible_collections/${{ env.NAMESPACE }}/${{ env.COLLECTION_NAME }}
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v3
|
||||
with:
|
||||
python-version: '3.10'
|
||||
|
||||
- name: Install ansible-builder and ansible-navigator
|
||||
run: pip install ansible-builder ansible-navigator
|
||||
|
||||
- name: Verify requirements
|
||||
run: ansible-builder introspect --sanitize .
|
||||
|
||||
- name: Make sure galaxy.yml has version entry
|
||||
run: >-
|
||||
python -c
|
||||
'import yaml ;
|
||||
f = open("galaxy.yml", "rb") ;
|
||||
data = yaml.safe_load(f) ;
|
||||
f.close() ;
|
||||
data["version"] = data.get("version") or "0.0.1" ;
|
||||
f = open("galaxy.yml", "wb") ;
|
||||
f.write(yaml.dump(data).encode("utf-8")) ;
|
||||
f.close() ;
|
||||
'
|
||||
working-directory: ansible_collections/${{ env.NAMESPACE }}/${{ env.COLLECTION_NAME }}
|
||||
|
||||
- name: Install collection dependencies
|
||||
run: git clone --depth=1 --single-branch https://github.com/ansible-collections/ansible.netcommon.git ansible_collections/ansible/netcommon
|
||||
# NOTE: we're installing with git to work around Galaxy being a huge PITA (https://github.com/ansible/galaxy/issues/2429)
|
||||
# run: ansible-galaxy collection install ansible.netcommon -p .
|
||||
|
||||
- name: Build collection
|
||||
run: |
|
||||
ansible-galaxy collection build --output-path ../../../
|
||||
working-directory: ansible_collections/${{ env.NAMESPACE }}/${{ env.COLLECTION_NAME }}
|
||||
|
||||
- name: Create files for building execution environment
|
||||
run: |
|
||||
COLLECTION_FILENAME="$(ls "${{ env.NAMESPACE }}-${{ env.COLLECTION_NAME }}"-*.tar.gz)"
|
||||
|
||||
# EE config
|
||||
cat > execution-environment.yml <<EOF
|
||||
---
|
||||
version: 1
|
||||
build_arg_defaults:
|
||||
EE_BASE_IMAGE: 'quay.io/ansible/ansible-runner:${{ matrix.runner_tag }}'
|
||||
dependencies:
|
||||
galaxy: requirements.yml
|
||||
EOF
|
||||
echo "::group::execution-environment.yml"
|
||||
cat execution-environment.yml
|
||||
echo "::endgroup::"
|
||||
|
||||
# Requirements
|
||||
cat > requirements.yml <<EOF
|
||||
---
|
||||
collections:
|
||||
- name: ${COLLECTION_FILENAME}
|
||||
type: file
|
||||
EOF
|
||||
echo "::group::requirements.yml"
|
||||
cat requirements.yml
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Build image based on ${{ matrix.runner_tag }}
|
||||
run: |
|
||||
mkdir -p context/_build/
|
||||
cp "${{ env.NAMESPACE }}-${{ env.COLLECTION_NAME }}"-*.tar.gz context/_build/
|
||||
ansible-builder build -v 3 -t test-ee:latest --container-runtime=podman
|
||||
|
||||
- name: Run basic tests
|
||||
run: >
|
||||
ansible-navigator run
|
||||
--mode stdout
|
||||
--pull-policy never
|
||||
--set-environment-variable ANSIBLE_PRIVATE_ROLE_VARS=true
|
||||
--execution-environment-image test-ee:latest
|
||||
-v
|
||||
all.yml
|
||||
working-directory: ansible_collections/${{ env.NAMESPACE }}/${{ env.COLLECTION_NAME }}/tests/ee
|
48
.github/workflows/extra-tests.yml
vendored
48
.github/workflows/extra-tests.yml
vendored
|
@ -1,48 +0,0 @@
|
|||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
name: extra-tests
|
||||
on:
|
||||
# Run CI against all pushes (direct commits, also merged PRs), Pull Requests
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- stable-*
|
||||
pull_request:
|
||||
# Run CI once per day (at 05:15 UTC)
|
||||
# This ensures that even if there haven't been commits that we are still testing against latest version of ansible-test for each ansible-base version
|
||||
schedule:
|
||||
- cron: '15 5 * * *'
|
||||
env:
|
||||
NAMESPACE: community
|
||||
COLLECTION_NAME: routeros
|
||||
|
||||
jobs:
|
||||
extra-sanity:
|
||||
name: Extra Sanity
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v3
|
||||
with:
|
||||
python-version: '3.10'
|
||||
|
||||
- name: Install ansible-core
|
||||
run: pip install https://github.com/ansible/ansible/archive/devel.tar.gz --disable-pip-version-check
|
||||
|
||||
- name: Install collection dependencies
|
||||
run: git clone --depth=1 --single-branch https://github.com/ansible-collections/community.internal_test_tools.git ./ansible_collections/community/internal_test_tools
|
||||
# NOTE: we're installing with git to work around Galaxy being a huge PITA (https://github.com/ansible/galaxy/issues/2429)
|
||||
# run: ansible-galaxy collection install community.internal_test_tools -p .
|
||||
|
||||
- name: Run sanity tests
|
||||
run: ../../community/internal_test_tools/tools/run.py --color
|
||||
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}
|
88
.github/workflows/import-galaxy.yml
vendored
88
.github/workflows/import-galaxy.yml
vendored
|
@ -1,88 +0,0 @@
|
|||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
name: import-galaxy
|
||||
on:
|
||||
# Run CI against all pushes (direct commits, also merged PRs) to main, and all Pull Requests
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- stable-*
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
# Adjust this to your collection
|
||||
NAMESPACE: community
|
||||
COLLECTION_NAME: routeros
|
||||
|
||||
jobs:
|
||||
build-collection:
|
||||
name: Build collection artifact
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: ./checkout
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v3
|
||||
with:
|
||||
python-version: '3.10'
|
||||
|
||||
- name: Install ansible-core
|
||||
run: pip install https://github.com/ansible/ansible/archive/devel.tar.gz --disable-pip-version-check
|
||||
|
||||
- name: Make sure galaxy.yml has version entry
|
||||
run: >-
|
||||
python -c
|
||||
'import yaml ;
|
||||
f = open("galaxy.yml", "rb") ;
|
||||
data = yaml.safe_load(f) ;
|
||||
f.close() ;
|
||||
data["version"] = data.get("version") or "0.0.1" ;
|
||||
f = open("galaxy.yml", "wb") ;
|
||||
f.write(yaml.dump(data).encode("utf-8")) ;
|
||||
f.close() ;
|
||||
'
|
||||
working-directory: ./checkout
|
||||
|
||||
- name: Build collection
|
||||
run: ansible-galaxy collection build
|
||||
working-directory: ./checkout
|
||||
|
||||
- name: Copy artifact into subdirectory
|
||||
run: mkdir ./artifact && mv ./checkout/${{ env.NAMESPACE }}-${{ env.COLLECTION_NAME }}-*.tar.gz ./artifact
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ env.NAMESPACE }}-${{ env.COLLECTION_NAME }}-${{ github.sha }}
|
||||
path: ./artifact/
|
||||
|
||||
import-galaxy:
|
||||
name: Import artifact with Galaxy importer
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- build-collection
|
||||
steps:
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v3
|
||||
with:
|
||||
python-version: '3.10'
|
||||
|
||||
- name: Install ansible-core
|
||||
run: pip install https://github.com/ansible/ansible/archive/devel.tar.gz --disable-pip-version-check
|
||||
|
||||
- name: Install galaxy-importer
|
||||
run: pip install galaxy-importer --disable-pip-version-check
|
||||
|
||||
- name: Download artifact
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: ${{ env.NAMESPACE }}-${{ env.COLLECTION_NAME }}-${{ github.sha }}
|
||||
|
||||
- name: Run Galaxy importer
|
||||
run: python -m galaxy_importer.main ${{ env.NAMESPACE }}-${{ env.COLLECTION_NAME }}-*.tar.gz
|
35
.github/workflows/nox.yml
vendored
Normal file
35
.github/workflows/nox.yml
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
name: nox
|
||||
'on':
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- stable-*
|
||||
pull_request:
|
||||
# Run CI once per day (at 05:15 UTC)
|
||||
schedule:
|
||||
- cron: '15 5 * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
nox:
|
||||
runs-on: ubuntu-latest
|
||||
name: "Run extra sanity tests"
|
||||
steps:
|
||||
- name: Check out collection
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Run nox
|
||||
uses: ansible-community/antsibull-nox@main
|
||||
|
||||
ansible-test:
|
||||
uses: ansible-community/antsibull-nox/.github/workflows/reusable-nox-matrix.yml@main
|
||||
with:
|
||||
upload-codecov: true
|
||||
secrets:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -4,6 +4,7 @@
|
|||
|
||||
/tests/output/
|
||||
/changelogs/.plugin-cache.yaml
|
||||
/tests/integration/inventory
|
||||
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
|
|
53
.yamllint
Normal file
53
.yamllint
Normal file
|
@ -0,0 +1,53 @@
|
|||
---
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# SPDX-FileCopyrightText: 2025 Felix Fontein <felix@fontein.de>
|
||||
|
||||
extends: default
|
||||
|
||||
ignore: |
|
||||
/changelogs/
|
||||
|
||||
rules:
|
||||
line-length:
|
||||
max: 300
|
||||
level: error
|
||||
document-start:
|
||||
present: true
|
||||
document-end: false
|
||||
truthy:
|
||||
level: error
|
||||
allowed-values:
|
||||
- 'true'
|
||||
- 'false'
|
||||
indentation:
|
||||
spaces: 2
|
||||
indent-sequences: true
|
||||
key-duplicates: enable
|
||||
trailing-spaces: enable
|
||||
new-line-at-end-of-file: disable
|
||||
hyphens:
|
||||
max-spaces-after: 1
|
||||
empty-lines:
|
||||
max: 2
|
||||
max-start: 0
|
||||
max-end: 0
|
||||
commas:
|
||||
max-spaces-before: 0
|
||||
min-spaces-after: 1
|
||||
max-spaces-after: 1
|
||||
colons:
|
||||
max-spaces-before: 0
|
||||
max-spaces-after: 1
|
||||
brackets:
|
||||
min-spaces-inside: 0
|
||||
max-spaces-inside: 0
|
||||
braces:
|
||||
min-spaces-inside: 0
|
||||
max-spaces-inside: 1
|
||||
octal-values:
|
||||
forbid-implicit-octal: true
|
||||
forbid-explicit-octal: true
|
||||
comments:
|
||||
min-spaces-from-content: 1
|
||||
comments-indentation: false
|
54
.yamllint-docs
Normal file
54
.yamllint-docs
Normal file
|
@ -0,0 +1,54 @@
|
|||
---
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# SPDX-FileCopyrightText: 2025 Felix Fontein <felix@fontein.de>
|
||||
|
||||
extends: default
|
||||
|
||||
ignore: |
|
||||
/changelogs/
|
||||
|
||||
rules:
|
||||
line-length:
|
||||
max: 160
|
||||
level: error
|
||||
document-start:
|
||||
present: false
|
||||
document-end:
|
||||
present: false
|
||||
truthy:
|
||||
level: error
|
||||
allowed-values:
|
||||
- 'true'
|
||||
- 'false'
|
||||
indentation:
|
||||
spaces: 2
|
||||
indent-sequences: true
|
||||
key-duplicates: enable
|
||||
trailing-spaces: enable
|
||||
new-line-at-end-of-file: disable
|
||||
hyphens:
|
||||
max-spaces-after: 1
|
||||
empty-lines:
|
||||
max: 2
|
||||
max-start: 0
|
||||
max-end: 0
|
||||
commas:
|
||||
max-spaces-before: 0
|
||||
min-spaces-after: 1
|
||||
max-spaces-after: 1
|
||||
colons:
|
||||
max-spaces-before: 0
|
||||
max-spaces-after: 1
|
||||
brackets:
|
||||
min-spaces-inside: 0
|
||||
max-spaces-inside: 0
|
||||
braces:
|
||||
min-spaces-inside: 0
|
||||
max-spaces-inside: 1
|
||||
octal-values:
|
||||
forbid-implicit-octal: true
|
||||
forbid-explicit-octal: true
|
||||
comments:
|
||||
min-spaces-from-content: 1
|
||||
comments-indentation: false
|
54
.yamllint-examples
Normal file
54
.yamllint-examples
Normal file
|
@ -0,0 +1,54 @@
|
|||
---
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# SPDX-FileCopyrightText: 2025 Felix Fontein <felix@fontein.de>
|
||||
|
||||
extends: default
|
||||
|
||||
ignore: |
|
||||
/changelogs/
|
||||
|
||||
rules:
|
||||
line-length:
|
||||
max: 160
|
||||
level: error
|
||||
document-start:
|
||||
present: true
|
||||
document-end:
|
||||
present: false
|
||||
truthy:
|
||||
level: error
|
||||
allowed-values:
|
||||
- 'true'
|
||||
- 'false'
|
||||
indentation:
|
||||
spaces: 2
|
||||
indent-sequences: true
|
||||
key-duplicates: enable
|
||||
trailing-spaces: enable
|
||||
new-line-at-end-of-file: disable
|
||||
hyphens:
|
||||
max-spaces-after: 1
|
||||
empty-lines:
|
||||
max: 2
|
||||
max-start: 0
|
||||
max-end: 0
|
||||
commas:
|
||||
max-spaces-before: 0
|
||||
min-spaces-after: 1
|
||||
max-spaces-after: 1
|
||||
colons:
|
||||
max-spaces-before: 0
|
||||
max-spaces-after: 1
|
||||
brackets:
|
||||
min-spaces-inside: 0
|
||||
max-spaces-inside: 0
|
||||
braces:
|
||||
min-spaces-inside: 0
|
||||
max-spaces-inside: 1
|
||||
octal-values:
|
||||
forbid-implicit-octal: true
|
||||
forbid-explicit-octal: true
|
||||
comments:
|
||||
min-spaces-from-content: 1
|
||||
comments-indentation: false
|
53
.yamllint-extra-docs
Normal file
53
.yamllint-extra-docs
Normal file
|
@ -0,0 +1,53 @@
|
|||
---
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# SPDX-FileCopyrightText: 2025 Felix Fontein <felix@fontein.de>
|
||||
|
||||
extends: default
|
||||
|
||||
ignore: |
|
||||
/changelogs/
|
||||
|
||||
rules:
|
||||
line-length:
|
||||
max: 160
|
||||
level: error
|
||||
document-start: disable
|
||||
document-end:
|
||||
present: false
|
||||
truthy:
|
||||
level: error
|
||||
allowed-values:
|
||||
- 'true'
|
||||
- 'false'
|
||||
indentation:
|
||||
spaces: 2
|
||||
indent-sequences: true
|
||||
key-duplicates: enable
|
||||
trailing-spaces: enable
|
||||
new-line-at-end-of-file: disable
|
||||
hyphens:
|
||||
max-spaces-after: 1
|
||||
empty-lines:
|
||||
max: 2
|
||||
max-start: 0
|
||||
max-end: 0
|
||||
commas:
|
||||
max-spaces-before: 0
|
||||
min-spaces-after: 1
|
||||
max-spaces-after: 1
|
||||
colons:
|
||||
max-spaces-before: 0
|
||||
max-spaces-after: 1
|
||||
brackets:
|
||||
min-spaces-inside: 0
|
||||
max-spaces-inside: 0
|
||||
braces:
|
||||
min-spaces-inside: 0
|
||||
max-spaces-inside: 1
|
||||
octal-values:
|
||||
forbid-implicit-octal: true
|
||||
forbid-explicit-octal: true
|
||||
comments:
|
||||
min-spaces-from-content: 1
|
||||
comments-indentation: false
|
977
CHANGELOG.md
Normal file
977
CHANGELOG.md
Normal file
|
@ -0,0 +1,977 @@
|
|||
# Community RouterOS Release Notes
|
||||
|
||||
**Topics**
|
||||
|
||||
- <a href="#v3-9-0">v3\.9\.0</a>
|
||||
- <a href="#release-summary">Release Summary</a>
|
||||
- <a href="#minor-changes">Minor Changes</a>
|
||||
- <a href="#bugfixes">Bugfixes</a>
|
||||
- <a href="#v3-8-1">v3\.8\.1</a>
|
||||
- <a href="#release-summary-1">Release Summary</a>
|
||||
- <a href="#bugfixes-1">Bugfixes</a>
|
||||
- <a href="#v3-8-0">v3\.8\.0</a>
|
||||
- <a href="#release-summary-2">Release Summary</a>
|
||||
- <a href="#minor-changes-1">Minor Changes</a>
|
||||
- <a href="#v3-7-0">v3\.7\.0</a>
|
||||
- <a href="#release-summary-3">Release Summary</a>
|
||||
- <a href="#minor-changes-2">Minor Changes</a>
|
||||
- <a href="#v3-6-0">v3\.6\.0</a>
|
||||
- <a href="#release-summary-4">Release Summary</a>
|
||||
- <a href="#minor-changes-3">Minor Changes</a>
|
||||
- <a href="#v3-5-0">v3\.5\.0</a>
|
||||
- <a href="#release-summary-5">Release Summary</a>
|
||||
- <a href="#minor-changes-4">Minor Changes</a>
|
||||
- <a href="#v3-4-0">v3\.4\.0</a>
|
||||
- <a href="#release-summary-6">Release Summary</a>
|
||||
- <a href="#minor-changes-5">Minor Changes</a>
|
||||
- <a href="#bugfixes-2">Bugfixes</a>
|
||||
- <a href="#v3-3-0">v3\.3\.0</a>
|
||||
- <a href="#release-summary-7">Release Summary</a>
|
||||
- <a href="#minor-changes-6">Minor Changes</a>
|
||||
- <a href="#v3-2-0">v3\.2\.0</a>
|
||||
- <a href="#release-summary-8">Release Summary</a>
|
||||
- <a href="#minor-changes-7">Minor Changes</a>
|
||||
- <a href="#v3-1-0">v3\.1\.0</a>
|
||||
- <a href="#release-summary-9">Release Summary</a>
|
||||
- <a href="#minor-changes-8">Minor Changes</a>
|
||||
- <a href="#bugfixes-3">Bugfixes</a>
|
||||
- <a href="#v3-0-0">v3\.0\.0</a>
|
||||
- <a href="#release-summary-10">Release Summary</a>
|
||||
- <a href="#breaking-changes--porting-guide">Breaking Changes / Porting Guide</a>
|
||||
- <a href="#removed-features-previously-deprecated">Removed Features \(previously deprecated\)</a>
|
||||
- <a href="#v2-20-0">v2\.20\.0</a>
|
||||
- <a href="#release-summary-11">Release Summary</a>
|
||||
- <a href="#minor-changes-9">Minor Changes</a>
|
||||
- <a href="#v2-19-0">v2\.19\.0</a>
|
||||
- <a href="#release-summary-12">Release Summary</a>
|
||||
- <a href="#minor-changes-10">Minor Changes</a>
|
||||
- <a href="#v2-18-0">v2\.18\.0</a>
|
||||
- <a href="#release-summary-13">Release Summary</a>
|
||||
- <a href="#minor-changes-11">Minor Changes</a>
|
||||
- <a href="#deprecated-features">Deprecated Features</a>
|
||||
- <a href="#bugfixes-4">Bugfixes</a>
|
||||
- <a href="#v2-17-0">v2\.17\.0</a>
|
||||
- <a href="#release-summary-14">Release Summary</a>
|
||||
- <a href="#minor-changes-12">Minor Changes</a>
|
||||
- <a href="#v2-16-0">v2\.16\.0</a>
|
||||
- <a href="#release-summary-15">Release Summary</a>
|
||||
- <a href="#minor-changes-13">Minor Changes</a>
|
||||
- <a href="#v2-15-0">v2\.15\.0</a>
|
||||
- <a href="#release-summary-16">Release Summary</a>
|
||||
- <a href="#minor-changes-14">Minor Changes</a>
|
||||
- <a href="#v2-14-0">v2\.14\.0</a>
|
||||
- <a href="#release-summary-17">Release Summary</a>
|
||||
- <a href="#minor-changes-15">Minor Changes</a>
|
||||
- <a href="#v2-13-0">v2\.13\.0</a>
|
||||
- <a href="#release-summary-18">Release Summary</a>
|
||||
- <a href="#minor-changes-16">Minor Changes</a>
|
||||
- <a href="#bugfixes-5">Bugfixes</a>
|
||||
- <a href="#v2-12-0">v2\.12\.0</a>
|
||||
- <a href="#release-summary-19">Release Summary</a>
|
||||
- <a href="#minor-changes-17">Minor Changes</a>
|
||||
- <a href="#v2-11-0">v2\.11\.0</a>
|
||||
- <a href="#release-summary-20">Release Summary</a>
|
||||
- <a href="#minor-changes-18">Minor Changes</a>
|
||||
- <a href="#v2-10-0">v2\.10\.0</a>
|
||||
- <a href="#release-summary-21">Release Summary</a>
|
||||
- <a href="#minor-changes-19">Minor Changes</a>
|
||||
- <a href="#bugfixes-6">Bugfixes</a>
|
||||
- <a href="#v2-9-0">v2\.9\.0</a>
|
||||
- <a href="#release-summary-22">Release Summary</a>
|
||||
- <a href="#minor-changes-20">Minor Changes</a>
|
||||
- <a href="#bugfixes-7">Bugfixes</a>
|
||||
- <a href="#v2-8-3">v2\.8\.3</a>
|
||||
- <a href="#release-summary-23">Release Summary</a>
|
||||
- <a href="#known-issues">Known Issues</a>
|
||||
- <a href="#v2-8-2">v2\.8\.2</a>
|
||||
- <a href="#release-summary-24">Release Summary</a>
|
||||
- <a href="#bugfixes-8">Bugfixes</a>
|
||||
- <a href="#v2-8-1">v2\.8\.1</a>
|
||||
- <a href="#release-summary-25">Release Summary</a>
|
||||
- <a href="#bugfixes-9">Bugfixes</a>
|
||||
- <a href="#v2-8-0">v2\.8\.0</a>
|
||||
- <a href="#release-summary-26">Release Summary</a>
|
||||
- <a href="#minor-changes-21">Minor Changes</a>
|
||||
- <a href="#bugfixes-10">Bugfixes</a>
|
||||
- <a href="#v2-7-0">v2\.7\.0</a>
|
||||
- <a href="#release-summary-27">Release Summary</a>
|
||||
- <a href="#minor-changes-22">Minor Changes</a>
|
||||
- <a href="#bugfixes-11">Bugfixes</a>
|
||||
- <a href="#v2-6-0">v2\.6\.0</a>
|
||||
- <a href="#release-summary-28">Release Summary</a>
|
||||
- <a href="#minor-changes-23">Minor Changes</a>
|
||||
- <a href="#bugfixes-12">Bugfixes</a>
|
||||
- <a href="#v2-5-0">v2\.5\.0</a>
|
||||
- <a href="#release-summary-29">Release Summary</a>
|
||||
- <a href="#minor-changes-24">Minor Changes</a>
|
||||
- <a href="#bugfixes-13">Bugfixes</a>
|
||||
- <a href="#v2-4-0">v2\.4\.0</a>
|
||||
- <a href="#release-summary-30">Release Summary</a>
|
||||
- <a href="#minor-changes-25">Minor Changes</a>
|
||||
- <a href="#bugfixes-14">Bugfixes</a>
|
||||
- <a href="#known-issues-1">Known Issues</a>
|
||||
- <a href="#v2-3-1">v2\.3\.1</a>
|
||||
- <a href="#release-summary-31">Release Summary</a>
|
||||
- <a href="#known-issues-2">Known Issues</a>
|
||||
- <a href="#v2-3-0">v2\.3\.0</a>
|
||||
- <a href="#release-summary-32">Release Summary</a>
|
||||
- <a href="#minor-changes-26">Minor Changes</a>
|
||||
- <a href="#bugfixes-15">Bugfixes</a>
|
||||
- <a href="#v2-2-1">v2\.2\.1</a>
|
||||
- <a href="#release-summary-33">Release Summary</a>
|
||||
- <a href="#bugfixes-16">Bugfixes</a>
|
||||
- <a href="#v2-2-0">v2\.2\.0</a>
|
||||
- <a href="#release-summary-34">Release Summary</a>
|
||||
- <a href="#minor-changes-27">Minor Changes</a>
|
||||
- <a href="#bugfixes-17">Bugfixes</a>
|
||||
- <a href="#new-modules">New Modules</a>
|
||||
- <a href="#v2-1-0">v2\.1\.0</a>
|
||||
- <a href="#release-summary-35">Release Summary</a>
|
||||
- <a href="#minor-changes-28">Minor Changes</a>
|
||||
- <a href="#bugfixes-18">Bugfixes</a>
|
||||
- <a href="#new-modules-1">New Modules</a>
|
||||
- <a href="#v2-0-0">v2\.0\.0</a>
|
||||
- <a href="#release-summary-36">Release Summary</a>
|
||||
- <a href="#minor-changes-29">Minor Changes</a>
|
||||
- <a href="#breaking-changes--porting-guide-1">Breaking Changes / Porting Guide</a>
|
||||
- <a href="#bugfixes-19">Bugfixes</a>
|
||||
- <a href="#new-plugins">New Plugins</a>
|
||||
- <a href="#filter">Filter</a>
|
||||
- <a href="#v1-2-0">v1\.2\.0</a>
|
||||
- <a href="#release-summary-37">Release Summary</a>
|
||||
- <a href="#minor-changes-30">Minor Changes</a>
|
||||
- <a href="#bugfixes-20">Bugfixes</a>
|
||||
- <a href="#v1-1-0">v1\.1\.0</a>
|
||||
- <a href="#release-summary-38">Release Summary</a>
|
||||
- <a href="#minor-changes-31">Minor Changes</a>
|
||||
- <a href="#v1-0-1">v1\.0\.1</a>
|
||||
- <a href="#release-summary-39">Release Summary</a>
|
||||
- <a href="#bugfixes-21">Bugfixes</a>
|
||||
- <a href="#v1-0-0">v1\.0\.0</a>
|
||||
- <a href="#release-summary-40">Release Summary</a>
|
||||
- <a href="#bugfixes-22">Bugfixes</a>
|
||||
- <a href="#v0-1-1">v0\.1\.1</a>
|
||||
- <a href="#release-summary-41">Release Summary</a>
|
||||
- <a href="#bugfixes-23">Bugfixes</a>
|
||||
- <a href="#v0-1-0">v0\.1\.0</a>
|
||||
- <a href="#release-summary-42">Release Summary</a>
|
||||
- <a href="#minor-changes-32">Minor Changes</a>
|
||||
|
||||
<a id="v3-9-0"></a>
|
||||
## v3\.9\.0
|
||||
|
||||
<a id="release-summary"></a>
|
||||
### Release Summary
|
||||
|
||||
Bugfix and feature release\.
|
||||
|
||||
<a id="minor-changes"></a>
|
||||
### Minor Changes
|
||||
|
||||
* api\_info\, api modify \- add <code>remote\-log\-format</code>\, <code>remote\-protocol</code>\, and <code>event\-delimiter</code> to <code>system logging action</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/381](https\://github\.com/ansible\-collections/community\.routeros/pull/381)\)\.
|
||||
* api\_info\, api\_modify \- add <code>disable\-link\-local\-address</code> and <code>stale\-neighbor\-timeout</code> fields to <code>ipv6 settings</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/380](https\://github\.com/ansible\-collections/community\.routeros/pull/380)\)\.
|
||||
* api\_info\, api\_modify \- adjust neighbor limit fields in <code>ipv6 settings</code> to match RouterOS 7\.18 and newer \([https\://github\.com/ansible\-collections/community\.routeros/pull/380](https\://github\.com/ansible\-collections/community\.routeros/pull/380)\)\.
|
||||
* api\_info\, api\_modify \- set <code>passthrough</code> default in <code>ip firewall mangle</code> to <code>true</code> for RouterOS 7\.19 and newer \([https\://github\.com/ansible\-collections/community\.routeros/pull/382](https\://github\.com/ansible\-collections/community\.routeros/pull/382)\)\.
|
||||
* api\_info\, api\_modify \- since RouterOS 7\.17 VRF is supported for OVPN server\. It now supports multiple entries\, while <code>api\_modify</code> so far only accepted a single entry\. The <code>interface ovpn\-server server</code> path now allows multiple entries on RouterOS 7\.17 and newer \([https\://github\.com/ansible\-collections/community\.routeros/pull/383](https\://github\.com/ansible\-collections/community\.routeros/pull/383)\)\.
|
||||
|
||||
<a id="bugfixes"></a>
|
||||
### Bugfixes
|
||||
|
||||
* routeros terminal plugin \- fix <code>terminal\_stdout\_re</code> pattern to handle long system identities when connecting to RouterOS through SSH \([https\://github\.com/ansible\-collections/community\.routeros/pull/386](https\://github\.com/ansible\-collections/community\.routeros/pull/386)\)\.
|
||||
|
||||
<a id="v3-8-1"></a>
|
||||
## v3\.8\.1
|
||||
|
||||
<a id="release-summary-1"></a>
|
||||
### Release Summary
|
||||
|
||||
Bugfix release\.
|
||||
|
||||
<a id="bugfixes-1"></a>
|
||||
### Bugfixes
|
||||
|
||||
* facts and api\_facts modules \- prevent deprecation warnings when used with ansible\-core 2\.19 \([https\://github\.com/ansible\-collections/community\.routeros/pull/384](https\://github\.com/ansible\-collections/community\.routeros/pull/384)\)\.
|
||||
|
||||
<a id="v3-8-0"></a>
|
||||
## v3\.8\.0
|
||||
|
||||
<a id="release-summary-2"></a>
|
||||
### Release Summary
|
||||
|
||||
Feature release\.
|
||||
|
||||
<a id="minor-changes-1"></a>
|
||||
### Minor Changes
|
||||
|
||||
* api\_info\, api\_modify \- add <code>interface ethernet switch port\-isolation</code> which is supported since RouterOS 6\.43 \([https\://github\.com/ansible\-collections/community\.routeros/pull/375](https\://github\.com/ansible\-collections/community\.routeros/pull/375)\)\.
|
||||
* api\_info\, api\_modify \- add <code>routing bfd configuration</code>\. Officially stabilized BFD support for BGP and OSPF is available since RouterOS 7\.11
|
||||
\([https\://github\.com/ansible\-collections/community\.routeros/pull/375](https\://github\.com/ansible\-collections/community\.routeros/pull/375)\)\.
|
||||
* api\_modify\, api\_info \- support API path <code>ip ipsec mode\-config</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/376](https\://github\.com/ansible\-collections/community\.routeros/pull/376)\)\.
|
||||
|
||||
<a id="v3-7-0"></a>
|
||||
## v3\.7\.0
|
||||
|
||||
<a id="release-summary-3"></a>
|
||||
### Release Summary
|
||||
|
||||
Feature release\.
|
||||
|
||||
<a id="minor-changes-2"></a>
|
||||
### Minor Changes
|
||||
|
||||
* api\_find\_and\_modify \- allow to control whether <code>dynamic</code> and/or <code>builtin</code> entries are ignored with the new <code>ignore\_dynamic</code> and <code>ignore\_builtin</code> options \([https\://github\.com/ansible\-collections/community\.routeros/issues/372](https\://github\.com/ansible\-collections/community\.routeros/issues/372)\, [https\://github\.com/ansible\-collections/community\.routeros/pull/373](https\://github\.com/ansible\-collections/community\.routeros/pull/373)\)\.
|
||||
* api\_info\, api\_modify \- add <code>port\-cost\-mode</code> to <code>interface bridge</code> which is supported since RouterOS 7\.13 \([https\://github\.com/ansible\-collections/community\.routeros/pull/371](https\://github\.com/ansible\-collections/community\.routeros/pull/371)\)\.
|
||||
|
||||
<a id="v3-6-0"></a>
|
||||
## v3\.6\.0
|
||||
|
||||
<a id="release-summary-4"></a>
|
||||
### Release Summary
|
||||
|
||||
Feature release\.
|
||||
|
||||
<a id="minor-changes-3"></a>
|
||||
### Minor Changes
|
||||
|
||||
* api\_info\, api\_modify \- add <code>mdns\-repeat\-ifaces</code> to <code>ip dns</code> for RouterOS 7\.16 and newer \([https\://github\.com/ansible\-collections/community\.routeros/pull/358](https\://github\.com/ansible\-collections/community\.routeros/pull/358)\)\.
|
||||
* api\_info\, api\_modify \- field name change in <code>routing bgp connection</code> path implemented by RouterOS 7\.19 and newer \([https\://github\.com/ansible\-collections/community\.routeros/pull/360](https\://github\.com/ansible\-collections/community\.routeros/pull/360)\)\.
|
||||
* api\_info\, api\_modify \- rename <code>is\-responder</code> property in <code>interface wireguard peers</code> to <code>responder</code> for RouterOS 7\.17 and newer \([https\://github\.com/ansible\-collections/community\.routeros/pull/364](https\://github\.com/ansible\-collections/community\.routeros/pull/364)\)\.
|
||||
|
||||
<a id="v3-5-0"></a>
|
||||
## v3\.5\.0
|
||||
|
||||
<a id="release-summary-5"></a>
|
||||
### Release Summary
|
||||
|
||||
Feature release\.
|
||||
|
||||
<a id="minor-changes-4"></a>
|
||||
### Minor Changes
|
||||
|
||||
* api\_info\, api\_modify \- change default for <code>/ip/cloud/ddns\-enabled</code> for RouterOS 7\.17 and newer from <code>yes</code> to <code>auto</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/350](https\://github\.com/ansible\-collections/community\.routeros/pull/350)\)\.
|
||||
|
||||
<a id="v3-4-0"></a>
|
||||
## v3\.4\.0
|
||||
|
||||
<a id="release-summary-6"></a>
|
||||
### Release Summary
|
||||
|
||||
Feature and bugfix release\.
|
||||
|
||||
<a id="minor-changes-5"></a>
|
||||
### Minor Changes
|
||||
|
||||
* api\_info\, api\_modify \- add support for the <code>ip dns forwarders</code> path implemented by RouterOS 7\.17 and newer \([https\://github\.com/ansible\-collections/community\.routeros/pull/343](https\://github\.com/ansible\-collections/community\.routeros/pull/343)\)\.
|
||||
|
||||
<a id="bugfixes-2"></a>
|
||||
### Bugfixes
|
||||
|
||||
* api\_info\, api\_modify \- remove the primary key <code>action</code> from the <code>interface wifi provisioning</code> path\, since RouterOS also allows to create completely duplicate entries \([https\://github\.com/ansible\-collections/community\.routeros/issues/344](https\://github\.com/ansible\-collections/community\.routeros/issues/344)\, [https\://github\.com/ansible\-collections/community\.routeros/pull/345](https\://github\.com/ansible\-collections/community\.routeros/pull/345)\)\.
|
||||
|
||||
<a id="v3-3-0"></a>
|
||||
## v3\.3\.0
|
||||
|
||||
<a id="release-summary-7"></a>
|
||||
### Release Summary
|
||||
|
||||
Feature release\.
|
||||
|
||||
<a id="minor-changes-6"></a>
|
||||
### Minor Changes
|
||||
|
||||
* api\_info\, api\_modify \- add missing attribute <code>require\-message\-auth</code> for the <code>radius</code> path which exists since RouterOS version 7\.15 \([https\://github\.com/ansible\-collections/community\.routeros/issues/338](https\://github\.com/ansible\-collections/community\.routeros/issues/338)\, [https\://github\.com/ansible\-collections/community\.routeros/pull/339](https\://github\.com/ansible\-collections/community\.routeros/pull/339)\)\.
|
||||
* api\_info\, api\_modify \- add the <code>interface 6to4</code> path\. Used to manage IPv6 tunnels via tunnel\-brokers like HE\, where native IPv6 is not provided \([https\://github\.com/ansible\-collections/community\.routeros/pull/342](https\://github\.com/ansible\-collections/community\.routeros/pull/342)\)\.
|
||||
* api\_info\, api\_modify \- add the <code>interface wireless access\-list</code> and <code>interface wireless connect\-list</code> paths \([https\://github\.com/ansible\-collections/community\.routeros/issues/284](https\://github\.com/ansible\-collections/community\.routeros/issues/284)\, [https\://github\.com/ansible\-collections/community\.routeros/pull/340](https\://github\.com/ansible\-collections/community\.routeros/pull/340)\)\.
|
||||
* api\_info\, api\_modify \- add the <code>use\-interface\-duid</code> option for <code>ipv6 dhcp\-client</code> path\. This option prevents issues with Fritzbox modems and routers\, when using virtual interfaces \(like VLANs\) may create duplicated records in hosts config\, this breaks original \"expose\-host\" function\. Also add the <code>script</code>\, <code>custom\-duid</code> and <code>validate\-server\-duid</code> as backport from 7\.15 version update \([https\://github\.com/ansible\-collections/community\.routeros/pull/341](https\://github\.com/ansible\-collections/community\.routeros/pull/341)\)\.
|
||||
|
||||
<a id="v3-2-0"></a>
|
||||
## v3\.2\.0
|
||||
|
||||
<a id="release-summary-8"></a>
|
||||
### Release Summary
|
||||
|
||||
Feature release\.
|
||||
|
||||
<a id="minor-changes-7"></a>
|
||||
### Minor Changes
|
||||
|
||||
* api\_info\, api\_modify \- add support for the <code>routing filter community\-list</code> path implemented by RouterOS 7 and newer \([https\://github\.com/ansible\-collections/community\.routeros/pull/331](https\://github\.com/ansible\-collections/community\.routeros/pull/331)\)\.
|
||||
|
||||
<a id="v3-1-0"></a>
|
||||
## v3\.1\.0
|
||||
|
||||
<a id="release-summary-9"></a>
|
||||
### Release Summary
|
||||
|
||||
Bugfix and feature release\.
|
||||
|
||||
<a id="minor-changes-8"></a>
|
||||
### Minor Changes
|
||||
|
||||
* api\_info\, api\_modify \- add missing fields <code>comment</code>\, <code>next\-pool</code> to <code>ip pool</code> path \([https\://github\.com/ansible\-collections/community\.routeros/pull/327](https\://github\.com/ansible\-collections/community\.routeros/pull/327)\)\.
|
||||
|
||||
<a id="bugfixes-3"></a>
|
||||
### Bugfixes
|
||||
|
||||
* api\_info\, api\_modify \- fields <code>log</code> and <code>log\-prefix</code> in paths <code>ip firewall filter</code>\, <code>ip firewall mangle</code>\, <code>ip firewall nat</code>\, <code>ip firewall raw</code> now have the correct default values \([https\://github\.com/ansible\-collections/community\.routeros/pull/324](https\://github\.com/ansible\-collections/community\.routeros/pull/324)\)\.
|
||||
|
||||
<a id="v3-0-0"></a>
|
||||
## v3\.0\.0
|
||||
|
||||
<a id="release-summary-10"></a>
|
||||
### Release Summary
|
||||
|
||||
Major release that drops support for End of Life Python versions and fixes check mode for community\.routeros\.command\.
|
||||
|
||||
<a id="breaking-changes--porting-guide"></a>
|
||||
### Breaking Changes / Porting Guide
|
||||
|
||||
* command \- the module no longer declares that it supports check mode \([https\://github\.com/ansible\-collections/community\.routeros/pull/318](https\://github\.com/ansible\-collections/community\.routeros/pull/318)\)\.
|
||||
|
||||
<a id="removed-features-previously-deprecated"></a>
|
||||
### Removed Features \(previously deprecated\)
|
||||
|
||||
* The collection no longer supports Ansible 2\.9\, ansible\-base 2\.10\, ansible\-core 2\.11\, ansible\-core 2\.12\, ansible\-core 2\.13\, and ansible\-core 2\.14\. If you need to continue using End of Life versions of Ansible/ansible\-base/ansible\-core\, please use community\.routeros 2\.x\.y \([https\://github\.com/ansible\-collections/community\.routeros/pull/318](https\://github\.com/ansible\-collections/community\.routeros/pull/318)\)\.
|
||||
|
||||
<a id="v2-20-0"></a>
|
||||
## v2\.20\.0
|
||||
|
||||
<a id="release-summary-11"></a>
|
||||
### Release Summary
|
||||
|
||||
Feature release\.
|
||||
|
||||
<a id="minor-changes-9"></a>
|
||||
### Minor Changes
|
||||
|
||||
* api\_info\, api\_modify \- add new parameters from the RouterOS 7\.16 release \([https\://github\.com/ansible\-collections/community\.routeros/pull/323](https\://github\.com/ansible\-collections/community\.routeros/pull/323)\)\.
|
||||
* api\_info\, api\_modify \- add support <code>interface l2tp\-client</code> configuration \([https\://github\.com/ansible\-collections/community\.routeros/pull/322](https\://github\.com/ansible\-collections/community\.routeros/pull/322)\)\.
|
||||
* api\_info\, api\_modify \- add support for the <code>cpu\-frequency</code>\, <code>memory\-frequency</code>\, <code>preboot\-etherboot</code> and <code>preboot\-etherboot\-server</code> properties in <code>system routerboard settings</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/320](https\://github\.com/ansible\-collections/community\.routeros/pull/320)\)\.
|
||||
* api\_info\, api\_modify \- add support for the <code>matching\-type</code> property in <code>ip dhcp\-server matcher</code> introduced by RouterOS 7\.16 \([https\://github\.com/ansible\-collections/community\.routeros/pull/321](https\://github\.com/ansible\-collections/community\.routeros/pull/321)\)\.
|
||||
|
||||
<a id="v2-19-0"></a>
|
||||
## v2\.19\.0
|
||||
|
||||
<a id="release-summary-12"></a>
|
||||
### Release Summary
|
||||
|
||||
Feature release\.
|
||||
|
||||
<a id="minor-changes-10"></a>
|
||||
### Minor Changes
|
||||
|
||||
* api\_info\, api\_modify \- add support for the <code>ip dns adlist</code> path implemented by RouterOS 7\.15 and newer \([https\://github\.com/ansible\-collections/community\.routeros/pull/310](https\://github\.com/ansible\-collections/community\.routeros/pull/310)\)\.
|
||||
* api\_info\, api\_modify \- add support for the <code>mld\-version</code> and <code>multicast\-querier</code> properties in <code>interface bridge</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/315](https\://github\.com/ansible\-collections/community\.routeros/pull/315)\)\.
|
||||
* api\_info\, api\_modify \- add support for the <code>routing filter num\-list</code> path implemented by RouterOS 7 and newer \([https\://github\.com/ansible\-collections/community\.routeros/pull/313](https\://github\.com/ansible\-collections/community\.routeros/pull/313)\)\.
|
||||
* api\_info\, api\_modify \- add support for the <code>routing igmp\-proxy</code> path \([https\://github\.com/ansible\-collections/community\.routeros/pull/309](https\://github\.com/ansible\-collections/community\.routeros/pull/309)\)\.
|
||||
* api\_modify\, api\_info \- add read\-only <code>default</code> field to <code>snmp community</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/311](https\://github\.com/ansible\-collections/community\.routeros/pull/311)\)\.
|
||||
|
||||
<a id="v2-18-0"></a>
|
||||
## v2\.18\.0
|
||||
|
||||
<a id="release-summary-13"></a>
|
||||
### Release Summary
|
||||
|
||||
Feature release\.
|
||||
|
||||
<a id="minor-changes-11"></a>
|
||||
### Minor Changes
|
||||
|
||||
* api\_info \- allow to restrict the output by limiting fields to specific values with the new <code>restrict</code> option \([https\://github\.com/ansible\-collections/community\.routeros/pull/305](https\://github\.com/ansible\-collections/community\.routeros/pull/305)\)\.
|
||||
* api\_info\, api\_modify \- add support for the <code>ip dhcp\-server matcher</code> path \([https\://github\.com/ansible\-collections/community\.routeros/pull/300](https\://github\.com/ansible\-collections/community\.routeros/pull/300)\)\.
|
||||
* api\_info\, api\_modify \- add support for the <code>ipv6 nd prefix</code> path \([https\://github\.com/ansible\-collections/community\.routeros/pull/303](https\://github\.com/ansible\-collections/community\.routeros/pull/303)\)\.
|
||||
* api\_info\, api\_modify \- add support for the <code>name</code> and <code>is\-responder</code> properties under the <code>interface wireguard peers</code> path introduced in RouterOS 7\.15 \([https\://github\.com/ansible\-collections/community\.routeros/pull/304](https\://github\.com/ansible\-collections/community\.routeros/pull/304)\)\.
|
||||
* api\_info\, api\_modify \- add support for the <code>routing ospf static\-neighbor</code> path in RouterOS 7 \([https\://github\.com/ansible\-collections/community\.routeros/pull/302](https\://github\.com/ansible\-collections/community\.routeros/pull/302)\)\.
|
||||
* api\_info\, api\_modify \- set default for <code>force</code> in <code>ip dhcp\-server option</code> to an explicit <code>false</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/300](https\://github\.com/ansible\-collections/community\.routeros/pull/300)\)\.
|
||||
* api\_modify \- allow to restrict what is updated by limiting fields to specific values with the new <code>restrict</code> option \([https\://github\.com/ansible\-collections/community\.routeros/pull/305](https\://github\.com/ansible\-collections/community\.routeros/pull/305)\)\.
|
||||
|
||||
<a id="deprecated-features"></a>
|
||||
### Deprecated Features
|
||||
|
||||
* The collection deprecates support for all Ansible/ansible\-base/ansible\-core versions that are currently End of Life\, [according to the ansible\-core support matrix](https\://docs\.ansible\.com/ansible\-core/devel/reference\_appendices/release\_and\_maintenance\.html\#ansible\-core\-support\-matrix)\. This means that the next major release of the collection will no longer support Ansible 2\.9\, ansible\-base 2\.10\, ansible\-core 2\.11\, ansible\-core 2\.12\, ansible\-core 2\.13\, and ansible\-core 2\.14\.
|
||||
|
||||
<a id="bugfixes-4"></a>
|
||||
### Bugfixes
|
||||
|
||||
* api\_modify\, api\_info \- change the default of <code>ingress\-filtering</code> in paths <code>interface bridge</code> and <code>interface bridge port</code> back to <code>false</code> for RouterOS before version 7 \([https\://github\.com/ansible\-collections/community\.routeros/pull/305](https\://github\.com/ansible\-collections/community\.routeros/pull/305)\)\.
|
||||
|
||||
<a id="v2-17-0"></a>
|
||||
## v2\.17\.0
|
||||
|
||||
<a id="release-summary-14"></a>
|
||||
### Release Summary
|
||||
|
||||
Feature release\.
|
||||
|
||||
<a id="minor-changes-12"></a>
|
||||
### Minor Changes
|
||||
|
||||
* api\_info\, api\_modify \- add <code>system health settings</code> path \([https\://github\.com/ansible\-collections/community\.routeros/pull/294](https\://github\.com/ansible\-collections/community\.routeros/pull/294)\)\.
|
||||
* api\_info\, api\_modify \- add missing path <code>/system resource irq rps</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/295](https\://github\.com/ansible\-collections/community\.routeros/pull/295)\)\.
|
||||
* api\_info\, api\_modify \- add parameter <code>host\-key\-type</code> for <code>ip ssh</code> path \([https\://github\.com/ansible\-collections/community\.routeros/issues/280](https\://github\.com/ansible\-collections/community\.routeros/issues/280)\, [https\://github\.com/ansible\-collections/community\.routeros/pull/297](https\://github\.com/ansible\-collections/community\.routeros/pull/297)\)\.
|
||||
|
||||
<a id="v2-16-0"></a>
|
||||
## v2\.16\.0
|
||||
|
||||
<a id="release-summary-15"></a>
|
||||
### Release Summary
|
||||
|
||||
Feature release\.
|
||||
|
||||
<a id="minor-changes-13"></a>
|
||||
### Minor Changes
|
||||
|
||||
* api\_info\, api\_modify \- add missing path <code>/ppp secret</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/286](https\://github\.com/ansible\-collections/community\.routeros/pull/286)\)\.
|
||||
* api\_info\, api\_modify \- minor changes <code>/interface ethernet</code> path fields \([https\://github\.com/ansible\-collections/community\.routeros/pull/288](https\://github\.com/ansible\-collections/community\.routeros/pull/288)\)\.
|
||||
|
||||
<a id="v2-15-0"></a>
|
||||
## v2\.15\.0
|
||||
|
||||
<a id="release-summary-16"></a>
|
||||
### Release Summary
|
||||
|
||||
Feature release\.
|
||||
|
||||
<a id="minor-changes-14"></a>
|
||||
### Minor Changes
|
||||
|
||||
* api\_info\, api\_modify \- Add RouterOS 7\.x support to <code>/mpls ldp</code> path \([https\://github\.com/ansible\-collections/community\.routeros/pull/271](https\://github\.com/ansible\-collections/community\.routeros/pull/271)\)\.
|
||||
* api\_info\, api\_modify \- add <code>/ip route rule</code> path for RouterOS 6\.x \([https\://github\.com/ansible\-collections/community\.routeros/pull/278](https\://github\.com/ansible\-collections/community\.routeros/pull/278)\)\.
|
||||
* api\_info\, api\_modify \- add <code>/routing filter</code> path for RouterOS 6\.x \([https\://github\.com/ansible\-collections/community\.routeros/pull/279](https\://github\.com/ansible\-collections/community\.routeros/pull/279)\)\.
|
||||
* api\_info\, api\_modify \- add default value for <code>from\-pool</code> field in <code>/ipv6 address</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/270](https\://github\.com/ansible\-collections/community\.routeros/pull/270)\)\.
|
||||
* api\_info\, api\_modify \- add missing path <code>/interface pppoe\-server server</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/273](https\://github\.com/ansible\-collections/community\.routeros/pull/273)\)\.
|
||||
* api\_info\, api\_modify \- add missing path <code>/ip dhcp\-relay</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/276](https\://github\.com/ansible\-collections/community\.routeros/pull/276)\)\.
|
||||
* api\_info\, api\_modify \- add missing path <code>/queue simple</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/269](https\://github\.com/ansible\-collections/community\.routeros/pull/269)\)\.
|
||||
* api\_info\, api\_modify \- add missing path <code>/queue type</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/274](https\://github\.com/ansible\-collections/community\.routeros/pull/274)\)\.
|
||||
* api\_info\, api\_modify \- add missing paths <code>/routing bgp aggregate</code>\, <code>/routing bgp network</code> and <code>/routing bgp peer</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/277](https\://github\.com/ansible\-collections/community\.routeros/pull/277)\)\.
|
||||
* api\_info\, api\_modify \- add support for paths <code>/mpls interface</code>\, <code>/mpls ldp accept\-filter</code>\, <code>/mpls ldp advertise\-filter</code> and <code>mpls ldp interface</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/272](https\://github\.com/ansible\-collections/community\.routeros/pull/272)\)\.
|
||||
|
||||
<a id="v2-14-0"></a>
|
||||
## v2\.14\.0
|
||||
|
||||
<a id="release-summary-17"></a>
|
||||
### Release Summary
|
||||
|
||||
Feature release\.
|
||||
|
||||
<a id="minor-changes-15"></a>
|
||||
### Minor Changes
|
||||
|
||||
* api\_info\, api\_modify \- add read\-only fields <code>installed\-version</code>\, <code>latest\-version</code> and <code>status</code> in <code>system package update</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/263](https\://github\.com/ansible\-collections/community\.routeros/pull/263)\)\.
|
||||
* api\_info\, api\_modify \- added support for <code>interface wifi</code> and its sub\-paths \([https\://github\.com/ansible\-collections/community\.routeros/pull/266](https\://github\.com/ansible\-collections/community\.routeros/pull/266)\)\.
|
||||
* api\_info\, api\_modify \- remove default value for read\-only <code>running</code> field in <code>interface wireless</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/264](https\://github\.com/ansible\-collections/community\.routeros/pull/264)\)\.
|
||||
|
||||
<a id="v2-13-0"></a>
|
||||
## v2\.13\.0
|
||||
|
||||
<a id="release-summary-18"></a>
|
||||
### Release Summary
|
||||
|
||||
Bugfix and feature release\.
|
||||
|
||||
<a id="minor-changes-16"></a>
|
||||
### Minor Changes
|
||||
|
||||
* api\_info\, api\_modify \- make path <code>user group</code> modifiable and add <code>comment</code> attribute \([https\://github\.com/ansible\-collections/community\.routeros/issues/256](https\://github\.com/ansible\-collections/community\.routeros/issues/256)\, [https\://github\.com/ansible\-collections/community\.routeros/pull/257](https\://github\.com/ansible\-collections/community\.routeros/pull/257)\)\.
|
||||
* api\_modify\, api\_info \- add support for the <code>ip vrf</code> path in RouterOS 7 \([https\://github\.com/ansible\-collections/community\.routeros/pull/259](https\://github\.com/ansible\-collections/community\.routeros/pull/259)\)
|
||||
|
||||
<a id="bugfixes-5"></a>
|
||||
### Bugfixes
|
||||
|
||||
* facts \- fix date not getting removed for idempotent config export \([https\://github\.com/ansible\-collections/community\.routeros/pull/262](https\://github\.com/ansible\-collections/community\.routeros/pull/262)\)\.
|
||||
|
||||
<a id="v2-12-0"></a>
|
||||
## v2\.12\.0
|
||||
|
||||
<a id="release-summary-19"></a>
|
||||
### Release Summary
|
||||
|
||||
Feature release\.
|
||||
|
||||
<a id="minor-changes-17"></a>
|
||||
### Minor Changes
|
||||
|
||||
* api\_info\, api\_modify \- add <code>interface ovpn\-client</code> path \([https\://github\.com/ansible\-collections/community\.routeros/issues/242](https\://github\.com/ansible\-collections/community\.routeros/issues/242)\, [https\://github\.com/ansible\-collections/community\.routeros/pull/244](https\://github\.com/ansible\-collections/community\.routeros/pull/244)\)\.
|
||||
* api\_info\, api\_modify \- add <code>radius</code> path \([https\://github\.com/ansible\-collections/community\.routeros/issues/241](https\://github\.com/ansible\-collections/community\.routeros/issues/241)\, [https\://github\.com/ansible\-collections/community\.routeros/pull/245](https\://github\.com/ansible\-collections/community\.routeros/pull/245)\)\.
|
||||
* api\_info\, api\_modify \- add <code>routing rule</code> path \([https\://github\.com/ansible\-collections/community\.routeros/issues/162](https\://github\.com/ansible\-collections/community\.routeros/issues/162)\, [https\://github\.com/ansible\-collections/community\.routeros/pull/246](https\://github\.com/ansible\-collections/community\.routeros/pull/246)\)\.
|
||||
* api\_info\, api\_modify \- add missing path <code>routing bgp template</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/243](https\://github\.com/ansible\-collections/community\.routeros/pull/243)\)\.
|
||||
* api\_info\, api\_modify \- add support for the <code>tx\-power</code> attribute in <code>interface wireless</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/239](https\://github\.com/ansible\-collections/community\.routeros/pull/239)\)\.
|
||||
* api\_info\, api\_modify \- removed <code>host</code> primary key in <code>tool netwatch</code> path \([https\://github\.com/ansible\-collections/community\.routeros/pull/248](https\://github\.com/ansible\-collections/community\.routeros/pull/248)\)\.
|
||||
* api\_modify\, api\_info \- added support for <code>interface wifiwave2</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/226](https\://github\.com/ansible\-collections/community\.routeros/pull/226)\)\.
|
||||
|
||||
<a id="v2-11-0"></a>
|
||||
## v2\.11\.0
|
||||
|
||||
<a id="release-summary-20"></a>
|
||||
### Release Summary
|
||||
|
||||
Feature and bugfix release\.
|
||||
|
||||
<a id="minor-changes-18"></a>
|
||||
### Minor Changes
|
||||
|
||||
* api\_info\, api\_modify \- add missing DoH parameters <code>doh\-max\-concurrent\-queries</code>\, <code>doh\-max\-server\-connections</code>\, and <code>doh\-timeout</code> to the <code>ip dns</code> path \([https\://github\.com/ansible\-collections/community\.routeros/issues/230](https\://github\.com/ansible\-collections/community\.routeros/issues/230)\, [https\://github\.com/ansible\-collections/community\.routeros/pull/235](https\://github\.com/ansible\-collections/community\.routeros/pull/235)\)
|
||||
* api\_info\, api\_modify \- add missing parameters <code>address\-list</code>\, <code>address\-list\-timeout</code>\, <code>randomise\-ports</code>\, and <code>realm</code> to subpaths of the <code>ip firewall</code> path \([https\://github\.com/ansible\-collections/community\.routeros/issues/236](https\://github\.com/ansible\-collections/community\.routeros/issues/236)\, [https\://github\.com/ansible\-collections/community\.routeros/pull/237](https\://github\.com/ansible\-collections/community\.routeros/pull/237)\)\.
|
||||
* api\_info\, api\_modify \- mark the <code>interface wireless</code> parameter <code>running</code> as read\-only \([https\://github\.com/ansible\-collections/community\.routeros/pull/233](https\://github\.com/ansible\-collections/community\.routeros/pull/233)\)\.
|
||||
* api\_info\, api\_modify \- set the default value to <code>false</code> for the <code>disabled</code> parameter in some more paths where it can be seen in the documentation \([https\://github\.com/ansible\-collections/community\.routeros/pull/237](https\://github\.com/ansible\-collections/community\.routeros/pull/237)\)\.
|
||||
* api\_modify \- add missing <code>comment</code> attribute to <code>/routing id</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/234](https\://github\.com/ansible\-collections/community\.routeros/pull/234)\)\.
|
||||
* api\_modify \- add missing attributes to the <code>routing bgp connection</code> path \([https\://github\.com/ansible\-collections/community\.routeros/pull/234](https\://github\.com/ansible\-collections/community\.routeros/pull/234)\)\.
|
||||
* api\_modify \- add versioning to the <code>/tool e\-mail</code> path \(RouterOS 7\.12 release\) \([https\://github\.com/ansible\-collections/community\.routeros/pull/234](https\://github\.com/ansible\-collections/community\.routeros/pull/234)\)\.
|
||||
* api\_modify \- make <code>/ip traffic\-flow target</code> a multiple value attribute \([https\://github\.com/ansible\-collections/community\.routeros/pull/234](https\://github\.com/ansible\-collections/community\.routeros/pull/234)\)\.
|
||||
|
||||
<a id="v2-10-0"></a>
|
||||
## v2\.10\.0
|
||||
|
||||
<a id="release-summary-21"></a>
|
||||
### Release Summary
|
||||
|
||||
Bugfix and feature release\.
|
||||
|
||||
<a id="minor-changes-19"></a>
|
||||
### Minor Changes
|
||||
|
||||
* api\_info \- add new <code>include\_read\_only</code> option to select behavior for read\-only values\. By default these are not returned \([https\://github\.com/ansible\-collections/community\.routeros/pull/213](https\://github\.com/ansible\-collections/community\.routeros/pull/213)\)\.
|
||||
* api\_info\, api\_modify \- add support for <code>address\-list</code> and <code>match\-subdomain</code> introduced by RouterOS 7\.7 in the <code>ip dns static</code> path \([https\://github\.com/ansible\-collections/community\.routeros/pull/197](https\://github\.com/ansible\-collections/community\.routeros/pull/197)\)\.
|
||||
* api\_info\, api\_modify \- add support for <code>user</code>\, <code>time</code> and <code>gmt\-offset</code> under the <code>system clock</code> path \([https\://github\.com/ansible\-collections/community\.routeros/pull/210](https\://github\.com/ansible\-collections/community\.routeros/pull/210)\)\.
|
||||
* api\_info\, api\_modify \- add support for the <code>interface ppp\-client</code> path \([https\://github\.com/ansible\-collections/community\.routeros/pull/199](https\://github\.com/ansible\-collections/community\.routeros/pull/199)\)\.
|
||||
* api\_info\, api\_modify \- add support for the <code>interface wireless</code> path \([https\://github\.com/ansible\-collections/community\.routeros/pull/195](https\://github\.com/ansible\-collections/community\.routeros/pull/195)\)\.
|
||||
* api\_info\, api\_modify \- add support for the <code>iot modbus</code> path \([https\://github\.com/ansible\-collections/community\.routeros/pull/205](https\://github\.com/ansible\-collections/community\.routeros/pull/205)\)\.
|
||||
* api\_info\, api\_modify \- add support for the <code>ip dhcp\-server option</code> and <code>ip dhcp\-server option sets</code> paths \([https\://github\.com/ansible\-collections/community\.routeros/pull/223](https\://github\.com/ansible\-collections/community\.routeros/pull/223)\)\.
|
||||
* api\_info\, api\_modify \- add support for the <code>ip upnp interfaces</code>\, <code>tool graphing interface</code>\, <code>tool graphing resource</code> paths \([https\://github\.com/ansible\-collections/community\.routeros/pull/227](https\://github\.com/ansible\-collections/community\.routeros/pull/227)\)\.
|
||||
* api\_info\, api\_modify \- add support for the <code>ipv6 firewall nat</code> path \([https\://github\.com/ansible\-collections/community\.routeros/pull/204](https\://github\.com/ansible\-collections/community\.routeros/pull/204)\)\.
|
||||
* api\_info\, api\_modify \- add support for the <code>mode</code> property in <code>ip neighbor discovery\-settings</code> introduced in RouterOS 7\.7 \([https\://github\.com/ansible\-collections/community\.routeros/pull/198](https\://github\.com/ansible\-collections/community\.routeros/pull/198)\)\.
|
||||
* api\_info\, api\_modify \- add support for the <code>port remote\-access</code> path \([https\://github\.com/ansible\-collections/community\.routeros/pull/224](https\://github\.com/ansible\-collections/community\.routeros/pull/224)\)\.
|
||||
* api\_info\, api\_modify \- add support for the <code>routing filter rule</code> and <code>routing filter select\-rule</code> paths \([https\://github\.com/ansible\-collections/community\.routeros/pull/200](https\://github\.com/ansible\-collections/community\.routeros/pull/200)\)\.
|
||||
* api\_info\, api\_modify \- add support for the <code>routing table</code> path in RouterOS 7 \([https\://github\.com/ansible\-collections/community\.routeros/pull/215](https\://github\.com/ansible\-collections/community\.routeros/pull/215)\)\.
|
||||
* api\_info\, api\_modify \- add support for the <code>tool netwatch</code> path in RouterOS 7 \([https\://github\.com/ansible\-collections/community\.routeros/pull/216](https\://github\.com/ansible\-collections/community\.routeros/pull/216)\)\.
|
||||
* api\_info\, api\_modify \- add support for the <code>user settings</code> path \([https\://github\.com/ansible\-collections/community\.routeros/pull/201](https\://github\.com/ansible\-collections/community\.routeros/pull/201)\)\.
|
||||
* api\_info\, api\_modify \- add support for the <code>user</code> path \([https\://github\.com/ansible\-collections/community\.routeros/pull/211](https\://github\.com/ansible\-collections/community\.routeros/pull/211)\)\.
|
||||
* api\_info\, api\_modify \- finalize fields for the <code>interface wireless security\-profiles</code> path and enable it \([https\://github\.com/ansible\-collections/community\.routeros/pull/203](https\://github\.com/ansible\-collections/community\.routeros/pull/203)\)\.
|
||||
* api\_info\, api\_modify \- finalize fields for the <code>ppp profile</code> path and enable it \([https\://github\.com/ansible\-collections/community\.routeros/pull/217](https\://github\.com/ansible\-collections/community\.routeros/pull/217)\)\.
|
||||
* api\_modify \- add new <code>handle\_read\_only</code> and <code>handle\_write\_only</code> options to handle the module\'s behavior for read\-only and write\-only fields \([https\://github\.com/ansible\-collections/community\.routeros/pull/213](https\://github\.com/ansible\-collections/community\.routeros/pull/213)\)\.
|
||||
* api\_modify\, api\_info \- support API paths <code>routing id</code>\, <code>routing bgp connection</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/220](https\://github\.com/ansible\-collections/community\.routeros/pull/220)\)\.
|
||||
|
||||
<a id="bugfixes-6"></a>
|
||||
### Bugfixes
|
||||
|
||||
* api\_info\, api\_modify \- in the <code>snmp</code> path\, ensure that <code>engine\-id\-suffix</code> is only available on RouterOS 7\.10\+\, and that <code>engine\-id</code> is read\-only on RouterOS 7\.10\+ \([https\://github\.com/ansible\-collections/community\.routeros/issues/208](https\://github\.com/ansible\-collections/community\.routeros/issues/208)\, [https\://github\.com/ansible\-collections/community\.routeros/pull/218](https\://github\.com/ansible\-collections/community\.routeros/pull/218)\)\.
|
||||
|
||||
<a id="v2-9-0"></a>
|
||||
## v2\.9\.0
|
||||
|
||||
<a id="release-summary-22"></a>
|
||||
### Release Summary
|
||||
|
||||
Bugfix and feature release\.
|
||||
|
||||
<a id="minor-changes-20"></a>
|
||||
### Minor Changes
|
||||
|
||||
* api\_info\, api\_modify \- add path <code>caps\-man channel</code> and enable path <code>caps\-man manager interface</code> \([https\://github\.com/ansible\-collections/community\.routeros/issues/193](https\://github\.com/ansible\-collections/community\.routeros/issues/193)\, [https\://github\.com/ansible\-collections/community\.routeros/pull/194](https\://github\.com/ansible\-collections/community\.routeros/pull/194)\)\.
|
||||
* api\_info\, api\_modify \- add path <code>ip traffic\-flow target</code> \([https\://github\.com/ansible\-collections/community\.routeros/issues/191](https\://github\.com/ansible\-collections/community\.routeros/issues/191)\, [https\://github\.com/ansible\-collections/community\.routeros/pull/192](https\://github\.com/ansible\-collections/community\.routeros/pull/192)\)\.
|
||||
|
||||
<a id="bugfixes-7"></a>
|
||||
### Bugfixes
|
||||
|
||||
* api\_modify\, api\_info \- add missing parameter <code>engine\-id\-suffix</code> for the <code>snmp</code> path \([https\://github\.com/ansible\-collections/community\.routeros/issues/189](https\://github\.com/ansible\-collections/community\.routeros/issues/189)\, [https\://github\.com/ansible\-collections/community\.routeros/pull/190](https\://github\.com/ansible\-collections/community\.routeros/pull/190)\)\.
|
||||
|
||||
<a id="v2-8-3"></a>
|
||||
## v2\.8\.3
|
||||
|
||||
<a id="release-summary-23"></a>
|
||||
### Release Summary
|
||||
|
||||
Maintenance release with updated documentation\.
|
||||
|
||||
From this version on\, community\.routeros is using the new [Ansible semantic markup](https\://docs\.ansible\.com/ansible/devel/dev\_guide/developing\_modules\_documenting\.html\#semantic\-markup\-within\-module\-documentation)
|
||||
in its documentation\. If you look at documentation with the ansible\-doc CLI tool
|
||||
from ansible\-core before 2\.15\, please note that it does not render the markup
|
||||
correctly\. You should be still able to read it in most cases\, but you need
|
||||
ansible\-core 2\.15 or later to see it as it is intended\. Alternatively you can
|
||||
look at [the devel docsite](https\://docs\.ansible\.com/ansible/devel/collections/community/routeros/)
|
||||
for the rendered HTML version of the documentation of the latest release\.
|
||||
|
||||
<a id="known-issues"></a>
|
||||
### Known Issues
|
||||
|
||||
* Ansible markup will show up in raw form on ansible\-doc text output for ansible\-core before 2\.15\. If you have trouble deciphering the documentation markup\, please upgrade to ansible\-core 2\.15 \(or newer\)\, or read the HTML documentation on [https\://docs\.ansible\.com/ansible/devel/collections/community/routeros/](https\://docs\.ansible\.com/ansible/devel/collections/community/routeros/)\.
|
||||
|
||||
<a id="v2-8-2"></a>
|
||||
## v2\.8\.2
|
||||
|
||||
<a id="release-summary-24"></a>
|
||||
### Release Summary
|
||||
|
||||
Bugfix release\.
|
||||
|
||||
<a id="bugfixes-8"></a>
|
||||
### Bugfixes
|
||||
|
||||
* api\_modify\, api\_info \- add missing parameter <code>tls</code> for the <code>tool e\-mail</code> path \([https\://github\.com/ansible\-collections/community\.routeros/issues/179](https\://github\.com/ansible\-collections/community\.routeros/issues/179)\, [https\://github\.com/ansible\-collections/community\.routeros/pull/180](https\://github\.com/ansible\-collections/community\.routeros/pull/180)\)\.
|
||||
|
||||
<a id="v2-8-1"></a>
|
||||
## v2\.8\.1
|
||||
|
||||
<a id="release-summary-25"></a>
|
||||
### Release Summary
|
||||
|
||||
Bugfix release\.
|
||||
|
||||
<a id="bugfixes-9"></a>
|
||||
### Bugfixes
|
||||
|
||||
* facts \- do not crash in CLI output preprocessing in unexpected situations during line unwrapping \([https\://github\.com/ansible\-collections/community\.routeros/issues/170](https\://github\.com/ansible\-collections/community\.routeros/issues/170)\, [https\://github\.com/ansible\-collections/community\.routeros/pull/177](https\://github\.com/ansible\-collections/community\.routeros/pull/177)\)\.
|
||||
|
||||
<a id="v2-8-0"></a>
|
||||
## v2\.8\.0
|
||||
|
||||
<a id="release-summary-26"></a>
|
||||
### Release Summary
|
||||
|
||||
Bugfix and feature release\.
|
||||
|
||||
<a id="minor-changes-21"></a>
|
||||
### Minor Changes
|
||||
|
||||
* api\_modify \- adapt data for API paths <code>ip dhcp\-server network</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/156](https\://github\.com/ansible\-collections/community\.routeros/pull/156)\)\.
|
||||
* api\_modify \- add support for API path <code>snmp community</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/159](https\://github\.com/ansible\-collections/community\.routeros/pull/159)\)\.
|
||||
* api\_modify \- add support for <code>trap\-interfaces</code> in API path <code>snmp</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/159](https\://github\.com/ansible\-collections/community\.routeros/pull/159)\)\.
|
||||
* api\_modify \- add support to disable IPv6 in API paths <code>ipv6 settings</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/158](https\://github\.com/ansible\-collections/community\.routeros/pull/158)\)\.
|
||||
* api\_modify \- support API paths <code>ip firewall layer7\-protocol</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/153](https\://github\.com/ansible\-collections/community\.routeros/pull/153)\)\.
|
||||
* command \- workaround for extra characters in stdout in RouterOS versions between 6\.49 and 7\.1\.5 \([https\://github\.com/ansible\-collections/community\.routeros/issues/62](https\://github\.com/ansible\-collections/community\.routeros/issues/62)\, [https\://github\.com/ansible\-collections/community\.routeros/pull/161](https\://github\.com/ansible\-collections/community\.routeros/pull/161)\)\.
|
||||
|
||||
<a id="bugfixes-10"></a>
|
||||
### Bugfixes
|
||||
|
||||
* api\_info\, api\_modify \- fix default and remove behavior for <code>dhcp\-options</code> in path <code>ip dhcp\-client</code> \([https\://github\.com/ansible\-collections/community\.routeros/issues/148](https\://github\.com/ansible\-collections/community\.routeros/issues/148)\, [https\://github\.com/ansible\-collections/community\.routeros/pull/154](https\://github\.com/ansible\-collections/community\.routeros/pull/154)\)\.
|
||||
* api\_modify \- fix handling of disabled keys on creation \([https\://github\.com/ansible\-collections/community\.routeros/pull/154](https\://github\.com/ansible\-collections/community\.routeros/pull/154)\)\.
|
||||
* various plugins and modules \- remove unnecessary imports \([https\://github\.com/ansible\-collections/community\.routeros/pull/149](https\://github\.com/ansible\-collections/community\.routeros/pull/149)\)\.
|
||||
|
||||
<a id="v2-7-0"></a>
|
||||
## v2\.7\.0
|
||||
|
||||
<a id="release-summary-27"></a>
|
||||
### Release Summary
|
||||
|
||||
Bugfix and feature release\.
|
||||
|
||||
<a id="minor-changes-22"></a>
|
||||
### Minor Changes
|
||||
|
||||
* api\_modify\, api\_info \- support API paths <code>ip arp</code>\, <code>ip firewall raw</code>\, <code>ipv6 firewall raw</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/144](https\://github\.com/ansible\-collections/community\.routeros/pull/144)\)\.
|
||||
|
||||
<a id="bugfixes-11"></a>
|
||||
### Bugfixes
|
||||
|
||||
* api\_modify\, api\_info \- defaults corrected for fields in <code>interface wireguard peers</code> API path \([https\://github\.com/ansible\-collections/community\.routeros/pull/144](https\://github\.com/ansible\-collections/community\.routeros/pull/144)\)\.
|
||||
|
||||
<a id="v2-6-0"></a>
|
||||
## v2\.6\.0
|
||||
|
||||
<a id="release-summary-28"></a>
|
||||
### Release Summary
|
||||
|
||||
Regular bugfix and feature release\.
|
||||
|
||||
<a id="minor-changes-23"></a>
|
||||
### Minor Changes
|
||||
|
||||
* api\_modify\, api\_info \- add field <code>regexp</code> to <code>ip dns static</code> \([https\://github\.com/ansible\-collections/community\.routeros/issues/141](https\://github\.com/ansible\-collections/community\.routeros/issues/141)\)\.
|
||||
* api\_modify\, api\_info \- support API paths <code>interface wireguard</code>\, <code>interface wireguard peers</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/143](https\://github\.com/ansible\-collections/community\.routeros/pull/143)\)\.
|
||||
|
||||
<a id="bugfixes-12"></a>
|
||||
### Bugfixes
|
||||
|
||||
* api\_modify \- do not use <code>name</code> as a unique key in <code>ip dns static</code> \([https\://github\.com/ansible\-collections/community\.routeros/issues/141](https\://github\.com/ansible\-collections/community\.routeros/issues/141)\)\.
|
||||
* api\_modify\, api\_info \- do not crash if router contains <code>regexp</code> DNS entries in <code>ip dns static</code> \([https\://github\.com/ansible\-collections/community\.routeros/issues/141](https\://github\.com/ansible\-collections/community\.routeros/issues/141)\)\.
|
||||
|
||||
<a id="v2-5-0"></a>
|
||||
## v2\.5\.0
|
||||
|
||||
<a id="release-summary-29"></a>
|
||||
### Release Summary
|
||||
|
||||
Feature and bugfix release\.
|
||||
|
||||
<a id="minor-changes-24"></a>
|
||||
### Minor Changes
|
||||
|
||||
* api\_info\, api\_modify \- support API paths <code>interface ethernet poe</code>\, <code>interface gre6</code>\, <code>interface vrrp</code> and also support all previously missing fields of entries in <code>ip dhcp\-server</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/137](https\://github\.com/ansible\-collections/community\.routeros/pull/137)\)\.
|
||||
|
||||
<a id="bugfixes-13"></a>
|
||||
### Bugfixes
|
||||
|
||||
* api\_modify \- <code>address\-pool</code> field of entries in API path <code>ip dhcp\-server</code> is not required anymore \([https\://github\.com/ansible\-collections/community\.routeros/pull/137](https\://github\.com/ansible\-collections/community\.routeros/pull/137)\)\.
|
||||
|
||||
<a id="v2-4-0"></a>
|
||||
## v2\.4\.0
|
||||
|
||||
<a id="release-summary-30"></a>
|
||||
### Release Summary
|
||||
|
||||
Feature release improving the <code>api\*</code> modules\.
|
||||
|
||||
<a id="minor-changes-25"></a>
|
||||
### Minor Changes
|
||||
|
||||
* api\* modules \- Add new option <code>force\_no\_cert</code> to connect with ADH ciphers \([https\://github\.com/ansible\-collections/community\.routeros/pull/124](https\://github\.com/ansible\-collections/community\.routeros/pull/124)\)\.
|
||||
* api\_info \- new parameter <code>include\_builtin</code> which allows to include \"builtin\" entries that are automatically generated by ROS and cannot be modified by the user \([https\://github\.com/ansible\-collections/community\.routeros/pull/130](https\://github\.com/ansible\-collections/community\.routeros/pull/130)\)\.
|
||||
* api\_modify\, api\_info \- support API paths \- <code>interface bonding</code>\, <code>interface bridge mlag</code>\, <code>ipv6 firewall mangle</code>\, <code>ipv6 nd</code>\, <code>system scheduler</code>\, <code>system script</code>\, <code>system ups</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/133](https\://github\.com/ansible\-collections/community\.routeros/pull/133)\)\.
|
||||
* api\_modify\, api\_info \- support API paths <code>caps\-man access\-list</code>\, <code>caps\-man configuration</code>\, <code>caps\-man datapath</code>\, <code>caps\-man manager</code>\, <code>caps\-man provisioning</code>\, <code>caps\-man security</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/126](https\://github\.com/ansible\-collections/community\.routeros/pull/126)\)\.
|
||||
* api\_modify\, api\_info \- support API paths <code>interface list</code> and <code>interface list member</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/120](https\://github\.com/ansible\-collections/community\.routeros/pull/120)\)\.
|
||||
* api\_modify\, api\_info \- support API paths <code>interface pppoe\-client</code>\, <code>interface vlan</code>\, <code>interface bridge</code>\, <code>interface bridge vlan</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/125](https\://github\.com/ansible\-collections/community\.routeros/pull/125)\)\.
|
||||
* api\_modify\, api\_info \- support API paths <code>ip ipsec identity</code>\, <code>ip ipsec peer</code>\, <code>ip ipsec policy</code>\, <code>ip ipsec profile</code>\, <code>ip ipsec proposal</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/129](https\://github\.com/ansible\-collections/community\.routeros/pull/129)\)\.
|
||||
* api\_modify\, api\_info \- support API paths <code>ip route</code> and <code>ip route vrf</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/123](https\://github\.com/ansible\-collections/community\.routeros/pull/123)\)\.
|
||||
* api\_modify\, api\_info \- support API paths <code>ipv6 address</code>\, <code>ipv6 dhcp\-server</code>\, <code>ipv6 dhcp\-server option</code>\, <code>ipv6 route</code>\, <code>queue tree</code>\, <code>routing ospf area</code>\, <code>routing ospf area range</code>\, <code>routing ospf instance</code>\, <code>routing ospf interface\-template</code>\, <code>routing pimsm instance</code>\, <code>routing pimsm interface\-template</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/131](https\://github\.com/ansible\-collections/community\.routeros/pull/131)\)\.
|
||||
* api\_modify\, api\_info \- support API paths <code>system logging</code>\, <code>system logging action</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/127](https\://github\.com/ansible\-collections/community\.routeros/pull/127)\)\.
|
||||
* api\_modify\, api\_info \- support field <code>hw\-offload</code> for path <code>ip firewall filter</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/121](https\://github\.com/ansible\-collections/community\.routeros/pull/121)\)\.
|
||||
* api\_modify\, api\_info \- support fields <code>address\-list</code>\, <code>address\-list\-timeout</code>\, <code>connection\-bytes</code>\, <code>connection\-limit</code>\, <code>connection\-mark</code>\, <code>connection\-rate</code>\, <code>connection\-type</code>\, <code>content</code>\, <code>disabled</code>\, <code>dscp</code>\, <code>dst\-address\-list</code>\, <code>dst\-address\-type</code>\, <code>dst\-limit</code>\, <code>fragment</code>\, <code>hotspot</code>\, <code>icmp\-options</code>\, <code>in\-bridge\-port</code>\, <code>in\-bridge\-port\-list</code>\, <code>ingress\-priority</code>\, <code>ipsec\-policy</code>\, <code>ipv4\-options</code>\, <code>jump\-target</code>\, <code>layer7\-protocol</code>\, <code>limit</code>\, <code>log</code>\, <code>log\-prefix</code>\, <code>nth</code>\, <code>out\-bridge\-port</code>\, <code>out\-bridge\-port\-list</code>\, <code>packet\-mark</code>\, <code>packet\-size</code>\, <code>per\-connection\-classifier</code>\, <code>port</code>\, <code>priority</code>\, <code>psd</code>\, <code>random</code>\, <code>realm</code>\, <code>routing\-mark</code>\, <code>same\-not\-by\-dst</code>\, <code>src\-address</code>\, <code>src\-address\-list</code>\, <code>src\-address\-type</code>\, <code>src\-mac\-address</code>\, <code>src\-port</code>\, <code>tcp\-mss</code>\, <code>time</code>\, <code>tls\-host</code>\, <code>ttl</code> in <code>ip firewall nat</code> path \([https\://github\.com/ansible\-collections/community\.routeros/pull/133](https\://github\.com/ansible\-collections/community\.routeros/pull/133)\)\.
|
||||
* api\_modify\, api\_info \- support fields <code>combo\-mode</code>\, <code>comment</code>\, <code>fec\-mode</code>\, <code>mdix\-enable</code>\, <code>poe\-out</code>\, <code>poe\-priority</code>\, <code>poe\-voltage</code>\, <code>power\-cycle\-interval</code>\, <code>power\-cycle\-ping\-address</code>\, <code>power\-cycle\-ping\-enabled</code>\, <code>power\-cycle\-ping\-timeout</code> for path <code>interface ethernet</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/121](https\://github\.com/ansible\-collections/community\.routeros/pull/121)\)\.
|
||||
* api\_modify\, api\_info \- support fields <code>jump\-target</code>\, <code>reject\-with</code> in <code>ip firewall filter</code> API path\, field <code>comment</code> in <code>ip firwall address\-list</code> API path\, field <code>jump\-target</code> in <code>ip firewall mangle</code> API path\, field <code>comment</code> in <code>ipv6 firewall address\-list</code> API path\, fields <code>jump\-target</code>\, <code>reject\-with</code> in <code>ipv6 firewall filter</code> API path \([https\://github\.com/ansible\-collections/community\.routeros/pull/133](https\://github\.com/ansible\-collections/community\.routeros/pull/133)\)\.
|
||||
* api\_modify\, api\_info \- support for API fields that can be disabled and have default value at the same time\, support API paths <code>interface gre</code>\, <code>interface eoip</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/128](https\://github\.com/ansible\-collections/community\.routeros/pull/128)\)\.
|
||||
* api\_modify\, api\_info \- support for fields <code>blackhole</code>\, <code>pref\-src</code>\, <code>routing\-table</code>\, <code>suppress\-hw\-offload</code>\, <code>type</code>\, <code>vrf\-interface</code> in <code>ip route</code> path \([https\://github\.com/ansible\-collections/community\.routeros/pull/131](https\://github\.com/ansible\-collections/community\.routeros/pull/131)\)\.
|
||||
* api\_modify\, api\_info \- support paths <code>system ntp client servers</code> and <code>system ntp server</code> available in ROS7\, as well as new fields <code>servers</code>\, <code>mode</code>\, and <code>vrf</code> for <code>system ntp client</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/122](https\://github\.com/ansible\-collections/community\.routeros/pull/122)\)\.
|
||||
|
||||
<a id="bugfixes-14"></a>
|
||||
### Bugfixes
|
||||
|
||||
* api\_modify \- <code>ip route</code> entry can be defined without the need of <code>gateway</code> field\, which is correct for unreachable/blackhole type of routes \([https\://github\.com/ansible\-collections/community\.routeros/pull/131](https\://github\.com/ansible\-collections/community\.routeros/pull/131)\)\.
|
||||
* api\_modify \- <code>queue interface</code> path works now \([https\://github\.com/ansible\-collections/community\.routeros/pull/131](https\://github\.com/ansible\-collections/community\.routeros/pull/131)\)\.
|
||||
* api\_modify\, api\_info \- removed wrong field <code>dynamic</code> from API path <code>ipv6 firewall address\-list</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/133](https\://github\.com/ansible\-collections/community\.routeros/pull/133)\)\.
|
||||
* api\_modify\, api\_info \- the default of the field <code>ingress\-filtering</code> in <code>interface bridge port</code> is now <code>true</code>\, which is the default in ROS \([https\://github\.com/ansible\-collections/community\.routeros/pull/125](https\://github\.com/ansible\-collections/community\.routeros/pull/125)\)\.
|
||||
* command\, facts \- commands do not timeout in safe mode anymore \([https\://github\.com/ansible\-collections/community\.routeros/pull/134](https\://github\.com/ansible\-collections/community\.routeros/pull/134)\)\.
|
||||
|
||||
<a id="known-issues-1"></a>
|
||||
### Known Issues
|
||||
|
||||
* api\_modify \- when limits for entries in <code>queue tree</code> are defined as human readable \- for example <code>25M</code> \-\, the configuration will be correctly set in ROS\, but the module will indicate the item is changed on every run even when there was no change done\. This is caused by the ROS API which returns the number in bytes \- for example <code>25000000</code> \(which is inconsistent with the CLI behavior\)\. In order to mitigate that\, the limits have to be defined in bytes \(those will still appear as human readable in the ROS CLI\) \([https\://github\.com/ansible\-collections/community\.routeros/pull/131](https\://github\.com/ansible\-collections/community\.routeros/pull/131)\)\.
|
||||
* api\_modify\, api\_info \- <code>routing ospf area</code>\, <code>routing ospf area range</code>\, <code>routing ospf instance</code>\, <code>routing ospf interface\-template</code> paths are not fully implemented for ROS6 due to the significant changes between ROS6 and ROS7 \([https\://github\.com/ansible\-collections/community\.routeros/pull/131](https\://github\.com/ansible\-collections/community\.routeros/pull/131)\)\.
|
||||
|
||||
<a id="v2-3-1"></a>
|
||||
## v2\.3\.1
|
||||
|
||||
<a id="release-summary-31"></a>
|
||||
### Release Summary
|
||||
|
||||
Maintenance release with improved documentation\.
|
||||
|
||||
<a id="known-issues-2"></a>
|
||||
### Known Issues
|
||||
|
||||
* The <code>community\.routeros\.command</code> module claims to support check mode\. Since it cannot judge whether the commands executed modify state or not\, this behavior is incorrect\. Since this potentially breaks existing playbooks\, we will not change this behavior until community\.routeros 3\.0\.0\.
|
||||
|
||||
<a id="v2-3-0"></a>
|
||||
## v2\.3\.0
|
||||
|
||||
<a id="release-summary-32"></a>
|
||||
### Release Summary
|
||||
|
||||
Feature and bugfix release\.
|
||||
|
||||
<a id="minor-changes-26"></a>
|
||||
### Minor Changes
|
||||
|
||||
* The collection repository conforms to the [REUSE specification](https\://reuse\.software/spec/) except for the changelog fragments \([https\://github\.com/ansible\-collections/community\.routeros/pull/108](https\://github\.com/ansible\-collections/community\.routeros/pull/108)\)\.
|
||||
* api\* modules \- added <code>timeout</code> parameter \([https\://github\.com/ansible\-collections/community\.routeros/pull/109](https\://github\.com/ansible\-collections/community\.routeros/pull/109)\)\.
|
||||
* api\_modify\, api\_info \- support API path <code>ip firewall mangle</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/110](https\://github\.com/ansible\-collections/community\.routeros/pull/110)\)\.
|
||||
|
||||
<a id="bugfixes-15"></a>
|
||||
### Bugfixes
|
||||
|
||||
* api\_modify\, api\_info \- make API path <code>ip dhcp\-server</code> support <code>script</code>\, and <code>ip firewall nat</code> support <code>in\-interface</code> and <code>in\-interface\-list</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/110](https\://github\.com/ansible\-collections/community\.routeros/pull/110)\)\.
|
||||
|
||||
<a id="v2-2-1"></a>
|
||||
## v2\.2\.1
|
||||
|
||||
<a id="release-summary-33"></a>
|
||||
### Release Summary
|
||||
|
||||
Bugfix release\.
|
||||
|
||||
<a id="bugfixes-16"></a>
|
||||
### Bugfixes
|
||||
|
||||
* api\_modify\, api\_info \- make API path <code>ip dhcp\-server lease</code> support <code>server\=all</code> \([https\://github\.com/ansible\-collections/community\.routeros/issues/104](https\://github\.com/ansible\-collections/community\.routeros/issues/104)\, [https\://github\.com/ansible\-collections/community\.routeros/pull/107](https\://github\.com/ansible\-collections/community\.routeros/pull/107)\)\.
|
||||
* api\_modify\, api\_info \- make API path <code>ip dhcp\-server network</code> support missing options <code>boot\-file\-name</code>\, <code>dhcp\-option\-set</code>\, <code>dns\-none</code>\, <code>domain</code>\, and <code>next\-server</code> \([https\://github\.com/ansible\-collections/community\.routeros/issues/104](https\://github\.com/ansible\-collections/community\.routeros/issues/104)\, [https\://github\.com/ansible\-collections/community\.routeros/pull/106](https\://github\.com/ansible\-collections/community\.routeros/pull/106)\)\.
|
||||
|
||||
<a id="v2-2-0"></a>
|
||||
## v2\.2\.0
|
||||
|
||||
<a id="release-summary-34"></a>
|
||||
### Release Summary
|
||||
|
||||
New feature release\.
|
||||
|
||||
<a id="minor-changes-27"></a>
|
||||
### Minor Changes
|
||||
|
||||
* All software licenses are now in the <code>LICENSES/</code> directory of the collection root\. Moreover\, <code>SPDX\-License\-Identifier\:</code> is used to declare the applicable license for every file that is not automatically generated \([https\://github\.com/ansible\-collections/community\.routeros/pull/101](https\://github\.com/ansible\-collections/community\.routeros/pull/101)\)\.
|
||||
|
||||
<a id="bugfixes-17"></a>
|
||||
### Bugfixes
|
||||
|
||||
* Include <code>LICENSES/BSD\-2\-Clause\.txt</code> file for the <code>routeros</code> module utils \([https\://github\.com/ansible\-collections/community\.routeros/pull/101](https\://github\.com/ansible\-collections/community\.routeros/pull/101)\)\.
|
||||
|
||||
<a id="new-modules"></a>
|
||||
### New Modules
|
||||
|
||||
* community\.routeros\.api\_info \- Retrieve information from API
|
||||
* community\.routeros\.api\_modify \- Modify data at paths with API
|
||||
|
||||
<a id="v2-1-0"></a>
|
||||
## v2\.1\.0
|
||||
|
||||
<a id="release-summary-35"></a>
|
||||
### Release Summary
|
||||
|
||||
Feature and bugfix release with new modules\.
|
||||
|
||||
<a id="minor-changes-28"></a>
|
||||
### Minor Changes
|
||||
|
||||
* Added a <code>community\.routeros\.api</code> module defaults group\. Use with <code>group/community\.routeros\.api</code> to provide options for all API\-based modules \([https\://github\.com/ansible\-collections/community\.routeros/pull/89](https\://github\.com/ansible\-collections/community\.routeros/pull/89)\)\.
|
||||
* Prepare collection for inclusion in an Execution Environment by declaring its dependencies \([https\://github\.com/ansible\-collections/community\.routeros/pull/83](https\://github\.com/ansible\-collections/community\.routeros/pull/83)\)\.
|
||||
* api \- add new option <code>extended query</code> more complex queries against RouterOS API \([https\://github\.com/ansible\-collections/community\.routeros/pull/63](https\://github\.com/ansible\-collections/community\.routeros/pull/63)\)\.
|
||||
* api \- update <code>query</code> to accept symbolic parameters \([https\://github\.com/ansible\-collections/community\.routeros/pull/63](https\://github\.com/ansible\-collections/community\.routeros/pull/63)\)\.
|
||||
* api\* modules \- allow to set an encoding other than the default ASCII for communicating with the API \([https\://github\.com/ansible\-collections/community\.routeros/pull/95](https\://github\.com/ansible\-collections/community\.routeros/pull/95)\)\.
|
||||
|
||||
<a id="bugfixes-18"></a>
|
||||
### Bugfixes
|
||||
|
||||
* query \- fix query function check for <code>\.id</code> vs\. <code>id</code> arguments to not conflict with routeros arguments like <code>identity</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/68](https\://github\.com/ansible\-collections/community\.routeros/pull/68)\, [https\://github\.com/ansible\-collections/community\.routeros/issues/67](https\://github\.com/ansible\-collections/community\.routeros/issues/67)\)\.
|
||||
* quoting and unquoting filter plugins\, api module \- handle the escape sequence <code>\\\_</code> correctly as escaping a space and not an underscore \([https\://github\.com/ansible\-collections/community\.routeros/pull/89](https\://github\.com/ansible\-collections/community\.routeros/pull/89)\)\.
|
||||
|
||||
<a id="new-modules-1"></a>
|
||||
### New Modules
|
||||
|
||||
* community\.routeros\.api\_facts \- Collect facts from remote devices running MikroTik RouterOS using the API
|
||||
* community\.routeros\.api\_find\_and\_modify \- Find and modify information using the API
|
||||
|
||||
<a id="v2-0-0"></a>
|
||||
## v2\.0\.0
|
||||
|
||||
<a id="release-summary-36"></a>
|
||||
### Release Summary
|
||||
|
||||
A new major release with breaking changes in the behavior of <code>community\.routeros\.api</code> and <code>community\.routeros\.command</code>\.
|
||||
|
||||
<a id="minor-changes-29"></a>
|
||||
### Minor Changes
|
||||
|
||||
* api \- make validation of <code>WHERE</code> for <code>query</code> more strict \([https\://github\.com/ansible\-collections/community\.routeros/pull/53](https\://github\.com/ansible\-collections/community\.routeros/pull/53)\)\.
|
||||
* command \- the <code>commands</code> and <code>wait\_for</code> options now convert the list elements to strings \([https\://github\.com/ansible\-collections/community\.routeros/pull/55](https\://github\.com/ansible\-collections/community\.routeros/pull/55)\)\.
|
||||
* facts \- the <code>gather\_subset</code> option now converts the list elements to strings \([https\://github\.com/ansible\-collections/community\.routeros/pull/55](https\://github\.com/ansible\-collections/community\.routeros/pull/55)\)\.
|
||||
|
||||
<a id="breaking-changes--porting-guide-1"></a>
|
||||
### Breaking Changes / Porting Guide
|
||||
|
||||
* api \- due to a programming error\, the module never failed on errors\. This has now been fixed\. If you are relying on the module not failing in case of idempotent commands \(resulting in errors like <code>failure\: already have such address</code>\)\, you need to adjust your roles/playbooks\. We suggest to use <code>failed\_when</code> to accept failure in specific circumstances\, for example <code>failed\_when\: \"\'failure\: already have \' in result\.msg\[0\]\"</code> \([https\://github\.com/ansible\-collections/community\.routeros/pull/39](https\://github\.com/ansible\-collections/community\.routeros/pull/39)\)\.
|
||||
* api \- splitting commands no longer uses a naive split by whitespace\, but a more RouterOS CLI compatible splitting algorithm \([https\://github\.com/ansible\-collections/community\.routeros/pull/45](https\://github\.com/ansible\-collections/community\.routeros/pull/45)\)\.
|
||||
* command \- the module now always indicates that a change happens\. If this is not correct\, please use <code>changed\_when</code> to determine the correct changed status for a task \([https\://github\.com/ansible\-collections/community\.routeros/pull/50](https\://github\.com/ansible\-collections/community\.routeros/pull/50)\)\.
|
||||
|
||||
<a id="bugfixes-19"></a>
|
||||
### Bugfixes
|
||||
|
||||
* api \- improve splitting of <code>WHERE</code> queries \([https\://github\.com/ansible\-collections/community\.routeros/pull/47](https\://github\.com/ansible\-collections/community\.routeros/pull/47)\)\.
|
||||
* api \- when converting result lists to dictionaries\, no longer removes second <code>\=</code> and text following that if present \([https\://github\.com/ansible\-collections/community\.routeros/pull/47](https\://github\.com/ansible\-collections/community\.routeros/pull/47)\)\.
|
||||
* routeros cliconf plugin \- adjust function signature that was modified in Ansible after creation of this plugin \([https\://github\.com/ansible\-collections/community\.routeros/pull/43](https\://github\.com/ansible\-collections/community\.routeros/pull/43)\)\.
|
||||
|
||||
<a id="new-plugins"></a>
|
||||
### New Plugins
|
||||
|
||||
<a id="filter"></a>
|
||||
#### Filter
|
||||
|
||||
* community\.routeros\.join \- Join a list of arguments to a command
|
||||
* community\.routeros\.list\_to\_dict \- Convert a list of arguments to a list of dictionary
|
||||
* community\.routeros\.quote\_argument \- Quote an argument
|
||||
* community\.routeros\.quote\_argument\_value \- Quote an argument value
|
||||
* community\.routeros\.split \- Split a command into arguments
|
||||
|
||||
<a id="v1-2-0"></a>
|
||||
## v1\.2\.0
|
||||
|
||||
<a id="release-summary-37"></a>
|
||||
### Release Summary
|
||||
|
||||
Bugfix and feature release\.
|
||||
|
||||
<a id="minor-changes-30"></a>
|
||||
### Minor Changes
|
||||
|
||||
* Avoid internal ansible\-core module\_utils in favor of equivalent public API available since at least Ansible 2\.9 \([https\://github\.com/ansible\-collections/community\.routeros/pull/38](https\://github\.com/ansible\-collections/community\.routeros/pull/38)\)\.
|
||||
* api \- add options <code>validate\_certs</code> \(default value <code>true</code>\)\, <code>validate\_cert\_hostname</code> \(default value <code>false</code>\)\, and <code>ca\_path</code> to control certificate validation \([https\://github\.com/ansible\-collections/community\.routeros/pull/37](https\://github\.com/ansible\-collections/community\.routeros/pull/37)\)\.
|
||||
* api \- rename option <code>ssl</code> to <code>tls</code>\, and keep the old name as an alias \([https\://github\.com/ansible\-collections/community\.routeros/pull/37](https\://github\.com/ansible\-collections/community\.routeros/pull/37)\)\.
|
||||
* fact \- add fact <code>ansible\_net\_config\_nonverbose</code> to get idempotent config \(no date\, no verbose\) \([https\://github\.com/ansible\-collections/community\.routeros/pull/23](https\://github\.com/ansible\-collections/community\.routeros/pull/23)\)\.
|
||||
|
||||
<a id="bugfixes-20"></a>
|
||||
### Bugfixes
|
||||
|
||||
* api \- when using TLS/SSL\, remove explicit cipher configuration to insecure values\, which also makes it impossible to connect to newer RouterOS versions \([https\://github\.com/ansible\-collections/community\.routeros/pull/34](https\://github\.com/ansible\-collections/community\.routeros/pull/34)\)\.
|
||||
|
||||
<a id="v1-1-0"></a>
|
||||
## v1\.1\.0
|
||||
|
||||
<a id="release-summary-38"></a>
|
||||
### Release Summary
|
||||
|
||||
This release allow dashes in usernames for SSH\-based modules\.
|
||||
|
||||
<a id="minor-changes-31"></a>
|
||||
### Minor Changes
|
||||
|
||||
* command \- added support for a dash \(<code>\-</code>\) in username \([https\://github\.com/ansible\-collections/community\.routeros/pull/18](https\://github\.com/ansible\-collections/community\.routeros/pull/18)\)\.
|
||||
* facts \- added support for a dash \(<code>\-</code>\) in username \([https\://github\.com/ansible\-collections/community\.routeros/pull/18](https\://github\.com/ansible\-collections/community\.routeros/pull/18)\)\.
|
||||
|
||||
<a id="v1-0-1"></a>
|
||||
## v1\.0\.1
|
||||
|
||||
<a id="release-summary-39"></a>
|
||||
### Release Summary
|
||||
|
||||
Maintenance release with a bugfix for <code>api</code>\.
|
||||
|
||||
<a id="bugfixes-21"></a>
|
||||
### Bugfixes
|
||||
|
||||
* api \- remove <code>id to \.id</code> as default requirement which conflicts with RouterOS <code>id</code> configuration parameter \([https\://github\.com/ansible\-collections/community\.routeros/pull/15](https\://github\.com/ansible\-collections/community\.routeros/pull/15)\)\.
|
||||
|
||||
<a id="v1-0-0"></a>
|
||||
## v1\.0\.0
|
||||
|
||||
<a id="release-summary-40"></a>
|
||||
### Release Summary
|
||||
|
||||
This is the first production \(non\-prerelease\) release of <code>community\.routeros</code>\.
|
||||
|
||||
<a id="bugfixes-22"></a>
|
||||
### Bugfixes
|
||||
|
||||
* routeros terminal plugin \- allow slashes in hostnames for terminal detection\. Without this\, slashes in hostnames will result in connection timeouts \([https\://github\.com/ansible\-collections/community\.network/pull/138](https\://github\.com/ansible\-collections/community\.network/pull/138)\)\.
|
||||
|
||||
<a id="v0-1-1"></a>
|
||||
## v0\.1\.1
|
||||
|
||||
<a id="release-summary-41"></a>
|
||||
### Release Summary
|
||||
|
||||
Small improvements and bugfixes over the initial release\.
|
||||
|
||||
<a id="bugfixes-23"></a>
|
||||
### Bugfixes
|
||||
|
||||
* api \- fix crash when the <code>ssl</code> parameter is used \([https\://github\.com/ansible\-collections/community\.routeros/pull/3](https\://github\.com/ansible\-collections/community\.routeros/pull/3)\)\.
|
||||
|
||||
<a id="v0-1-0"></a>
|
||||
## v0\.1\.0
|
||||
|
||||
<a id="release-summary-42"></a>
|
||||
### Release Summary
|
||||
|
||||
The <code>community\.routeros</code> continues the work on the Ansible RouterOS modules from their state in <code>community\.network</code> 1\.2\.0\. The changes listed here are thus relative to the modules <code>community\.network\.routeros\_\*</code>\.
|
||||
|
||||
<a id="minor-changes-32"></a>
|
||||
### Minor Changes
|
||||
|
||||
* facts \- now also collecting data about BGP and OSPF \([https\://github\.com/ansible\-collections/community\.network/pull/101](https\://github\.com/ansible\-collections/community\.network/pull/101)\)\.
|
||||
* facts \- set configuration export on to verbose\, for full configuration export \([https\://github\.com/ansible\-collections/community\.network/pull/104](https\://github\.com/ansible\-collections/community\.network/pull/104)\)\.
|
3
CHANGELOG.md.license
Normal file
3
CHANGELOG.md.license
Normal file
|
@ -0,0 +1,3 @@
|
|||
GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
657
CHANGELOG.rst
657
CHANGELOG.rst
|
@ -4,6 +4,643 @@ Community RouterOS Release Notes
|
|||
|
||||
.. contents:: Topics
|
||||
|
||||
v3.9.0
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Bugfix and feature release.
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- api_info, api modify - add ``remote-log-format``, ``remote-protocol``, and ``event-delimiter`` to ``system logging action`` (https://github.com/ansible-collections/community.routeros/pull/381).
|
||||
- api_info, api_modify - add ``disable-link-local-address`` and ``stale-neighbor-timeout`` fields to ``ipv6 settings`` (https://github.com/ansible-collections/community.routeros/pull/380).
|
||||
- api_info, api_modify - adjust neighbor limit fields in ``ipv6 settings`` to match RouterOS 7.18 and newer (https://github.com/ansible-collections/community.routeros/pull/380).
|
||||
- api_info, api_modify - set ``passthrough`` default in ``ip firewall mangle`` to ``true`` for RouterOS 7.19 and newer (https://github.com/ansible-collections/community.routeros/pull/382).
|
||||
- api_info, api_modify - since RouterOS 7.17 VRF is supported for OVPN server. It now supports multiple entries, while ``api_modify`` so far only accepted a single entry. The ``interface ovpn-server server`` path now allows multiple entries on RouterOS 7.17 and newer (https://github.com/ansible-collections/community.routeros/pull/383).
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- routeros terminal plugin - fix ``terminal_stdout_re`` pattern to handle long system identities when connecting to RouterOS through SSH (https://github.com/ansible-collections/community.routeros/pull/386).
|
||||
|
||||
v3.8.1
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Bugfix release.
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- facts and api_facts modules - prevent deprecation warnings when used with ansible-core 2.19 (https://github.com/ansible-collections/community.routeros/pull/384).
|
||||
|
||||
v3.8.0
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Feature release.
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- api_info, api_modify - add ``interface ethernet switch port-isolation`` which is supported since RouterOS 6.43 (https://github.com/ansible-collections/community.routeros/pull/375).
|
||||
- api_info, api_modify - add ``routing bfd configuration``. Officially stabilized BFD support for BGP and OSPF is available since RouterOS 7.11
|
||||
(https://github.com/ansible-collections/community.routeros/pull/375).
|
||||
- api_modify, api_info - support API path ``ip ipsec mode-config`` (https://github.com/ansible-collections/community.routeros/pull/376).
|
||||
|
||||
v3.7.0
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Feature release.
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- api_find_and_modify - allow to control whether ``dynamic`` and/or ``builtin`` entries are ignored with the new ``ignore_dynamic`` and ``ignore_builtin`` options (https://github.com/ansible-collections/community.routeros/issues/372, https://github.com/ansible-collections/community.routeros/pull/373).
|
||||
- api_info, api_modify - add ``port-cost-mode`` to ``interface bridge`` which is supported since RouterOS 7.13 (https://github.com/ansible-collections/community.routeros/pull/371).
|
||||
|
||||
v3.6.0
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Feature release.
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- api_info, api_modify - add ``mdns-repeat-ifaces`` to ``ip dns`` for RouterOS 7.16 and newer (https://github.com/ansible-collections/community.routeros/pull/358).
|
||||
- api_info, api_modify - field name change in ``routing bgp connection`` path implemented by RouterOS 7.19 and newer (https://github.com/ansible-collections/community.routeros/pull/360).
|
||||
- api_info, api_modify - rename ``is-responder`` property in ``interface wireguard peers`` to ``responder`` for RouterOS 7.17 and newer (https://github.com/ansible-collections/community.routeros/pull/364).
|
||||
|
||||
v3.5.0
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Feature release.
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- api_info, api_modify - change default for ``/ip/cloud/ddns-enabled`` for RouterOS 7.17 and newer from ``yes`` to ``auto`` (https://github.com/ansible-collections/community.routeros/pull/350).
|
||||
|
||||
v3.4.0
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Feature and bugfix release.
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- api_info, api_modify - add support for the ``ip dns forwarders`` path implemented by RouterOS 7.17 and newer (https://github.com/ansible-collections/community.routeros/pull/343).
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- api_info, api_modify - remove the primary key ``action`` from the ``interface wifi provisioning`` path, since RouterOS also allows to create completely duplicate entries (https://github.com/ansible-collections/community.routeros/issues/344, https://github.com/ansible-collections/community.routeros/pull/345).
|
||||
|
||||
v3.3.0
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Feature release.
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- api_info, api_modify - add missing attribute ``require-message-auth`` for the ``radius`` path which exists since RouterOS version 7.15 (https://github.com/ansible-collections/community.routeros/issues/338, https://github.com/ansible-collections/community.routeros/pull/339).
|
||||
- api_info, api_modify - add the ``interface 6to4`` path. Used to manage IPv6 tunnels via tunnel-brokers like HE, where native IPv6 is not provided (https://github.com/ansible-collections/community.routeros/pull/342).
|
||||
- api_info, api_modify - add the ``interface wireless access-list`` and ``interface wireless connect-list`` paths (https://github.com/ansible-collections/community.routeros/issues/284, https://github.com/ansible-collections/community.routeros/pull/340).
|
||||
- api_info, api_modify - add the ``use-interface-duid`` option for ``ipv6 dhcp-client`` path. This option prevents issues with Fritzbox modems and routers, when using virtual interfaces (like VLANs) may create duplicated records in hosts config, this breaks original "expose-host" function. Also add the ``script``, ``custom-duid`` and ``validate-server-duid`` as backport from 7.15 version update (https://github.com/ansible-collections/community.routeros/pull/341).
|
||||
|
||||
v3.2.0
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Feature release.
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- api_info, api_modify - add support for the ``routing filter community-list`` path implemented by RouterOS 7 and newer (https://github.com/ansible-collections/community.routeros/pull/331).
|
||||
|
||||
v3.1.0
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Bugfix and feature release.
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- api_info, api_modify - add missing fields ``comment``, ``next-pool`` to ``ip pool`` path (https://github.com/ansible-collections/community.routeros/pull/327).
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- api_info, api_modify - fields ``log`` and ``log-prefix`` in paths ``ip firewall filter``, ``ip firewall mangle``, ``ip firewall nat``, ``ip firewall raw`` now have the correct default values (https://github.com/ansible-collections/community.routeros/pull/324).
|
||||
|
||||
v3.0.0
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Major release that drops support for End of Life Python versions and fixes check mode for community.routeros.command.
|
||||
|
||||
Breaking Changes / Porting Guide
|
||||
--------------------------------
|
||||
|
||||
- command - the module no longer declares that it supports check mode (https://github.com/ansible-collections/community.routeros/pull/318).
|
||||
|
||||
Removed Features (previously deprecated)
|
||||
----------------------------------------
|
||||
|
||||
- The collection no longer supports Ansible 2.9, ansible-base 2.10, ansible-core 2.11, ansible-core 2.12, ansible-core 2.13, and ansible-core 2.14. If you need to continue using End of Life versions of Ansible/ansible-base/ansible-core, please use community.routeros 2.x.y (https://github.com/ansible-collections/community.routeros/pull/318).
|
||||
|
||||
v2.20.0
|
||||
=======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Feature release.
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- api_info, api_modify - add new parameters from the RouterOS 7.16 release (https://github.com/ansible-collections/community.routeros/pull/323).
|
||||
- api_info, api_modify - add support ``interface l2tp-client`` configuration (https://github.com/ansible-collections/community.routeros/pull/322).
|
||||
- api_info, api_modify - add support for the ``cpu-frequency``, ``memory-frequency``, ``preboot-etherboot`` and ``preboot-etherboot-server`` properties in ``system routerboard settings`` (https://github.com/ansible-collections/community.routeros/pull/320).
|
||||
- api_info, api_modify - add support for the ``matching-type`` property in ``ip dhcp-server matcher`` introduced by RouterOS 7.16 (https://github.com/ansible-collections/community.routeros/pull/321).
|
||||
|
||||
v2.19.0
|
||||
=======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Feature release.
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- api_info, api_modify - add support for the ``ip dns adlist`` path implemented by RouterOS 7.15 and newer (https://github.com/ansible-collections/community.routeros/pull/310).
|
||||
- api_info, api_modify - add support for the ``mld-version`` and ``multicast-querier`` properties in ``interface bridge`` (https://github.com/ansible-collections/community.routeros/pull/315).
|
||||
- api_info, api_modify - add support for the ``routing filter num-list`` path implemented by RouterOS 7 and newer (https://github.com/ansible-collections/community.routeros/pull/313).
|
||||
- api_info, api_modify - add support for the ``routing igmp-proxy`` path (https://github.com/ansible-collections/community.routeros/pull/309).
|
||||
- api_modify, api_info - add read-only ``default`` field to ``snmp community`` (https://github.com/ansible-collections/community.routeros/pull/311).
|
||||
|
||||
v2.18.0
|
||||
=======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Feature release.
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- api_info - allow to restrict the output by limiting fields to specific values with the new ``restrict`` option (https://github.com/ansible-collections/community.routeros/pull/305).
|
||||
- api_info, api_modify - add support for the ``ip dhcp-server matcher`` path (https://github.com/ansible-collections/community.routeros/pull/300).
|
||||
- api_info, api_modify - add support for the ``ipv6 nd prefix`` path (https://github.com/ansible-collections/community.routeros/pull/303).
|
||||
- api_info, api_modify - add support for the ``name`` and ``is-responder`` properties under the ``interface wireguard peers`` path introduced in RouterOS 7.15 (https://github.com/ansible-collections/community.routeros/pull/304).
|
||||
- api_info, api_modify - add support for the ``routing ospf static-neighbor`` path in RouterOS 7 (https://github.com/ansible-collections/community.routeros/pull/302).
|
||||
- api_info, api_modify - set default for ``force`` in ``ip dhcp-server option`` to an explicit ``false`` (https://github.com/ansible-collections/community.routeros/pull/300).
|
||||
- api_modify - allow to restrict what is updated by limiting fields to specific values with the new ``restrict`` option (https://github.com/ansible-collections/community.routeros/pull/305).
|
||||
|
||||
Deprecated Features
|
||||
-------------------
|
||||
|
||||
- The collection deprecates support for all Ansible/ansible-base/ansible-core versions that are currently End of Life, `according to the ansible-core support matrix <https://docs.ansible.com/ansible-core/devel/reference_appendices/release_and_maintenance.html#ansible-core-support-matrix>`__. This means that the next major release of the collection will no longer support Ansible 2.9, ansible-base 2.10, ansible-core 2.11, ansible-core 2.12, ansible-core 2.13, and ansible-core 2.14.
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- api_modify, api_info - change the default of ``ingress-filtering`` in paths ``interface bridge`` and ``interface bridge port`` back to ``false`` for RouterOS before version 7 (https://github.com/ansible-collections/community.routeros/pull/305).
|
||||
|
||||
v2.17.0
|
||||
=======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Feature release.
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- api_info, api_modify - add ``system health settings`` path (https://github.com/ansible-collections/community.routeros/pull/294).
|
||||
- api_info, api_modify - add missing path ``/system resource irq rps`` (https://github.com/ansible-collections/community.routeros/pull/295).
|
||||
- api_info, api_modify - add parameter ``host-key-type`` for ``ip ssh`` path (https://github.com/ansible-collections/community.routeros/issues/280, https://github.com/ansible-collections/community.routeros/pull/297).
|
||||
|
||||
v2.16.0
|
||||
=======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Feature release.
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- api_info, api_modify - add missing path ``/ppp secret`` (https://github.com/ansible-collections/community.routeros/pull/286).
|
||||
- api_info, api_modify - minor changes ``/interface ethernet`` path fields (https://github.com/ansible-collections/community.routeros/pull/288).
|
||||
|
||||
v2.15.0
|
||||
=======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Feature release.
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- api_info, api_modify - Add RouterOS 7.x support to ``/mpls ldp`` path (https://github.com/ansible-collections/community.routeros/pull/271).
|
||||
- api_info, api_modify - add ``/ip route rule`` path for RouterOS 6.x (https://github.com/ansible-collections/community.routeros/pull/278).
|
||||
- api_info, api_modify - add ``/routing filter`` path for RouterOS 6.x (https://github.com/ansible-collections/community.routeros/pull/279).
|
||||
- api_info, api_modify - add default value for ``from-pool`` field in ``/ipv6 address`` (https://github.com/ansible-collections/community.routeros/pull/270).
|
||||
- api_info, api_modify - add missing path ``/interface pppoe-server server`` (https://github.com/ansible-collections/community.routeros/pull/273).
|
||||
- api_info, api_modify - add missing path ``/ip dhcp-relay`` (https://github.com/ansible-collections/community.routeros/pull/276).
|
||||
- api_info, api_modify - add missing path ``/queue simple`` (https://github.com/ansible-collections/community.routeros/pull/269).
|
||||
- api_info, api_modify - add missing path ``/queue type`` (https://github.com/ansible-collections/community.routeros/pull/274).
|
||||
- api_info, api_modify - add missing paths ``/routing bgp aggregate``, ``/routing bgp network`` and ``/routing bgp peer`` (https://github.com/ansible-collections/community.routeros/pull/277).
|
||||
- api_info, api_modify - add support for paths ``/mpls interface``, ``/mpls ldp accept-filter``, ``/mpls ldp advertise-filter`` and ``mpls ldp interface`` (https://github.com/ansible-collections/community.routeros/pull/272).
|
||||
|
||||
v2.14.0
|
||||
=======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Feature release.
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- api_info, api_modify - add read-only fields ``installed-version``, ``latest-version`` and ``status`` in ``system package update`` (https://github.com/ansible-collections/community.routeros/pull/263).
|
||||
- api_info, api_modify - added support for ``interface wifi`` and its sub-paths (https://github.com/ansible-collections/community.routeros/pull/266).
|
||||
- api_info, api_modify - remove default value for read-only ``running`` field in ``interface wireless`` (https://github.com/ansible-collections/community.routeros/pull/264).
|
||||
|
||||
v2.13.0
|
||||
=======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Bugfix and feature release.
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- api_info, api_modify - make path ``user group`` modifiable and add ``comment`` attribute (https://github.com/ansible-collections/community.routeros/issues/256, https://github.com/ansible-collections/community.routeros/pull/257).
|
||||
- api_modify, api_info - add support for the ``ip vrf`` path in RouterOS 7 (https://github.com/ansible-collections/community.routeros/pull/259)
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- facts - fix date not getting removed for idempotent config export (https://github.com/ansible-collections/community.routeros/pull/262).
|
||||
|
||||
v2.12.0
|
||||
=======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Feature release.
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- api_info, api_modify - add ``interface ovpn-client`` path (https://github.com/ansible-collections/community.routeros/issues/242, https://github.com/ansible-collections/community.routeros/pull/244).
|
||||
- api_info, api_modify - add ``radius`` path (https://github.com/ansible-collections/community.routeros/issues/241, https://github.com/ansible-collections/community.routeros/pull/245).
|
||||
- api_info, api_modify - add ``routing rule`` path (https://github.com/ansible-collections/community.routeros/issues/162, https://github.com/ansible-collections/community.routeros/pull/246).
|
||||
- api_info, api_modify - add missing path ``routing bgp template`` (https://github.com/ansible-collections/community.routeros/pull/243).
|
||||
- api_info, api_modify - add support for the ``tx-power`` attribute in ``interface wireless`` (https://github.com/ansible-collections/community.routeros/pull/239).
|
||||
- api_info, api_modify - removed ``host`` primary key in ``tool netwatch`` path (https://github.com/ansible-collections/community.routeros/pull/248).
|
||||
- api_modify, api_info - added support for ``interface wifiwave2`` (https://github.com/ansible-collections/community.routeros/pull/226).
|
||||
|
||||
v2.11.0
|
||||
=======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Feature and bugfix release.
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- api_info, api_modify - add missing DoH parameters ``doh-max-concurrent-queries``, ``doh-max-server-connections``, and ``doh-timeout`` to the ``ip dns`` path (https://github.com/ansible-collections/community.routeros/issues/230, https://github.com/ansible-collections/community.routeros/pull/235)
|
||||
- api_info, api_modify - add missing parameters ``address-list``, ``address-list-timeout``, ``randomise-ports``, and ``realm`` to subpaths of the ``ip firewall`` path (https://github.com/ansible-collections/community.routeros/issues/236, https://github.com/ansible-collections/community.routeros/pull/237).
|
||||
- api_info, api_modify - mark the ``interface wireless`` parameter ``running`` as read-only (https://github.com/ansible-collections/community.routeros/pull/233).
|
||||
- api_info, api_modify - set the default value to ``false`` for the ``disabled`` parameter in some more paths where it can be seen in the documentation (https://github.com/ansible-collections/community.routeros/pull/237).
|
||||
- api_modify - add missing ``comment`` attribute to ``/routing id`` (https://github.com/ansible-collections/community.routeros/pull/234).
|
||||
- api_modify - add missing attributes to the ``routing bgp connection`` path (https://github.com/ansible-collections/community.routeros/pull/234).
|
||||
- api_modify - add versioning to the ``/tool e-mail`` path (RouterOS 7.12 release) (https://github.com/ansible-collections/community.routeros/pull/234).
|
||||
- api_modify - make ``/ip traffic-flow target`` a multiple value attribute (https://github.com/ansible-collections/community.routeros/pull/234).
|
||||
|
||||
v2.10.0
|
||||
=======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Bugfix and feature release.
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- api_info - add new ``include_read_only`` option to select behavior for read-only values. By default these are not returned (https://github.com/ansible-collections/community.routeros/pull/213).
|
||||
- api_info, api_modify - add support for ``address-list`` and ``match-subdomain`` introduced by RouterOS 7.7 in the ``ip dns static`` path (https://github.com/ansible-collections/community.routeros/pull/197).
|
||||
- api_info, api_modify - add support for ``user``, ``time`` and ``gmt-offset`` under the ``system clock`` path (https://github.com/ansible-collections/community.routeros/pull/210).
|
||||
- api_info, api_modify - add support for the ``interface ppp-client`` path (https://github.com/ansible-collections/community.routeros/pull/199).
|
||||
- api_info, api_modify - add support for the ``interface wireless`` path (https://github.com/ansible-collections/community.routeros/pull/195).
|
||||
- api_info, api_modify - add support for the ``iot modbus`` path (https://github.com/ansible-collections/community.routeros/pull/205).
|
||||
- api_info, api_modify - add support for the ``ip dhcp-server option`` and ``ip dhcp-server option sets`` paths (https://github.com/ansible-collections/community.routeros/pull/223).
|
||||
- api_info, api_modify - add support for the ``ip upnp interfaces``, ``tool graphing interface``, ``tool graphing resource`` paths (https://github.com/ansible-collections/community.routeros/pull/227).
|
||||
- api_info, api_modify - add support for the ``ipv6 firewall nat`` path (https://github.com/ansible-collections/community.routeros/pull/204).
|
||||
- api_info, api_modify - add support for the ``mode`` property in ``ip neighbor discovery-settings`` introduced in RouterOS 7.7 (https://github.com/ansible-collections/community.routeros/pull/198).
|
||||
- api_info, api_modify - add support for the ``port remote-access`` path (https://github.com/ansible-collections/community.routeros/pull/224).
|
||||
- api_info, api_modify - add support for the ``routing filter rule`` and ``routing filter select-rule`` paths (https://github.com/ansible-collections/community.routeros/pull/200).
|
||||
- api_info, api_modify - add support for the ``routing table`` path in RouterOS 7 (https://github.com/ansible-collections/community.routeros/pull/215).
|
||||
- api_info, api_modify - add support for the ``tool netwatch`` path in RouterOS 7 (https://github.com/ansible-collections/community.routeros/pull/216).
|
||||
- api_info, api_modify - add support for the ``user settings`` path (https://github.com/ansible-collections/community.routeros/pull/201).
|
||||
- api_info, api_modify - add support for the ``user`` path (https://github.com/ansible-collections/community.routeros/pull/211).
|
||||
- api_info, api_modify - finalize fields for the ``interface wireless security-profiles`` path and enable it (https://github.com/ansible-collections/community.routeros/pull/203).
|
||||
- api_info, api_modify - finalize fields for the ``ppp profile`` path and enable it (https://github.com/ansible-collections/community.routeros/pull/217).
|
||||
- api_modify - add new ``handle_read_only`` and ``handle_write_only`` options to handle the module's behavior for read-only and write-only fields (https://github.com/ansible-collections/community.routeros/pull/213).
|
||||
- api_modify, api_info - support API paths ``routing id``, ``routing bgp connection`` (https://github.com/ansible-collections/community.routeros/pull/220).
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- api_info, api_modify - in the ``snmp`` path, ensure that ``engine-id-suffix`` is only available on RouterOS 7.10+, and that ``engine-id`` is read-only on RouterOS 7.10+ (https://github.com/ansible-collections/community.routeros/issues/208, https://github.com/ansible-collections/community.routeros/pull/218).
|
||||
|
||||
v2.9.0
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Bugfix and feature release.
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- api_info, api_modify - add path ``caps-man channel`` and enable path ``caps-man manager interface`` (https://github.com/ansible-collections/community.routeros/issues/193, https://github.com/ansible-collections/community.routeros/pull/194).
|
||||
- api_info, api_modify - add path ``ip traffic-flow target`` (https://github.com/ansible-collections/community.routeros/issues/191, https://github.com/ansible-collections/community.routeros/pull/192).
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- api_modify, api_info - add missing parameter ``engine-id-suffix`` for the ``snmp`` path (https://github.com/ansible-collections/community.routeros/issues/189, https://github.com/ansible-collections/community.routeros/pull/190).
|
||||
|
||||
v2.8.3
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Maintenance release with updated documentation.
|
||||
|
||||
From this version on, community.routeros is using the new `Ansible semantic markup
|
||||
<https://docs.ansible.com/ansible/devel/dev_guide/developing_modules_documenting.html#semantic-markup-within-module-documentation>`__
|
||||
in its documentation. If you look at documentation with the ansible-doc CLI tool
|
||||
from ansible-core before 2.15, please note that it does not render the markup
|
||||
correctly. You should be still able to read it in most cases, but you need
|
||||
ansible-core 2.15 or later to see it as it is intended. Alternatively you can
|
||||
look at `the devel docsite <https://docs.ansible.com/ansible/devel/collections/community/routeros/>`__
|
||||
for the rendered HTML version of the documentation of the latest release.
|
||||
|
||||
Known Issues
|
||||
------------
|
||||
|
||||
- Ansible markup will show up in raw form on ansible-doc text output for ansible-core before 2.15. If you have trouble deciphering the documentation markup, please upgrade to ansible-core 2.15 (or newer), or read the HTML documentation on https://docs.ansible.com/ansible/devel/collections/community/routeros/.
|
||||
|
||||
v2.8.2
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Bugfix release.
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- api_modify, api_info - add missing parameter ``tls`` for the ``tool e-mail`` path (https://github.com/ansible-collections/community.routeros/issues/179, https://github.com/ansible-collections/community.routeros/pull/180).
|
||||
|
||||
v2.8.1
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Bugfix release.
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- facts - do not crash in CLI output preprocessing in unexpected situations during line unwrapping (https://github.com/ansible-collections/community.routeros/issues/170, https://github.com/ansible-collections/community.routeros/pull/177).
|
||||
|
||||
v2.8.0
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Bugfix and feature release.
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- api_modify - adapt data for API paths ``ip dhcp-server network`` (https://github.com/ansible-collections/community.routeros/pull/156).
|
||||
- api_modify - add support for API path ``snmp community`` (https://github.com/ansible-collections/community.routeros/pull/159).
|
||||
- api_modify - add support for ``trap-interfaces`` in API path ``snmp`` (https://github.com/ansible-collections/community.routeros/pull/159).
|
||||
- api_modify - add support to disable IPv6 in API paths ``ipv6 settings`` (https://github.com/ansible-collections/community.routeros/pull/158).
|
||||
- api_modify - support API paths ``ip firewall layer7-protocol`` (https://github.com/ansible-collections/community.routeros/pull/153).
|
||||
- command - workaround for extra characters in stdout in RouterOS versions between 6.49 and 7.1.5 (https://github.com/ansible-collections/community.routeros/issues/62, https://github.com/ansible-collections/community.routeros/pull/161).
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- api_info, api_modify - fix default and remove behavior for ``dhcp-options`` in path ``ip dhcp-client`` (https://github.com/ansible-collections/community.routeros/issues/148, https://github.com/ansible-collections/community.routeros/pull/154).
|
||||
- api_modify - fix handling of disabled keys on creation (https://github.com/ansible-collections/community.routeros/pull/154).
|
||||
- various plugins and modules - remove unnecessary imports (https://github.com/ansible-collections/community.routeros/pull/149).
|
||||
|
||||
v2.7.0
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Bugfix and feature release.
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- api_modify, api_info - support API paths ``ip arp``, ``ip firewall raw``, ``ipv6 firewall raw`` (https://github.com/ansible-collections/community.routeros/pull/144).
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- api_modify, api_info - defaults corrected for fields in ``interface wireguard peers`` API path (https://github.com/ansible-collections/community.routeros/pull/144).
|
||||
|
||||
v2.6.0
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Regular bugfix and feature release.
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- api_modify, api_info - add field ``regexp`` to ``ip dns static`` (https://github.com/ansible-collections/community.routeros/issues/141).
|
||||
- api_modify, api_info - support API paths ``interface wireguard``, ``interface wireguard peers`` (https://github.com/ansible-collections/community.routeros/pull/143).
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- api_modify - do not use ``name`` as a unique key in ``ip dns static`` (https://github.com/ansible-collections/community.routeros/issues/141).
|
||||
- api_modify, api_info - do not crash if router contains ``regexp`` DNS entries in ``ip dns static`` (https://github.com/ansible-collections/community.routeros/issues/141).
|
||||
|
||||
v2.5.0
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Feature and bugfix release.
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- api_info, api_modify - support API paths ``interface ethernet poe``, ``interface gre6``, ``interface vrrp`` and also support all previously missing fields of entries in ``ip dhcp-server`` (https://github.com/ansible-collections/community.routeros/pull/137).
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- api_modify - ``address-pool`` field of entries in API path ``ip dhcp-server`` is not required anymore (https://github.com/ansible-collections/community.routeros/pull/137).
|
||||
|
||||
v2.4.0
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Feature release improving the ``api*`` modules.
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- api* modules - Add new option ``force_no_cert`` to connect with ADH ciphers (https://github.com/ansible-collections/community.routeros/pull/124).
|
||||
- api_info - new parameter ``include_builtin`` which allows to include "builtin" entries that are automatically generated by ROS and cannot be modified by the user (https://github.com/ansible-collections/community.routeros/pull/130).
|
||||
- api_modify, api_info - support API paths - ``interface bonding``, ``interface bridge mlag``, ``ipv6 firewall mangle``, ``ipv6 nd``, ``system scheduler``, ``system script``, ``system ups`` (https://github.com/ansible-collections/community.routeros/pull/133).
|
||||
- api_modify, api_info - support API paths ``caps-man access-list``, ``caps-man configuration``, ``caps-man datapath``, ``caps-man manager``, ``caps-man provisioning``, ``caps-man security`` (https://github.com/ansible-collections/community.routeros/pull/126).
|
||||
- api_modify, api_info - support API paths ``interface list`` and ``interface list member`` (https://github.com/ansible-collections/community.routeros/pull/120).
|
||||
- api_modify, api_info - support API paths ``interface pppoe-client``, ``interface vlan``, ``interface bridge``, ``interface bridge vlan`` (https://github.com/ansible-collections/community.routeros/pull/125).
|
||||
- api_modify, api_info - support API paths ``ip ipsec identity``, ``ip ipsec peer``, ``ip ipsec policy``, ``ip ipsec profile``, ``ip ipsec proposal`` (https://github.com/ansible-collections/community.routeros/pull/129).
|
||||
- api_modify, api_info - support API paths ``ip route`` and ``ip route vrf`` (https://github.com/ansible-collections/community.routeros/pull/123).
|
||||
- api_modify, api_info - support API paths ``ipv6 address``, ``ipv6 dhcp-server``, ``ipv6 dhcp-server option``, ``ipv6 route``, ``queue tree``, ``routing ospf area``, ``routing ospf area range``, ``routing ospf instance``, ``routing ospf interface-template``, ``routing pimsm instance``, ``routing pimsm interface-template`` (https://github.com/ansible-collections/community.routeros/pull/131).
|
||||
- api_modify, api_info - support API paths ``system logging``, ``system logging action`` (https://github.com/ansible-collections/community.routeros/pull/127).
|
||||
- api_modify, api_info - support field ``hw-offload`` for path ``ip firewall filter`` (https://github.com/ansible-collections/community.routeros/pull/121).
|
||||
- api_modify, api_info - support fields ``address-list``, ``address-list-timeout``, ``connection-bytes``, ``connection-limit``, ``connection-mark``, ``connection-rate``, ``connection-type``, ``content``, ``disabled``, ``dscp``, ``dst-address-list``, ``dst-address-type``, ``dst-limit``, ``fragment``, ``hotspot``, ``icmp-options``, ``in-bridge-port``, ``in-bridge-port-list``, ``ingress-priority``, ``ipsec-policy``, ``ipv4-options``, ``jump-target``, ``layer7-protocol``, ``limit``, ``log``, ``log-prefix``, ``nth``, ``out-bridge-port``, ``out-bridge-port-list``, ``packet-mark``, ``packet-size``, ``per-connection-classifier``, ``port``, ``priority``, ``psd``, ``random``, ``realm``, ``routing-mark``, ``same-not-by-dst``, ``src-address``, ``src-address-list``, ``src-address-type``, ``src-mac-address``, ``src-port``, ``tcp-mss``, ``time``, ``tls-host``, ``ttl`` in ``ip firewall nat`` path (https://github.com/ansible-collections/community.routeros/pull/133).
|
||||
- api_modify, api_info - support fields ``combo-mode``, ``comment``, ``fec-mode``, ``mdix-enable``, ``poe-out``, ``poe-priority``, ``poe-voltage``, ``power-cycle-interval``, ``power-cycle-ping-address``, ``power-cycle-ping-enabled``, ``power-cycle-ping-timeout`` for path ``interface ethernet`` (https://github.com/ansible-collections/community.routeros/pull/121).
|
||||
- api_modify, api_info - support fields ``jump-target``, ``reject-with`` in ``ip firewall filter`` API path, field ``comment`` in ``ip firwall address-list`` API path, field ``jump-target`` in ``ip firewall mangle`` API path, field ``comment`` in ``ipv6 firewall address-list`` API path, fields ``jump-target``, ``reject-with`` in ``ipv6 firewall filter`` API path (https://github.com/ansible-collections/community.routeros/pull/133).
|
||||
- api_modify, api_info - support for API fields that can be disabled and have default value at the same time, support API paths ``interface gre``, ``interface eoip`` (https://github.com/ansible-collections/community.routeros/pull/128).
|
||||
- api_modify, api_info - support for fields ``blackhole``, ``pref-src``, ``routing-table``, ``suppress-hw-offload``, ``type``, ``vrf-interface`` in ``ip route`` path (https://github.com/ansible-collections/community.routeros/pull/131).
|
||||
- api_modify, api_info - support paths ``system ntp client servers`` and ``system ntp server`` available in ROS7, as well as new fields ``servers``, ``mode``, and ``vrf`` for ``system ntp client`` (https://github.com/ansible-collections/community.routeros/pull/122).
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- api_modify - ``ip route`` entry can be defined without the need of ``gateway`` field, which is correct for unreachable/blackhole type of routes (https://github.com/ansible-collections/community.routeros/pull/131).
|
||||
- api_modify - ``queue interface`` path works now (https://github.com/ansible-collections/community.routeros/pull/131).
|
||||
- api_modify, api_info - removed wrong field ``dynamic`` from API path ``ipv6 firewall address-list`` (https://github.com/ansible-collections/community.routeros/pull/133).
|
||||
- api_modify, api_info - the default of the field ``ingress-filtering`` in ``interface bridge port`` is now ``true``, which is the default in ROS (https://github.com/ansible-collections/community.routeros/pull/125).
|
||||
- command, facts - commands do not timeout in safe mode anymore (https://github.com/ansible-collections/community.routeros/pull/134).
|
||||
|
||||
Known Issues
|
||||
------------
|
||||
|
||||
- api_modify - when limits for entries in ``queue tree`` are defined as human readable - for example ``25M`` -, the configuration will be correctly set in ROS, but the module will indicate the item is changed on every run even when there was no change done. This is caused by the ROS API which returns the number in bytes - for example ``25000000`` (which is inconsistent with the CLI behavior). In order to mitigate that, the limits have to be defined in bytes (those will still appear as human readable in the ROS CLI) (https://github.com/ansible-collections/community.routeros/pull/131).
|
||||
- api_modify, api_info - ``routing ospf area``, ``routing ospf area range``, ``routing ospf instance``, ``routing ospf interface-template`` paths are not fully implemented for ROS6 due to the significant changes between ROS6 and ROS7 (https://github.com/ansible-collections/community.routeros/pull/131).
|
||||
|
||||
v2.3.1
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Maintenance release with improved documentation.
|
||||
|
||||
Known Issues
|
||||
------------
|
||||
|
||||
- The ``community.routeros.command`` module claims to support check mode. Since it cannot judge whether the commands executed modify state or not, this behavior is incorrect. Since this potentially breaks existing playbooks, we will not change this behavior until community.routeros 3.0.0.
|
||||
|
||||
v2.3.0
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Feature and bugfix release.
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
- The collection repository conforms to the `REUSE specification <https://reuse.software/spec/>`__ except for the changelog fragments (https://github.com/ansible-collections/community.routeros/pull/108).
|
||||
- api* modules - added ``timeout`` parameter (https://github.com/ansible-collections/community.routeros/pull/109).
|
||||
- api_modify, api_info - support API path ``ip firewall mangle`` (https://github.com/ansible-collections/community.routeros/pull/110).
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- api_modify, api_info - make API path ``ip dhcp-server`` support ``script``, and ``ip firewall nat`` support ``in-interface`` and ``in-interface-list`` (https://github.com/ansible-collections/community.routeros/pull/110).
|
||||
|
||||
v2.2.1
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Bugfix release.
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- api_modify, api_info - make API path ``ip dhcp-server lease`` support ``server=all`` (https://github.com/ansible-collections/community.routeros/issues/104, https://github.com/ansible-collections/community.routeros/pull/107).
|
||||
- api_modify, api_info - make API path ``ip dhcp-server network`` support missing options ``boot-file-name``, ``dhcp-option-set``, ``dns-none``, ``domain``, and ``next-server`` (https://github.com/ansible-collections/community.routeros/issues/104, https://github.com/ansible-collections/community.routeros/pull/106).
|
||||
|
||||
v2.2.0
|
||||
======
|
||||
|
@ -26,8 +663,8 @@ Bugfixes
|
|||
New Modules
|
||||
-----------
|
||||
|
||||
- api_info - Retrieve information from API
|
||||
- api_modify - Modify data at paths with API
|
||||
- community.routeros.api_info - Retrieve information from API
|
||||
- community.routeros.api_modify - Modify data at paths with API
|
||||
|
||||
v2.1.0
|
||||
======
|
||||
|
@ -55,8 +692,8 @@ Bugfixes
|
|||
New Modules
|
||||
-----------
|
||||
|
||||
- api_facts - Collect facts from remote devices running MikroTik RouterOS using the API
|
||||
- api_find_and_modify - Find and modify information using the API
|
||||
- community.routeros.api_facts - Collect facts from remote devices running MikroTik RouterOS using the API
|
||||
- community.routeros.api_find_and_modify - Find and modify information using the API
|
||||
|
||||
v2.0.0
|
||||
======
|
||||
|
@ -93,11 +730,11 @@ New Plugins
|
|||
Filter
|
||||
~~~~~~
|
||||
|
||||
- join - Join a list of arguments to a command
|
||||
- list_to_dict - Convert a list of arguments to a list of dictionary
|
||||
- quote_argument - Quote an argument
|
||||
- quote_argument_value - Quote an argument value
|
||||
- split - Split a command into arguments
|
||||
- community.routeros.join - Join a list of arguments to a command
|
||||
- community.routeros.list_to_dict - Convert a list of arguments to a list of dictionary
|
||||
- community.routeros.quote_argument - Quote an argument
|
||||
- community.routeros.quote_argument_value - Quote an argument value
|
||||
- community.routeros.split - Split a command into arguments
|
||||
|
||||
v1.2.0
|
||||
======
|
||||
|
@ -155,7 +792,6 @@ Release Summary
|
|||
|
||||
This is the first production (non-prerelease) release of ``community.routeros``.
|
||||
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
|
@ -182,7 +818,6 @@ Release Summary
|
|||
|
||||
The ``community.routeros`` continues the work on the Ansible RouterOS modules from their state in ``community.network`` 1.2.0. The changes listed here are thus relative to the modules ``community.network.routeros_*``.
|
||||
|
||||
|
||||
Minor Changes
|
||||
-------------
|
||||
|
||||
|
|
3
CHANGELOG.rst.license
Normal file
3
CHANGELOG.rst.license
Normal file
|
@ -0,0 +1,3 @@
|
|||
GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
46
README.md
46
README.md
|
@ -5,19 +5,40 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||
-->
|
||||
|
||||
# Community RouterOS Collection
|
||||
[](https://github.com/ansible-collections/community.routeros/actions) [](https://codecov.io/gh/ansible-collections/community.routeros)
|
||||
[](https://docs.ansible.com/ansible/devel/collections/community/routeros/)
|
||||
[](https://github.com/ansible-collections/community.routeros/actions)
|
||||
[](https://codecov.io/gh/ansible-collections/community.routeros)
|
||||
[](https://api.reuse.software/info/github.com/ansible-collections/community.routeros)
|
||||
|
||||
Provides modules for [Ansible](https://www.ansible.com/community) to manage [MikroTik RouterOS](http://www.mikrotik-routeros.net/routeros.aspx) instances.
|
||||
Provides modules for [Ansible](https://www.ansible.com/community) to manage [MikroTik RouterOS](https://mikrotik.com/software) instances.
|
||||
|
||||
You can find [documentation for the modules and plugins in this collection here](https://docs.ansible.com/ansible/devel/collections/community/routeros/).
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
We follow [Ansible Code of Conduct](https://docs.ansible.com/ansible/latest/community/code_of_conduct.html) in all our interactions within this project.
|
||||
|
||||
If you encounter abusive behavior violating the [Ansible Code of Conduct](https://docs.ansible.com/ansible/latest/community/code_of_conduct.html), please refer to the [policy violations](https://docs.ansible.com/ansible/latest/community/code_of_conduct.html#policy-violations) section of the Code of Conduct for information on how to raise a complaint.
|
||||
|
||||
## Communication
|
||||
|
||||
* Join the Ansible forum:
|
||||
* [Get Help](https://forum.ansible.com/c/help/6): get help or help others.Please add appropriate tags if you start new discussions, for example the `routeros` tag.
|
||||
* [Posts tagged with 'routeros'](https://forum.ansible.com/tag/routeros): subscribe to participate in RouterOS related conversations.
|
||||
* [Social Spaces](https://forum.ansible.com/c/chat/4): gather and interact with fellow enthusiasts.
|
||||
* [News & Announcements](https://forum.ansible.com/c/news/5): track project-wide announcements including social events.
|
||||
|
||||
* The Ansible [Bullhorn newsletter](https://docs.ansible.com/ansible/devel/community/communication.html#the-bullhorn): used to announce releases and important changes.
|
||||
|
||||
For more information about communication, see the [Ansible communication guide](https://docs.ansible.com/ansible/devel/community/communication.html).
|
||||
|
||||
## Tested with Ansible
|
||||
|
||||
Tested with the current Ansible 2.9, ansible-base 2.10, ansible-core 2.11, ansible-core 2.12 and ansible-core 2.13 releases and the current development version of ansible-core. Ansible versions before 2.9.10 are not supported.
|
||||
Tested with the current ansible-core 2.15, ansible-core 2.16, ansible-core 2.17, ansible-core 2.18, and ansible-core 2.19 releases and the current development version of ansible-core. Ansible 2.9, ansible-base 2.10, and ansible-core versions before 2.15.0 are not supported.
|
||||
|
||||
## External requirements
|
||||
|
||||
The exact requirements for every module are listed in the module documentation.
|
||||
The exact requirements for every module are listed in the module documentation.
|
||||
|
||||
### Supported connections
|
||||
|
||||
|
@ -27,6 +48,16 @@ The collection supports the `network_cli` connection.
|
|||
|
||||
Please note that `community.routeros.api` module does **not** support Windows jump hosts!
|
||||
|
||||
## Collection Documentation
|
||||
|
||||
Browsing the [**latest** collection documentation](https://docs.ansible.com/ansible/latest/collections/community/routeros) will show docs for the _latest version released in the Ansible package_, not the latest version of the collection released on Galaxy.
|
||||
|
||||
Browsing the [**devel** collection documentation](https://docs.ansible.com/ansible/devel/collections/community/routeros) shows docs for the _latest version released on Galaxy_.
|
||||
|
||||
We also separately publish [**latest commit** collection documentation](https://ansible-collections.github.io/community.routeros/branch/main/) which shows docs for the _latest commit in the `main` branch_.
|
||||
|
||||
If you use the Ansible package and do not update collections independently, use **latest**. If you install or update this collection directly from Galaxy, use **devel**. If you are looking to contribute, use **latest commit**.
|
||||
|
||||
## Included content
|
||||
|
||||
- `community.routeros.api`
|
||||
|
@ -102,7 +133,7 @@ Example playbook:
|
|||
---
|
||||
- name: RouterOS test with API
|
||||
hosts: localhost
|
||||
gather_facts: no
|
||||
gather_facts: false
|
||||
vars:
|
||||
hostname: 192.168.1.1
|
||||
username: admin
|
||||
|
@ -113,6 +144,7 @@ Example playbook:
|
|||
password: "{{ password }}"
|
||||
username: "{{ username }}"
|
||||
tls: true
|
||||
force_no_cert: false
|
||||
validate_certs: true
|
||||
validate_cert_hostname: true
|
||||
ca_path: /path/to/ca-certificate.pem
|
||||
|
@ -152,7 +184,7 @@ See [Ansible's dev guide](https://docs.ansible.com/ansible/devel/dev_guide/devel
|
|||
|
||||
## Release notes
|
||||
|
||||
See the [changelog](https://github.com/ansible-collections/community.routeros/blob/main/CHANGELOG.rst).
|
||||
See the [collection's changelog](https://github.com/ansible-collections/community.routeros/blob/main/CHANGELOG.md).
|
||||
|
||||
## Roadmap
|
||||
|
||||
|
@ -176,4 +208,4 @@ See [LICENSES/GPL-3.0-or-later.txt](https://github.com/ansible-collections/commu
|
|||
|
||||
Parts of the collection are licensed under the [BSD 2-Clause license](https://github.com/ansible-collections/community.routeros/blob/main/LICENSES/BSD-2-Clause.txt).
|
||||
|
||||
Most files in the collection that are not automatically generated have a machine readable `SDPX-License-Identifier:` comment denoting its respective license(s).
|
||||
All files have a machine readable `SDPX-License-Identifier:` comment denoting its respective license(s) or an equivalent entry in an accompanying `.license` file. Only changelog fragments (which will not be part of a release) are covered by a blanket statement in `REUSE.toml`. This conforms to the [REUSE specification](https://reuse.software/spec/).
|
||||
|
|
11
REUSE.toml
Normal file
11
REUSE.toml
Normal file
|
@ -0,0 +1,11 @@
|
|||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
version = 1
|
||||
|
||||
[[annotations]]
|
||||
path = "changelogs/fragments/**"
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "Ansible Project"
|
||||
SPDX-License-Identifier = "GPL-3.0-or-later"
|
97
antsibull-nox.toml
Normal file
97
antsibull-nox.toml
Normal file
|
@ -0,0 +1,97 @@
|
|||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
[collection_sources]
|
||||
"community.internal_test_tools" = "git+https://github.com/ansible-collections/community.internal_test_tools.git,main"
|
||||
"community.netcommon" = "git+https://github.com/ansible-collections/ansible.netcommon.git,main"
|
||||
"community.utils" = "git+https://github.com/ansible-collections/ansible.utils.git,main"
|
||||
|
||||
[sessions]
|
||||
|
||||
[sessions.lint]
|
||||
run_isort = false
|
||||
run_black = false
|
||||
run_flake8 = false
|
||||
run_pylint = false
|
||||
run_yamllint = true
|
||||
yamllint_config = ".yamllint"
|
||||
yamllint_config_plugins = ".yamllint-docs"
|
||||
yamllint_config_plugins_examples = ".yamllint-examples"
|
||||
yamllint_config_extra_docs = ".yamllint-extra-docs"
|
||||
run_mypy = false
|
||||
|
||||
[sessions.docs_check]
|
||||
validate_collection_refs="all"
|
||||
codeblocks_restrict_types = [
|
||||
"ansible-output",
|
||||
"ini",
|
||||
"yaml",
|
||||
"yaml+jinja",
|
||||
]
|
||||
codeblocks_restrict_type_exact_case = true
|
||||
codeblocks_allow_without_type = false
|
||||
codeblocks_allow_literal_blocks = false
|
||||
|
||||
[sessions.license_check]
|
||||
|
||||
[sessions.extra_checks]
|
||||
run_no_unwanted_files = true
|
||||
no_unwanted_files_module_extensions = [".py"]
|
||||
no_unwanted_files_yaml_extensions = [".yml"]
|
||||
run_action_groups = true
|
||||
run_no_trailing_whitespace = true
|
||||
no_trailing_whitespace_skip_directories = [
|
||||
"tests/unit/plugins/modules/fixtures/",
|
||||
]
|
||||
run_avoid_characters = true
|
||||
|
||||
[[sessions.extra_checks.action_groups_config]]
|
||||
name = "api"
|
||||
pattern = "^api.*$"
|
||||
exclusions = []
|
||||
doc_fragment = "community.routeros.attributes.actiongroup_api"
|
||||
|
||||
[[sessions.extra_checks.avoid_character_group]]
|
||||
name = "tab"
|
||||
regex = "\\x09"
|
||||
|
||||
[sessions.build_import_check]
|
||||
run_galaxy_importer = true
|
||||
|
||||
[sessions.ansible_test_sanity]
|
||||
include_devel = true
|
||||
|
||||
[sessions.ansible_test_units]
|
||||
include_devel = true
|
||||
|
||||
[sessions.ansible_test_integration_w_default_container]
|
||||
include_devel = true
|
||||
controller_python_versions_only = true
|
||||
|
||||
[sessions.ansible_test_integration_w_default_container.core_python_versions]
|
||||
"2.15" = ["2.7", "3.6", "3.7"]
|
||||
"2.16" = ["3.10"]
|
||||
"2.17" = ["3.8"]
|
||||
"2.18" = ["3.9"]
|
||||
"2.19" = ["3.11"]
|
||||
|
||||
[[sessions.ee_check.execution_environments]]
|
||||
name = "devel-ubi-9"
|
||||
description = "ansible-core devel @ RHEL UBI 9"
|
||||
test_playbooks = ["tests/ee/all.yml"]
|
||||
config.images.base_image.name = "docker.io/redhat/ubi9:latest"
|
||||
config.dependencies.ansible_core.package_pip = "https://github.com/ansible/ansible/archive/devel.tar.gz"
|
||||
config.dependencies.ansible_runner.package_pip = "ansible-runner"
|
||||
config.dependencies.python_interpreter.package_system = "python3.12 python3.12-pip python3.12-wheel python3.12-cryptography"
|
||||
config.dependencies.python_interpreter.python_path = "/usr/bin/python3.12"
|
||||
runtime_environment = {"ANSIBLE_PRIVATE_ROLE_VARS" = "true"}
|
||||
|
||||
[[sessions.ee_check.execution_environments]]
|
||||
name = "2.15-rocky-9"
|
||||
description = "ansible-core 2.15 @ Rocky Linux 9"
|
||||
test_playbooks = ["tests/ee/all.yml"]
|
||||
config.images.base_image.name = "quay.io/rockylinux/rockylinux:9"
|
||||
config.dependencies.ansible_core.package_pip = "https://github.com/ansible/ansible/archive/stable-2.15.tar.gz"
|
||||
config.dependencies.ansible_runner.package_pip = "ansible-runner"
|
||||
runtime_environment = {"ANSIBLE_PRIVATE_ROLE_VARS" = "true"}
|
File diff suppressed because it is too large
Load diff
3
changelogs/changelog.yaml.license
Normal file
3
changelogs/changelog.yaml.license
Normal file
|
@ -0,0 +1,3 @@
|
|||
GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
|
@ -7,28 +7,37 @@ changelog_filename_template: ../CHANGELOG.rst
|
|||
changelog_filename_version_depth: 0
|
||||
changes_file: changelog.yaml
|
||||
changes_format: combined
|
||||
ignore_other_fragment_extensions: true
|
||||
keep_fragments: false
|
||||
mention_ancestor: true
|
||||
flatmap: true
|
||||
new_plugins_after_name: removed_features
|
||||
notesdir: fragments
|
||||
output_formats:
|
||||
- rst
|
||||
- md
|
||||
prelude_section_name: release_summary
|
||||
prelude_section_title: Release Summary
|
||||
sections:
|
||||
- - major_changes
|
||||
- Major Changes
|
||||
- - minor_changes
|
||||
- Minor Changes
|
||||
- - breaking_changes
|
||||
- Breaking Changes / Porting Guide
|
||||
- - deprecated_features
|
||||
- Deprecated Features
|
||||
- - removed_features
|
||||
- Removed Features (previously deprecated)
|
||||
- - security_fixes
|
||||
- Security Fixes
|
||||
- - bugfixes
|
||||
- Bugfixes
|
||||
- - known_issues
|
||||
- Known Issues
|
||||
- - major_changes
|
||||
- Major Changes
|
||||
- - minor_changes
|
||||
- Minor Changes
|
||||
- - breaking_changes
|
||||
- Breaking Changes / Porting Guide
|
||||
- - deprecated_features
|
||||
- Deprecated Features
|
||||
- - removed_features
|
||||
- Removed Features (previously deprecated)
|
||||
- - security_fixes
|
||||
- Security Fixes
|
||||
- - bugfixes
|
||||
- Bugfixes
|
||||
- - known_issues
|
||||
- Known Issues
|
||||
title: Community RouterOS
|
||||
trivial_section_name: trivial
|
||||
use_fqcn: true
|
||||
add_plugin_period: true
|
||||
changelog_nice_yaml: true
|
||||
changelog_sort: version
|
||||
vcs: auto
|
||||
|
|
12
changelogs/fragments/391-report-unknown-interfaces.yml
Normal file
12
changelogs/fragments/391-report-unknown-interfaces.yml
Normal file
|
@ -0,0 +1,12 @@
|
|||
---
|
||||
bugfixes:
|
||||
- |
|
||||
api_facts - also report interfaces that are inferred only by reference by IP addresses.
|
||||
RouterOS's APIs have IPv4 and IPv6 addresses point at interfaces by their name, which can
|
||||
change over time and in-between API calls, such that interfaces may have been enumerated
|
||||
under another name, or not at all (for example when removed). Such interfaces are now reported
|
||||
under their new or temporary name and with a synthetic ``type`` property set to differentiate
|
||||
the more likely and positively confirmed removal case (with ``type: "ansible:unknown"``) from
|
||||
the unlikely and probably transient naming mismatch (with ``type: "ansible:mismatch"``).
|
||||
Previously, the api_facts module would have crashed with a ``KeyError`` exception
|
||||
(https://github.com/ansible-collections/community.routeros/pull/391).
|
2
changelogs/fragments/392-sys-note-cli-login.yml
Normal file
2
changelogs/fragments/392-sys-note-cli-login.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
minor_changes:
|
||||
- api_info, api_modify - add ``show-at-cli-login`` property in ``system note`` (https://github.com/ansible-collections/community.routeros/pull/392).
|
2
changelogs/fragments/394-iface-list-defaults.yml
Normal file
2
changelogs/fragments/394-iface-list-defaults.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
minor_changes:
|
||||
- api_info, api_modify - set default value for ``include`` and ``exclude`` properties in ``system note`` to an empty string (https://github.com/ansible-collections/community.routeros/pull/394).
|
7
docs/docsite/config.yml
Normal file
7
docs/docsite/config.yml
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
changelog:
|
||||
write_changelog: true
|
|
@ -9,6 +9,8 @@ edit_on_github:
|
|||
path_prefix: ''
|
||||
|
||||
extra_links:
|
||||
- description: Ask for help (RouterOS)
|
||||
url: https://forum.ansible.com/tags/c/help/6/none/routeros
|
||||
- description: Submit a bug report
|
||||
url: https://github.com/ansible-collections/community.routeros/issues/new?assignees=&labels=&template=bug_report.md
|
||||
- description: Request a feature
|
||||
|
@ -22,6 +24,10 @@ communication:
|
|||
- topic: General usage and support questions
|
||||
network: Libera
|
||||
channel: '#ansible'
|
||||
mailing_lists:
|
||||
- topic: Ansible Project List
|
||||
url: https://groups.google.com/g/ansible-project
|
||||
forums:
|
||||
- topic: "Ansible Forum: General usage and support questions"
|
||||
# The following URL directly points to the "Get Help" section
|
||||
url: https://forum.ansible.com/c/help/6/none
|
||||
- topic: "Ansible Forum: Discussions about RouterOS"
|
||||
# The following URL directly points to the "routeros" tag
|
||||
url: https://forum.ansible.com/tag/routeros
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
How to connect to RouterOS devices with the RouterOS API
|
||||
========================================================
|
||||
|
||||
You can use the :ref:`community.routeros.api module <ansible_collections.community.routeros.api_module>` to connect to a RouterOS device with the RouterOS API. More specific module to modify certain entries are the :ref:`community.routeros.api_modify <ansible_collections.community.routeros.api_modify_module>` and :ref:`community.routeros.api_find_and_modify <ansible_collections.community.routeros.api_find_and_modify_module>` modules. The :ref:`community.routeros.api_info module <ansible_collections.community.routeros.api_info_module>` allows to retrieve information on specific predefined paths that can be used as input for the ``community.routeros.api_modify`` module, and the :ref:`community.routeros.api_facts module <ansible_collections.community.routeros.api_facts_module>` allows to retrieve Ansible facts using the RouterOS API.
|
||||
You can use the :ansplugin:`community.routeros.api module <community.routeros.api#module>` to connect to a RouterOS device with the RouterOS API. More specific module to modify certain entries are the :ansplugin:`community.routeros.api_modify <community.routeros.api_modify#module>` and :ansplugin:`community.routeros.api_find_and_modify <community.routeros.api_find_and_modify#module>` modules. The :ansplugin:`community.routeros.api_info module <community.routeros.api_info#module>` allows to retrieve information on specific predefined paths that can be used as input for the :ansplugin:`community.routeros.api_modify <community.routeros.api_modify#module>` module, and the :ansplugin:`community.routeros.api_facts module <community.routeros.api_facts#module>` allows to retrieve Ansible facts using the RouterOS API.
|
||||
|
||||
No special setup is needed; the module needs to be run on a host that can connect to the device's API. The most common case is that the module is run on ``localhost``, either by using ``hosts: localhost`` in the playbook, or by using ``delegate_to: localhost`` for the task. The following example shows how to run the equivalent of ``/ip address print``:
|
||||
|
||||
|
@ -17,7 +17,7 @@ No special setup is needed; the module needs to be run on a host that can connec
|
|||
---
|
||||
- name: RouterOS test with API
|
||||
hosts: localhost
|
||||
gather_facts: no
|
||||
gather_facts: false
|
||||
vars:
|
||||
hostname: 192.168.1.1
|
||||
username: admin
|
||||
|
@ -57,23 +57,23 @@ This results in the following output:
|
|||
}
|
||||
|
||||
PLAY RECAP *******************************************************************************************************
|
||||
localhost : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
|
||||
localhost : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
|
||||
|
||||
Check out the documenation of the :ref:`community.routeros.api module <ansible_collections.community.routeros.api_module>` for details on the options.
|
||||
Check out the documentation of the :ansplugin:`community.routeros.api module <community.routeros.api#module>` for details on the options.
|
||||
|
||||
Using the ``community.routeros.api`` module defaults group
|
||||
----------------------------------------------------------
|
||||
|
||||
To avoid having to specify common parameters for all the API based modules in every task, you can use the ``community.routeros.api`` module defaults group:
|
||||
To avoid having to specify common parameters for all the API based modules in every task, you can use the ``community.routeros.api`` :ref:`module defaults group <module_defaults_groups>`:
|
||||
|
||||
.. code-block:: yaml+jinja
|
||||
|
||||
---
|
||||
- name: RouterOS test with API
|
||||
hosts: localhost
|
||||
gather_facts: no
|
||||
gather_facts: false
|
||||
module_defaults:
|
||||
group/community.routeros.api
|
||||
group/community.routeros.api:
|
||||
hostname: 192.168.1.1
|
||||
password: admin
|
||||
username: test1234
|
||||
|
@ -85,7 +85,7 @@ To avoid having to specify common parameters for all the API based modules in ev
|
|||
# If you are using your own PKI, specify the path to your CA certificate here:
|
||||
# ca_path: /path/to/ca-certificate.pem
|
||||
tasks:
|
||||
- name: Gather facts"
|
||||
- name: Gather facts
|
||||
community.routeros.api_facts:
|
||||
|
||||
- name: Get "ip address print"
|
||||
|
@ -105,11 +105,12 @@ Here all three tasks will use the options set for the module defaults group.
|
|||
Setting up encryption
|
||||
---------------------
|
||||
|
||||
It is recommended to always use ``tls: true`` when connecting with the API, even if you are only connecting to the device through a trusted network. The following options control how TLS/SSL is used:
|
||||
It is recommended to always use :ansopt:`tls=true` when connecting with the API, even if you are only connecting to the device through a trusted network. The following options control how TLS/SSL is used:
|
||||
|
||||
:validate_certs: Setting to ``false`` disables any certificate validation. **This is discouraged to use in production**, but is needed when setting the device up. The default value is ``true``.
|
||||
:validate_cert_hostname: Setting to ``false`` (default) disables hostname verification during certificate validation. This is needed if the hostnames specified in the certificate do not match the hostname used for connecting (usually the device's IP). It is recommended to set up the certificate correctly and set this to ``true``; the default ``false`` is chosen for backwards compatibility to an older version of the module.
|
||||
:ca_path: If you are not using a commerically trusted CA certificate to sign your device's certificate, or have not included your CA certificate in Python's truststore, you need to point this option to the CA certificate.
|
||||
:force_no_cert: Setting to :ansval:`true` connects to the device without a certificate. **This is discouraged to use in production and is susceptible to Man-in-the-Middle attacks**, but might be useful when setting the device up. The default value is :ansval:`false`.
|
||||
:validate_certs: Setting to :ansval:`false` disables any certificate validation. **This is discouraged to use in production**, but is needed when setting the device up. The default value is :ansval:`true`.
|
||||
:validate_cert_hostname: Setting to :ansval:`false` (default) disables hostname verification during certificate validation. This is needed if the hostnames specified in the certificate do not match the hostname used for connecting (usually the device's IP). It is recommended to set up the certificate correctly and set this to :ansval:`true`; the default :ansval:`false` is chosen for backwards compatibility to an older version of the module.
|
||||
:ca_path: If you are not using a commercially trusted CA certificate to sign your device's certificate, or have not included your CA certificate in Python's truststore, you need to point this option to the CA certificate.
|
||||
|
||||
We recommend to create a CA certificate that is used to sign the certificates for your RouterOS devices, and have the certificates include the correct hostname(s), including the IP of the device. That way, you can fully enable TLS and be sure that you always talk to the correct device.
|
||||
|
||||
|
@ -123,7 +124,7 @@ Installing a certificate on a MikroTik router
|
|||
|
||||
Installing the certificate is best done with the SSH connection. (See the :ref:`ansible_collections.community.routeros.docsite.ssh-guide` guide for more information.) Once the certificate has been installed, and the HTTPS API enabled, it's easier to work with the API, since it has a quite a few less problems, and returns data as JSON objects instead of text you first have to parse.
|
||||
|
||||
First you have to convert the certificate and its private key to a `PKCS #12 bundle <https://en.wikipedia.org/wiki/PKCS_12>`_. This can be done with the :ref:`community.crypto.openssl_pkcs12 <ansible_collections.community.crypto.openssl_pkcs12_module>`. The following playbook assumes that the certificate is available as ``keys/{{ inventory_hostname }}.pem``, and its private key is available as ``keys/{{ inventory_hostname }}.key``. It generates a random passphrase to protect the PKCS#12 file.
|
||||
First you have to convert the certificate and its private key to a `PKCS #12 bundle <https://en.wikipedia.org/wiki/PKCS_12>`_. This can be done with the :ansplugin:`community.crypto.openssl_pkcs12 <community.crypto.openssl_pkcs12#module>`. The following playbook assumes that the certificate is available as ``keys/{{ inventory_hostname }}.pem``, and its private key is available as ``keys/{{ inventory_hostname }}.key``. It generates a random passphrase to protect the PKCS#12 file.
|
||||
|
||||
.. code-block:: yaml+jinja
|
||||
|
||||
|
@ -185,12 +186,12 @@ First you have to convert the certificate and its private key to a `PKCS #12 bun
|
|||
|
||||
The playbook also assumes that ``admin_network`` describes the network from which the HTTPS and API interface can be accessed. This can be for example ``192.168.1.0/24``.
|
||||
|
||||
When this playbook completed successfully, you should be able to use the HTTPS admin interface (reachable in a browser from ``https://192.168.1.1/``, with the correct IP inserted), as well as the :ref:`community.routeros.api module <ansible_collections.community.routeros.api_module>` module with TLS and certificate validation enabled:
|
||||
When this playbook completed successfully, you should be able to use the HTTPS admin interface (reachable in a browser from ``https://192.168.1.1/``, with the correct IP inserted), as well as the :ansplugin:`community.routeros.api module <community.routeros.api#module>` module with TLS and certificate validation enabled:
|
||||
|
||||
.. code-block:: yaml+jinja
|
||||
|
||||
- community.routeros.api:
|
||||
...
|
||||
# ...
|
||||
tls: true
|
||||
validate_certs: true
|
||||
validate_cert_hostname: true
|
||||
|
|
|
@ -8,12 +8,12 @@
|
|||
How to quote and unquote commands and arguments
|
||||
===============================================
|
||||
|
||||
When using the :ref:`community.routeros.command module <ansible_collections.community.routeros.command_module>` or the :ref:`community.routeros.api module <ansible_collections.community.routeros.api_module>` modules, you need to pass text data in quoted form. While in some cases quoting is not needed (when passing IP addresses or names without spaces, for example), in other cases it is required, like when passing a comment which contains a space.
|
||||
When using the :ansplugin:`community.routeros.command module <community.routeros.command#module>` or the :ansplugin:`community.routeros.api module <community.routeros.api#module>` modules, you need to pass text data in quoted form. While in some cases quoting is not needed (when passing IP addresses or names without spaces, for example), in other cases it is required, like when passing a comment which contains a space.
|
||||
|
||||
The community.routeros collection provides a set of Jinja2 filter plugins which helps you with these tasks:
|
||||
|
||||
- The ``community.routeros.quote_argument_value`` filter quotes an argument value: ``'this is a "comment"' | community.routeros.quote_argument_value == '"this is a \\"comment\\""'``.
|
||||
- The ``community.routeros.quote_argument`` filter quotes an argument with or without a value: ``'comment=this is a "comment"' | community.routeros.quote_argument == 'comment="this is a \\"comment\\""'``.
|
||||
- The ``community.routeros.join`` filter quotes a list of arguments and joins them to one string: ``['foo=bar', 'comment=foo is bar'] | community.routeros.join == 'foo=bar comment="foo is bar"'``.
|
||||
- The ``community.routeros.split`` filter splits a command into a list of arguments (with or without values): ``'foo=bar comment="foo is bar"' | community.routeros.split == ['foo=bar', 'comment=foo is bar']``
|
||||
- The ``community.routeros.list_to_dict`` filter splits a list of arguments with values into a dictionary: ``['foo=bar', 'comment=foo is bar'] | community.routeros.list_to_dict == {'foo': 'bar', 'comment': 'foo is bar'}``. It has two optional arguments: ``require_assignment`` (default value ``true``) allows to accept arguments without values when set to ``false``; and ``skip_empty_values`` (default value ``false``) allows to skip arguments whose value is empty.
|
||||
- The :ansplugin:`community.routeros.quote_argument_value filter <community.routeros.quote_argument_value#filter>` quotes an argument value: ``'this is a "comment"' | community.routeros.quote_argument_value == '"this is a \\"comment\\""'``.
|
||||
- The :ansplugin:`community.routeros.quote_argument filter <community.routeros.quote_argument#filter>` quotes an argument with or without a value: ``'comment=this is a "comment"' | community.routeros.quote_argument == 'comment="this is a \\"comment\\""'``.
|
||||
- The :ansplugin:`community.routeros.join filter <community.routeros.join#filter>` quotes a list of arguments and joins them to one string: ``['foo=bar', 'comment=foo is bar'] | community.routeros.join == 'foo=bar comment="foo is bar"'``.
|
||||
- The :ansplugin:`community.routeros.split filter <community.routeros.split#filter>` splits a command into a list of arguments (with or without values): ``'foo=bar comment="foo is bar"' | community.routeros.split == ['foo=bar', 'comment=foo is bar']``
|
||||
- The :ansplugin:`community.routeros.list_to_dict filter <community.routeros.list_to_dict#filter>` splits a list of arguments with values into a dictionary: ``['foo=bar', 'comment=foo is bar'] | community.routeros.list_to_dict == {'foo': 'bar', 'comment': 'foo is bar'}``. It has two optional arguments: :ansopt:`community.routeros.list_to_dict#filter:require_assignment` (default value :ansval:`true`) allows to accept arguments without values when set to :ansval:`false`; and :ansopt:`community.routeros.list_to_dict#filter:skip_empty_values` (default value :ansval:`false`) allows to skip arguments whose value is empty.
|
||||
|
|
|
@ -10,17 +10,17 @@ How to connect to RouterOS devices with SSH
|
|||
|
||||
The collection offers two modules to connect to RouterOS devies with SSH:
|
||||
|
||||
- The :ref:`community.routeros.facts module <ansible_collections.community.routeros.facts_module>` gathers facts about a RouterOS device;
|
||||
- The :ref:`community.routeros.command module <ansible_collections.community.routeros.command_module>` executes commands on a RouterOS device.
|
||||
- The :ansplugin:`community.routeros.facts module <community.routeros.facts#module>` gathers facts about a RouterOS device;
|
||||
- The :ansplugin:`community.routeros.command module <community.routeros.command#module>` executes commands on a RouterOS device.
|
||||
|
||||
The modules need the :ref:`ansible.netcommon.network_cli connection plugin <ansible_collections.ansible.netcommon.network_cli_connection>` for this.
|
||||
The modules need the :ansplugin:`ansible.netcommon.network_cli connection plugin <ansible.netcommon.network_cli#connection>` for this.
|
||||
|
||||
Important notes
|
||||
---------------
|
||||
|
||||
1. The SSH-based modules do not support arbitrary symbols in the router's identity. If you are having trouble connecting to your device, please make sure that your MikroTik's identity contains only alphanumeric characters and dashes. Also make sure that the identity string is not longer than 19 characters (`see issue for details <https://github.com/ansible-collections/community.routeros/issues/31>`__). Similar problems can happen for unsupported characters in your username.
|
||||
|
||||
2. The :ref:`community.routeros.command module <ansible_collections.community.routeros.command_module>` does not support nesting commands and expects every command to start with a forward slash (``/``). Running the following command will produce an error:
|
||||
2. The :ansplugin:`community.routeros.command module <community.routeros.command#module>` does not support nesting commands and expects every command to start with a forward slash (``/``). Running the following command will produce an error:
|
||||
|
||||
.. code-block:: yaml+jinja
|
||||
|
||||
|
@ -29,9 +29,11 @@ Important notes
|
|||
- /ip
|
||||
- print
|
||||
|
||||
3. When using the :ref:`community.routeros.command module <ansible_collections.community.routeros.command_module>` module, make sure to not specify too long commands. Alternatively, add something like ``+cet512w`` to the username (replace ``admin`` with ``admin+cet512w``) to tell RouterOS to not wrap before 512 characters in a line (`see issue for details <https://github.com/ansible-collections/community.routeros/issues/6>`__).
|
||||
3. When using the :ansplugin:`community.routeros.command module <community.routeros.command#module>` module, make sure to not specify too long commands. Alternatively, add something like ``+cet512w`` to the username (replace ``admin`` with ``admin+cet512w``) to tell RouterOS to not wrap before 512 characters in a line (`see issue for details <https://github.com/ansible-collections/community.routeros/issues/6>`__).
|
||||
|
||||
4. Finally, the :ref:`ansible.netcommon.network_cli connection plugin <ansible_collections.ansible.netcommon.network_cli_connection>` uses `paramiko <https://pypi.org/project/paramiko/>`_ by default to connect to devices with SSH. You can set its ``ssh_type`` option to ``libssh`` to use `ansible-pylibssh <https://pypi.org/project/ansible-pylibssh/>`_ instead, which offers Python bindings to libssh. See its documentation for details.
|
||||
4. The :ansplugin:`ansible.netcommon.network_cli connection plugin <ansible.netcommon.network_cli#connection>` uses `paramiko <https://pypi.org/project/paramiko/>`_ by default to connect to devices with SSH. You can set its :ansopt:`ansible.netcommon.network_cli#connection:ssh_type` option to :ansval:`libssh` to use `ansible-pylibssh <https://pypi.org/project/ansible-pylibssh/>`_ instead, which offers Python bindings to libssh. See its documentation for details.
|
||||
|
||||
5. User is **not allowed** to login via SSH by password to modern Mikrotik if SSH key for the user is added!
|
||||
|
||||
Setting up an inventory
|
||||
-----------------------
|
||||
|
@ -49,7 +51,7 @@ An example inventory ``hosts`` file for a RouterOS device is as follows:
|
|||
ansible_user=admin
|
||||
ansible_ssh_pass=test1234
|
||||
|
||||
This tells Ansible that you have a RouterOS device called ``router`` with IP ``192.168.2.1``. Ansible should use the :ref:`ansible.netcommon.network_cli connection plugin <ansible_collections.ansible.netcommon.network_cli_connection>` together with the the :ref:`community.routeros.routeros cliconf plugin <ansible_collections.community.routeros.routeros_cliconf>`. The credentials are stored as ``ansible_user`` and ``ansible_ssh_pass`` in the inventory.
|
||||
This tells Ansible that you have a RouterOS device called ``router`` with IP ``192.168.2.1``. Ansible should use the :ansplugin:`ansible.netcommon.network_cli connection plugin <ansible.netcommon.network_cli#connection>` together with the the :ansplugin:`community.routeros.routeros cliconf plugin <community.routeros.routeros#cliconf>`. The credentials are stored as ``ansible_user`` and ``ansible_ssh_pass`` in the inventory.
|
||||
|
||||
Connecting to the device
|
||||
------------------------
|
||||
|
@ -64,22 +66,22 @@ With the above inventory, you can use the following playbook to execute ``/syste
|
|||
gather_facts: false
|
||||
tasks:
|
||||
|
||||
- name: Gather system resources
|
||||
community.routeros.command:
|
||||
commands:
|
||||
- /system resource print
|
||||
register: system_resource_print
|
||||
- name: Gather system resources
|
||||
community.routeros.command:
|
||||
commands:
|
||||
- /system resource print
|
||||
register: system_resource_print
|
||||
|
||||
- name: Show system resources
|
||||
debug:
|
||||
var: system_resource_print.stdout_lines
|
||||
- name: Show system resources
|
||||
debug:
|
||||
var: system_resource_print.stdout_lines
|
||||
|
||||
- name: Gather facts
|
||||
community.routeros.facts:
|
||||
- name: Gather facts
|
||||
community.routeros.facts:
|
||||
|
||||
- name: Show a fact
|
||||
debug:
|
||||
msg: "First IP address: {{ ansible_net_all_ipv4_addresses[0] }}"
|
||||
- name: Show a fact
|
||||
debug:
|
||||
msg: "First IP address: {{ ansible_net_all_ipv4_addresses[0] }}"
|
||||
|
||||
This results in the following output:
|
||||
|
||||
|
@ -124,4 +126,4 @@ This results in the following output:
|
|||
}
|
||||
|
||||
PLAY RECAP *******************************************************************************************************
|
||||
router : ok=4 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
|
||||
router : ok=4 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
|
||||
|
|
|
@ -7,16 +7,16 @@
|
|||
|
||||
namespace: community
|
||||
name: routeros
|
||||
version: 2.2.0
|
||||
version: 3.9.0
|
||||
readme: README.md
|
||||
authors:
|
||||
- Egor Zaitsev (github.com/heuels)
|
||||
- Nikolay Dachev (github.com/NikolayDachev)
|
||||
- Felix Fontein (github.com/felixfontein)
|
||||
description: Modules for MikroTik RouterOS
|
||||
description: Modules and plugins for MikroTik RouterOS
|
||||
license:
|
||||
- GPL-3.0-or-later
|
||||
#license_file: COPYING
|
||||
# license_file: COPYING
|
||||
tags:
|
||||
- network
|
||||
- mikrotik
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
requires_ansible: '>=2.9.10'
|
||||
requires_ansible: '>=2.15.0'
|
||||
action_groups:
|
||||
api:
|
||||
- api
|
||||
- api_facts
|
||||
- api_find_and_modify
|
||||
- api_info
|
||||
- api_modify
|
||||
- api
|
||||
- api_facts
|
||||
- api_find_and_modify
|
||||
- api_info
|
||||
- api_modify
|
||||
|
|
53
noxfile.py
Normal file
53
noxfile.py
Normal file
|
@ -0,0 +1,53 @@
|
|||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
# The following metadata allows Python runners and nox to install the required
|
||||
# dependencies for running this Python script:
|
||||
#
|
||||
# /// script
|
||||
# dependencies = ["nox>=2025.02.09", "antsibull-nox"]
|
||||
# ///
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
import nox
|
||||
|
||||
|
||||
# We try to import antsibull-nox, and if that doesn't work, provide a more useful
|
||||
# error message to the user.
|
||||
try:
|
||||
import antsibull_nox
|
||||
except ImportError:
|
||||
print("You need to install antsibull-nox in the same Python environment as nox.")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
IN_CI = os.environ.get("CI") == "true"
|
||||
|
||||
|
||||
antsibull_nox.load_antsibull_nox_toml()
|
||||
|
||||
|
||||
@nox.session(name="update-docs", default=True)
|
||||
def update_docs_fragments(session: nox.Session) -> None:
|
||||
"""
|
||||
Update/check auto-generated parts of docs fragments.
|
||||
"""
|
||||
session.install("ansible-core")
|
||||
prepare = antsibull_nox.sessions.prepare_collections(
|
||||
session, install_in_site_packages=True
|
||||
)
|
||||
if not prepare:
|
||||
return
|
||||
data = ["python", "tests/update-docs.py"]
|
||||
if IN_CI:
|
||||
data.append("--lint")
|
||||
session.run(*data)
|
||||
|
||||
|
||||
# Allow to run the noxfile with `python noxfile.py`, `pipx run noxfile.py`, or similar.
|
||||
# Requires nox >= 2025.02.09
|
||||
if __name__ == "__main__":
|
||||
nox.main()
|
|
@ -5,24 +5,20 @@
|
|||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
DOCUMENTATION = r"""
|
||||
author: "Egor Zaitsev (@heuels)"
|
||||
name: routeros
|
||||
short_description: Use routeros cliconf to run command on MikroTik RouterOS platform
|
||||
description:
|
||||
- This routeros plugin provides low level abstraction apis for
|
||||
sending and receiving CLI commands from MikroTik RouterOS network devices.
|
||||
'''
|
||||
- This routeros plugin provides low level abstraction APIs for sending and receiving CLI commands from MikroTik RouterOS
|
||||
network devices.
|
||||
"""
|
||||
|
||||
import re
|
||||
import json
|
||||
|
||||
from itertools import chain
|
||||
|
||||
from ansible.module_utils.common.text.converters import to_bytes, to_text
|
||||
from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import to_list
|
||||
from ansible.plugins.cliconf import CliconfBase, enable_mode
|
||||
from ansible.module_utils.common.text.converters import to_text
|
||||
from ansible.plugins.cliconf import CliconfBase
|
||||
|
||||
|
||||
class Cliconf(CliconfBase):
|
||||
|
|
|
@ -10,7 +10,7 @@ __metaclass__ = type
|
|||
|
||||
class ModuleDocFragment(object):
|
||||
|
||||
DOCUMENTATION = r'''
|
||||
DOCUMENTATION = r"""
|
||||
options:
|
||||
hostname:
|
||||
description:
|
||||
|
@ -27,6 +27,12 @@ options:
|
|||
- RouterOS user password.
|
||||
required: true
|
||||
type: str
|
||||
timeout:
|
||||
description:
|
||||
- Timeout for the request.
|
||||
type: int
|
||||
default: 10
|
||||
version_added: 2.3.0
|
||||
tls:
|
||||
description:
|
||||
- If is set TLS will be used for RouterOS API connection.
|
||||
|
@ -37,37 +43,46 @@ options:
|
|||
- ssl
|
||||
port:
|
||||
description:
|
||||
- RouterOS api port. If I(tls) is set, port will apply to TLS/SSL connection.
|
||||
- Defaults are C(8728) for the HTTP API, and C(8729) for the HTTPS API.
|
||||
- RouterOS API port. If O(tls) is set, port will apply to TLS/SSL connection.
|
||||
- Defaults are V(8728) for the HTTP API, and V(8729) for the HTTPS API.
|
||||
type: int
|
||||
force_no_cert:
|
||||
description:
|
||||
- Set to V(true) to connect without a certificate when O(tls=true).
|
||||
- See also O(validate_certs).
|
||||
- B(Note:) this forces the use of anonymous Diffie-Hellman (ADH) ciphers. The protocol is susceptible to Man-in-the-Middle
|
||||
attacks, because the keys used in the exchange are not authenticated. Instead of simply connecting without a certificate
|
||||
to "make things work" have a look at O(validate_certs) and O(ca_path).
|
||||
type: bool
|
||||
default: false
|
||||
version_added: 2.4.0
|
||||
validate_certs:
|
||||
description:
|
||||
- Set to C(false) to skip validation of TLS certificates.
|
||||
- See also I(validate_cert_hostname). Only used when I(tls=true).
|
||||
- B(Note:) instead of simply deactivating certificate validations to "make things work",
|
||||
please consider creating your own CA certificate and using it to sign certificates used
|
||||
for your router. You can tell the module about your CA certificate with the I(ca_path)
|
||||
option.
|
||||
- Set to V(false) to skip validation of TLS certificates.
|
||||
- See also O(validate_cert_hostname). Only used when O(tls=true).
|
||||
- B(Note:) instead of simply deactivating certificate validations to "make things work", please consider creating your
|
||||
own CA certificate and using it to sign certificates used for your router. You can tell the module about your CA certificate
|
||||
with the O(ca_path) option.
|
||||
type: bool
|
||||
default: true
|
||||
version_added: 1.2.0
|
||||
validate_cert_hostname:
|
||||
description:
|
||||
- Set to C(true) to validate hostnames in certificates.
|
||||
- See also I(validate_certs). Only used when I(tls=true) and I(validate_certs=true).
|
||||
- Set to V(true) to validate hostnames in certificates.
|
||||
- See also O(validate_certs). Only used when O(tls=true) and O(validate_certs=true).
|
||||
type: bool
|
||||
default: false
|
||||
version_added: 1.2.0
|
||||
ca_path:
|
||||
description:
|
||||
- PEM formatted file that contains a CA certificate to be used for certificate validation.
|
||||
- See also I(validate_cert_hostname). Only used when I(tls=true) and I(validate_certs=true).
|
||||
- See also O(validate_cert_hostname). Only used when O(tls=true) and O(validate_certs=true).
|
||||
type: path
|
||||
version_added: 1.2.0
|
||||
encoding:
|
||||
description:
|
||||
- Use the specified encoding when communicating with the RouterOS device.
|
||||
- Default is C(ASCII). Note that C(UTF-8) requires librouteros 3.2.1 or newer.
|
||||
- Default is V(ASCII). Note that V(UTF-8) requires librouteros 3.2.1 or newer.
|
||||
type: str
|
||||
default: ASCII
|
||||
version_added: 2.1.0
|
||||
|
@ -76,5 +91,43 @@ requirements:
|
|||
- Python >= 3.6 (for librouteros)
|
||||
seealso:
|
||||
- ref: ansible_collections.community.routeros.docsite.api-guide
|
||||
description: How to connect to RouterOS devices with the RouterOS API
|
||||
'''
|
||||
description: How to connect to RouterOS devices with the RouterOS API.
|
||||
"""
|
||||
|
||||
RESTRICT = r"""
|
||||
options:
|
||||
restrict:
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
field:
|
||||
description:
|
||||
- The field whose values to restrict.
|
||||
required: true
|
||||
type: str
|
||||
match_disabled:
|
||||
description:
|
||||
- Whether disabled or not provided values should match.
|
||||
type: bool
|
||||
default: false
|
||||
values:
|
||||
description:
|
||||
- The values of the field to limit to.
|
||||
- 'Note that the types of the values are important. If you provide a string V("0"), and librouteros converts the
|
||||
value returned by the API to the integer V(0), then this will not match. If you are not sure, better include both
|
||||
variants: both the string and the integer.'
|
||||
type: list
|
||||
elements: raw
|
||||
regex:
|
||||
description:
|
||||
- A regular expression matching values of the field to limit to.
|
||||
- Note that all values will be converted to strings before matching.
|
||||
- It is not possible to match disabled values with regular expressions. Set O(restrict[].match_disabled=true) if
|
||||
you also want to match disabled values.
|
||||
type: str
|
||||
invert:
|
||||
description:
|
||||
- Invert the condition. This affects O(restrict[].match_disabled), O(restrict[].values), and O(restrict[].regex).
|
||||
type: bool
|
||||
default: false
|
||||
"""
|
||||
|
|
112
plugins/doc_fragments/attributes.py
Normal file
112
plugins/doc_fragments/attributes.py
Normal file
|
@ -0,0 +1,112 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
class ModuleDocFragment(object):
|
||||
|
||||
# Standard documentation fragment
|
||||
DOCUMENTATION = r"""
|
||||
options: {}
|
||||
attributes:
|
||||
check_mode:
|
||||
description: Can run in C(check_mode) and return changed status prediction without modifying target.
|
||||
diff_mode:
|
||||
description: Will return details on what has changed (or possibly needs changing in C(check_mode)), when in diff mode.
|
||||
platform:
|
||||
description: Target OS/families that can be operated against.
|
||||
support: N/A
|
||||
idempotent:
|
||||
description:
|
||||
- When run twice in a row outside check mode, with the same arguments, the second invocation indicates no change.
|
||||
- This assumes that the system controlled/queried by the module has not changed in a relevant way.
|
||||
"""
|
||||
|
||||
# Should be used together with the standard fragment
|
||||
IDEMPOTENT_NOT_MODIFY_STATE = r"""
|
||||
options: {}
|
||||
attributes:
|
||||
idempotent:
|
||||
support: full
|
||||
details:
|
||||
- This action does not modify state.
|
||||
"""
|
||||
|
||||
# Should be used together with the standard fragment
|
||||
INFO_MODULE = r'''
|
||||
options: {}
|
||||
attributes:
|
||||
check_mode:
|
||||
support: full
|
||||
details:
|
||||
- This action does not modify state.
|
||||
diff_mode:
|
||||
support: N/A
|
||||
details:
|
||||
- This action does not modify state.
|
||||
'''
|
||||
|
||||
ACTIONGROUP_API = r'''
|
||||
options: {}
|
||||
attributes:
|
||||
action_group:
|
||||
description: Use C(group/community.routeros.api) in C(module_defaults) to set defaults for this module.
|
||||
support: full
|
||||
membership:
|
||||
- community.routeros.api
|
||||
'''
|
||||
|
||||
CONN = r"""
|
||||
options: {}
|
||||
attributes:
|
||||
become:
|
||||
description: Is usable alongside C(become) keywords.
|
||||
connection:
|
||||
description: Uses the target's configured connection information to execute code on it.
|
||||
delegation:
|
||||
description: Can be used in conjunction with C(delegate_to) and related keywords.
|
||||
"""
|
||||
|
||||
FACTS = r"""
|
||||
options: {}
|
||||
attributes:
|
||||
facts:
|
||||
description: Action returns an C(ansible_facts) dictionary that will update existing host facts.
|
||||
"""
|
||||
|
||||
# Should be used together with the standard fragment and the FACTS fragment
|
||||
FACTS_MODULE = r'''
|
||||
options: {}
|
||||
attributes:
|
||||
check_mode:
|
||||
support: full
|
||||
details:
|
||||
- This action does not modify state.
|
||||
diff_mode:
|
||||
support: N/A
|
||||
details:
|
||||
- This action does not modify state.
|
||||
facts:
|
||||
support: full
|
||||
'''
|
||||
|
||||
FILES = r"""
|
||||
options: {}
|
||||
attributes:
|
||||
safe_file_operations:
|
||||
description: Uses Ansible's strict file operation functions to ensure proper permissions and avoid data corruption.
|
||||
"""
|
||||
|
||||
FLOW = r"""
|
||||
options: {}
|
||||
attributes:
|
||||
action:
|
||||
description: Indicates this has a corresponding action plugin so some parts of the options can be executed on the controller.
|
||||
async:
|
||||
description: Supports being used with the C(async) keyword.
|
||||
"""
|
|
@ -20,6 +20,7 @@ DOCUMENTATION:
|
|||
- Felix Fontein (@felixfontein)
|
||||
|
||||
EXAMPLES: |
|
||||
---
|
||||
- name: Join arguments for a RouterOS CLI command
|
||||
ansible.builtin.set_fact:
|
||||
arguments: "{{ ['foo=bar', 'comment=foo is bar'] | community.routeros.join }}"
|
||||
|
|
|
@ -12,24 +12,25 @@ DOCUMENTATION:
|
|||
options:
|
||||
_input:
|
||||
description:
|
||||
- A list of assignments. Can be the result of the C(community.routeros.split) filter.
|
||||
- A list of assignments. Can be the result of the P(community.routeros.split#filter) filter.
|
||||
type: list
|
||||
elements: string
|
||||
required: true
|
||||
require_assignment:
|
||||
description:
|
||||
- Allows to accept arguments without values when set to C(false).
|
||||
- Allows to accept arguments without values when set to V(false).
|
||||
type: boolean
|
||||
default: true
|
||||
skip_empty_values:
|
||||
description:
|
||||
- Allows to skip arguments whose value is empty when set to C(true).
|
||||
- Allows to skip arguments whose value is empty when set to V(true).
|
||||
type: boolean
|
||||
default: false
|
||||
author:
|
||||
- Felix Fontein (@felixfontein)
|
||||
|
||||
EXAMPLES: |
|
||||
---
|
||||
- name: Convert a list to a dictionary
|
||||
ansible.builtin.set_fact:
|
||||
dictionary: "{{ ['foo=bar', 'comment=foo is bar'] | community.routeros.list_to_dict }}"
|
||||
|
|
|
@ -19,9 +19,11 @@ DOCUMENTATION:
|
|||
- Felix Fontein (@felixfontein)
|
||||
|
||||
EXAMPLES: |
|
||||
---
|
||||
- name: Quote a RouterOS CLI command argument
|
||||
ansible.builtin.set_fact:
|
||||
quoted: "{{ 'comment=this is a "comment"' | community.routeros.quote_argument }}"
|
||||
quoted: >-
|
||||
{{ 'comment=this is a "comment"' | community.routeros.quote_argument }}
|
||||
# Should result in 'comment="this is a \"comment\""'
|
||||
|
||||
RETURN:
|
||||
|
|
|
@ -19,9 +19,11 @@ DOCUMENTATION:
|
|||
- Felix Fontein (@felixfontein)
|
||||
|
||||
EXAMPLES: |
|
||||
---
|
||||
- name: Quote a RouterOS CLI command argument's value
|
||||
ansible.builtin.set_fact:
|
||||
quoted: "{{ 'this is a "comment"' | community.routeros.quote_argument_value }}"
|
||||
quoted: >-
|
||||
{{ 'this is a "comment"' | community.routeros.quote_argument_value }}
|
||||
# Should result in '"this is a \"comment\""'
|
||||
|
||||
RETURN:
|
||||
|
|
|
@ -19,9 +19,11 @@ DOCUMENTATION:
|
|||
- Felix Fontein (@felixfontein)
|
||||
|
||||
EXAMPLES: |
|
||||
---
|
||||
- name: Split command into list of arguments
|
||||
ansible.builtin.set_fact:
|
||||
argument_list: "{{ 'foo=bar comment="foo is bar" baz' | community.routeros.split }}"
|
||||
argument_list: >-
|
||||
{{ 'foo=bar comment="foo is bar" baz' | community.routeros.split }}
|
||||
# Should result in ['foo=bar', 'comment=foo is bar', 'baz']
|
||||
|
||||
RETURN:
|
||||
|
|
File diff suppressed because it is too large
Load diff
102
plugins/module_utils/_api_helper.py
Normal file
102
plugins/module_utils/_api_helper.py
Normal file
|
@ -0,0 +1,102 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2022, Felix Fontein (@felixfontein) <felix@fontein.de>
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
# The data inside here is private to this collection. If you use this from outside the collection,
|
||||
# you are on your own. There can be random changes to its format even in bugfix releases!
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
import re
|
||||
|
||||
from ansible.module_utils.common.text.converters import to_text
|
||||
|
||||
|
||||
def validate_and_prepare_restrict(module, path_info):
|
||||
restrict = module.params['restrict']
|
||||
if restrict is None:
|
||||
return None
|
||||
restrict_data = []
|
||||
for rule in restrict:
|
||||
field = rule['field']
|
||||
if field.startswith('!'):
|
||||
module.fail_json(msg='restrict: the field name "{0}" must not start with "!"'.format(field))
|
||||
f = path_info.fields.get(field)
|
||||
if f is None:
|
||||
module.fail_json(msg='restrict: the field "{0}" does not exist for this path'.format(field))
|
||||
|
||||
new_rule = dict(
|
||||
field=field,
|
||||
match_disabled=rule['match_disabled'],
|
||||
invert=rule['invert'],
|
||||
)
|
||||
if rule['values'] is not None:
|
||||
new_rule['values'] = rule['values']
|
||||
if rule['regex'] is not None:
|
||||
regex = rule['regex']
|
||||
try:
|
||||
new_rule['regex'] = re.compile(regex)
|
||||
new_rule['regex_source'] = regex
|
||||
except Exception as exc:
|
||||
module.fail_json(msg='restrict: invalid regular expression "{0}": {1}'.format(regex, exc))
|
||||
restrict_data.append(new_rule)
|
||||
return restrict_data
|
||||
|
||||
|
||||
def _value_to_str(value):
|
||||
if value is None:
|
||||
return None
|
||||
value_str = to_text(value)
|
||||
if isinstance(value, bool):
|
||||
value_str = value_str.lower()
|
||||
return value_str
|
||||
|
||||
|
||||
def _test_rule_except_invert(value, rule):
|
||||
if value is None and rule['match_disabled']:
|
||||
return True
|
||||
if 'values' in rule and value in rule['values']:
|
||||
return True
|
||||
if 'regex' in rule and value is not None and rule['regex'].match(_value_to_str(value)):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def restrict_entry_accepted(entry, path_info, restrict_data):
|
||||
if restrict_data is None:
|
||||
return True
|
||||
for rule in restrict_data:
|
||||
# Obtain field and value
|
||||
field = rule['field']
|
||||
field_info = path_info.fields[field]
|
||||
value = entry.get(field)
|
||||
if value is None:
|
||||
value = field_info.default
|
||||
if field not in entry and field_info.absent_value:
|
||||
value = field_info.absent_value
|
||||
|
||||
# Check
|
||||
matches_rule = _test_rule_except_invert(value, rule)
|
||||
if rule['invert']:
|
||||
matches_rule = not matches_rule
|
||||
if not matches_rule:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def restrict_argument_spec():
|
||||
return dict(
|
||||
restrict=dict(
|
||||
type='list',
|
||||
elements='dict',
|
||||
options=dict(
|
||||
field=dict(type='str', required=True),
|
||||
match_disabled=dict(type='bool', default=False),
|
||||
values=dict(type='list', elements='raw'),
|
||||
regex=dict(type='str'),
|
||||
invert=dict(type='bool', default=False),
|
||||
),
|
||||
),
|
||||
)
|
|
@ -12,14 +12,13 @@ __metaclass__ = type
|
|||
from ansible.module_utils.basic import missing_required_lib
|
||||
from ansible.module_utils.common.text.converters import to_native
|
||||
|
||||
import re
|
||||
import ssl
|
||||
import traceback
|
||||
|
||||
LIB_IMP_ERR = None
|
||||
try:
|
||||
from librouteros import connect
|
||||
from librouteros.exceptions import LibRouterosError
|
||||
from librouteros.exceptions import LibRouterosError # noqa: F401, pylint: disable=unused-import
|
||||
HAS_LIB = True
|
||||
except Exception as e:
|
||||
HAS_LIB = False
|
||||
|
@ -41,14 +40,16 @@ def api_argument_spec():
|
|||
hostname=dict(type='str', required=True),
|
||||
port=dict(type='int'),
|
||||
tls=dict(type='bool', default=False, aliases=['ssl']),
|
||||
force_no_cert=dict(type='bool', default=False),
|
||||
validate_certs=dict(type='bool', default=True),
|
||||
validate_cert_hostname=dict(type='bool', default=False),
|
||||
ca_path=dict(type='path'),
|
||||
encoding=dict(type='str', default='ASCII')
|
||||
encoding=dict(type='str', default='ASCII'),
|
||||
timeout=dict(type='int', default=10),
|
||||
)
|
||||
|
||||
|
||||
def _ros_api_connect(module, username, password, host, port, use_tls, validate_certs, validate_cert_hostname, ca_path, encoding):
|
||||
def _ros_api_connect(module, username, password, host, port, use_tls, force_no_cert, validate_certs, validate_cert_hostname, ca_path, encoding, timeout):
|
||||
'''Connect to RouterOS API.'''
|
||||
if not port:
|
||||
if use_tls:
|
||||
|
@ -62,17 +63,21 @@ def _ros_api_connect(module, username, password, host, port, use_tls, validate_c
|
|||
host=host,
|
||||
port=port,
|
||||
encoding=encoding,
|
||||
timeout=timeout,
|
||||
)
|
||||
if use_tls:
|
||||
ctx = ssl.create_default_context(cafile=ca_path)
|
||||
wrap_context = ctx.wrap_socket
|
||||
if not validate_certs:
|
||||
if force_no_cert:
|
||||
ctx.check_hostname = False
|
||||
ctx.set_ciphers("ADH:@SECLEVEL=0")
|
||||
elif not validate_certs:
|
||||
ctx.check_hostname = False
|
||||
ctx.verify_mode = ssl.CERT_NONE
|
||||
elif not validate_cert_hostname:
|
||||
ctx.check_hostname = False
|
||||
else:
|
||||
# Since librouteros doesn't pass server_hostname,
|
||||
# Since librouteros does not pass server_hostname,
|
||||
# we have to do this ourselves:
|
||||
def wrap_context(*args, **kwargs):
|
||||
kwargs.pop('server_hostname', None)
|
||||
|
@ -92,6 +97,7 @@ def _ros_api_connect(module, username, password, host, port, use_tls, validate_c
|
|||
|
||||
|
||||
def create_api(module):
|
||||
"""Create an API object."""
|
||||
return _ros_api_connect(
|
||||
module,
|
||||
module.params['username'],
|
||||
|
@ -99,8 +105,16 @@ def create_api(module):
|
|||
module.params['hostname'],
|
||||
module.params['port'],
|
||||
module.params['tls'],
|
||||
module.params['force_no_cert'],
|
||||
module.params['validate_certs'],
|
||||
module.params['validate_cert_hostname'],
|
||||
module.params['ca_path'],
|
||||
module.params['encoding'],
|
||||
module.params['timeout'],
|
||||
)
|
||||
|
||||
|
||||
def get_api_version(api):
|
||||
"""Given an API object, query the system's version."""
|
||||
system_info = list(api.path().join('system', 'resource'))[0]
|
||||
return system_info['version'].split(' ', 1)[0]
|
||||
|
|
|
@ -9,6 +9,7 @@ import json
|
|||
from ansible.module_utils.common.text.converters import to_native
|
||||
from ansible.module_utils.basic import env_fallback
|
||||
from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import to_list, ComplexList
|
||||
from ansible_collections.community.routeros.plugins.module_utils.version import LooseVersion
|
||||
from ansible.module_utils.connection import Connection, ConnectionError
|
||||
|
||||
_DEVICE_CONFIGS = {}
|
||||
|
@ -103,6 +104,16 @@ def to_commands(module, commands):
|
|||
return transform(commands)
|
||||
|
||||
|
||||
def should_add_leading_space(module):
|
||||
"""Determines whether adding a leading space to the command is needed
|
||||
to workaround prompt bug in 6.49 <= ROS < 7.2"""
|
||||
capabilities = get_capabilities(module)
|
||||
network_os_version = capabilities.get('device_info', {}).get('network_os_version')
|
||||
if network_os_version is None:
|
||||
return False
|
||||
return LooseVersion('6.49') <= LooseVersion(network_os_version) < LooseVersion('7.2')
|
||||
|
||||
|
||||
def run_commands(module, commands, check_rc=True):
|
||||
responses = list()
|
||||
connection = get_connection(module)
|
||||
|
@ -117,6 +128,9 @@ def run_commands(module, commands, check_rc=True):
|
|||
prompt = None
|
||||
answer = None
|
||||
|
||||
if should_add_leading_space(module):
|
||||
command = " " + command
|
||||
|
||||
try:
|
||||
out = connection.get(command, prompt, answer)
|
||||
except ConnectionError as exc:
|
||||
|
|
13
plugins/module_utils/version.py
Normal file
13
plugins/module_utils/version.py
Normal file
|
@ -0,0 +1,13 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (c) 2021, Felix Fontein <felix@fontein.de>
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
"""Provide version object to compare version numbers."""
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
from ansible.module_utils.compat.version import LooseVersion # pylint: disable=unused-import
|
|
@ -8,60 +8,74 @@
|
|||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
DOCUMENTATION = r"""
|
||||
module: api
|
||||
author: "Nikolay Dachev (@NikolayDachev)"
|
||||
short_description: Ansible module for RouterOS API
|
||||
description:
|
||||
- Ansible module for RouterOS API with the Python C(librouteros) library.
|
||||
- This module can add, remove, update, query and execute arbitrary command in RouterOS via API.
|
||||
- This module can add, remove, update, query, and execute arbitrary command in RouterOS through the API.
|
||||
notes:
|
||||
- I(add), I(remove), I(update), I(cmd) and I(query) are mutually exclusive.
|
||||
- I(check_mode) is not supported.
|
||||
- Use the M(community.routeros.api_modify) and M(community.routeros.api_find_and_modify) modules
|
||||
for more specific modifications, and the M(community.routeros.api_info) module for a more controlled
|
||||
way of returning all entries for a path.
|
||||
- O(add), O(remove), O(update), O(cmd), and O(query) are mutually exclusive.
|
||||
- Use the M(community.routeros.api_modify) and M(community.routeros.api_find_and_modify) modules for more specific modifications,
|
||||
and the M(community.routeros.api_info) module for a more controlled way of returning all entries for a path.
|
||||
extends_documentation_fragment:
|
||||
- community.routeros.api
|
||||
- community.routeros.attributes
|
||||
- community.routeros.attributes.actiongroup_api
|
||||
attributes:
|
||||
check_mode:
|
||||
support: none
|
||||
diff_mode:
|
||||
support: none
|
||||
platform:
|
||||
support: full
|
||||
platforms: RouterOS
|
||||
action_group:
|
||||
version_added: 2.1.0
|
||||
idempotent:
|
||||
support: N/A
|
||||
details:
|
||||
- Whether the executed command is idempotent depends on the operation performed.
|
||||
options:
|
||||
path:
|
||||
description:
|
||||
- Main path for all other arguments.
|
||||
- If other arguments are not set, api will return all items in selected path.
|
||||
- Example C(ip address). Equivalent of RouterOS CLI C(/ip address print).
|
||||
- If other arguments are not set, the module will return all items in selected path.
|
||||
- Example V(ip address). Equivalent of RouterOS CLI C(/ip address print).
|
||||
required: true
|
||||
type: str
|
||||
add:
|
||||
description:
|
||||
- Will add selected arguments in selected path to RouterOS config.
|
||||
- Example C(address=1.1.1.1/32 interface=ether1).
|
||||
- Example V(address=1.1.1.1/32 interface=ether1).
|
||||
- Equivalent in RouterOS CLI C(/ip address add address=1.1.1.1/32 interface=ether1).
|
||||
type: str
|
||||
remove:
|
||||
description:
|
||||
- Remove config/value from RouterOS by '.id'.
|
||||
- Example C(*03) will remove config/value with C(id=*03) in selected path.
|
||||
- Example V(*03) will remove config/value with C(id=*03) in selected path.
|
||||
- Equivalent in RouterOS CLI C(/ip address remove numbers=1).
|
||||
- Note C(number) in RouterOS CLI is different from C(.id).
|
||||
type: str
|
||||
update:
|
||||
description:
|
||||
- Update config/value in RouterOS by '.id' in selected path.
|
||||
- Example C(.id=*03 address=1.1.1.3/32) and path C(ip address) will replace existing ip address with C(.id=*03).
|
||||
- Example V(.id=*03 address=1.1.1.3/32) and path V(ip address) will replace the existing IP address with C(.id=*03).
|
||||
- Equivalent in RouterOS CLI C(/ip address set address=1.1.1.3/32 numbers=1).
|
||||
- Note C(number) in RouterOS CLI is different from C(.id).
|
||||
type: str
|
||||
query:
|
||||
description:
|
||||
- Query given path for selected query attributes from RouterOS aip.
|
||||
- Query given path for selected query attributes from RouterOS API.
|
||||
- WHERE is key word which extend query. WHERE format is key operator value - with spaces.
|
||||
- WHERE valid operators are C(==) or C(eq), C(!=) or C(not), C(>) or C(more), C(<) or C(less).
|
||||
- Example path C(ip address) and query C(.id address) will return only C(.id) and C(address) for all items in C(ip address) path.
|
||||
- Example path C(ip address) and query C(.id address WHERE address == 1.1.1.3/32).
|
||||
will return only C(.id) and C(address) for items in C(ip address) path, where address is eq to 1.1.1.3/32.
|
||||
- Example path C(interface) and query C(mtu name WHERE mut > 1400) will
|
||||
return only interfaces C(mtu,name) where mtu is bigger than 1400.
|
||||
- WHERE valid operators are V(==) or V(eq), V(!=) or V(not), V(>) or V(more), V(<) or V(less).
|
||||
- Example path V(ip address) and query V(.id address) will return only C(.id) and C(address) for all items in V(ip address)
|
||||
path.
|
||||
- Example path V(ip address) and query V(.id address WHERE address == 1.1.1.3/32). will return only C(.id) and C(address)
|
||||
for items in V(ip address) path, where address is eq to 1.1.1.3/32.
|
||||
- Example path V(interface) and query V(mtu name WHERE mut > 1400) will return only interfaces C(mtu,name) where mtu
|
||||
is bigger than 1400.
|
||||
- Equivalent in RouterOS CLI C(/interface print where mtu > 1400).
|
||||
type: str
|
||||
extended_query:
|
||||
|
@ -73,76 +87,84 @@ options:
|
|||
attributes:
|
||||
description:
|
||||
- The list of attributes to return.
|
||||
- Every attribute used in a I(where) clause need to be listed here.
|
||||
- Every attribute used in a O(extended_query.where[]) clause need to be listed here.
|
||||
type: list
|
||||
elements: str
|
||||
required: true
|
||||
where:
|
||||
description:
|
||||
- Allows to restrict the objects returned.
|
||||
- The conditions here must all match. An I(or) condition needs at least one of its conditions to match.
|
||||
- The conditions here must all match. An O(extended_query.where[].or) condition needs at least one of its conditions
|
||||
to match.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
attribute:
|
||||
description:
|
||||
- The attribute to match. Must be part of I(attributes).
|
||||
- Either I(or) or all of I(attribute), I(is), and I(value) have to be specified.
|
||||
- The attribute to match. Must be part of O(extended_query.attributes).
|
||||
- Either O(extended_query.where[].or) or all of O(extended_query.where[].attribute), O(extended_query.where[].is),
|
||||
and O(extended_query.where[].value) have to be specified.
|
||||
type: str
|
||||
is:
|
||||
description:
|
||||
- The operator to use for matching.
|
||||
- For equality use C(==) or C(eq). For less use C(<) or C(less). For more use C(>) or C(more).
|
||||
- Use C(in) to check whether the value is part of a list. In that case, I(value) must be a list.
|
||||
- Either I(or) or all of I(attribute), I(is), and I(value) have to be specified.
|
||||
- For equality use V(==) or V(eq). For less use V(<) or V(less). For more use V(>) or V(more).
|
||||
- Use V(in) to check whether the value is part of a list. In that case, O(extended_query.where[].value) must
|
||||
be a list.
|
||||
- Either O(extended_query.where[].or) or all of O(extended_query.where[].attribute), O(extended_query.where[].is),
|
||||
and O(extended_query.where[].value) have to be specified.
|
||||
type: str
|
||||
choices: ["==", "!=", ">", "<", "in", "eq", "not", "more", "less"]
|
||||
value:
|
||||
description:
|
||||
- The value to compare to. Must be a list for I(is=in).
|
||||
- Either I(or) or all of I(attribute), I(is), and I(value) have to be specified.
|
||||
- The value to compare to. Must be a list for O(extended_query.where[].is=in).
|
||||
- Either O(extended_query.where[].or) or all of O(extended_query.where[].attribute), O(extended_query.where[].is),
|
||||
and O(extended_query.where[].value) have to be specified.
|
||||
type: raw
|
||||
or:
|
||||
description:
|
||||
- A list of conditions so that at least one of them has to match.
|
||||
- Either I(or) or all of I(attribute), I(is), and I(value) have to be specified.
|
||||
- Either O(extended_query.where[].or) or all of O(extended_query.where[].attribute), O(extended_query.where[].is),
|
||||
and O(extended_query.where[].value) have to be specified.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
attribute:
|
||||
description:
|
||||
- The attribute to match. Must be part of I(attributes).
|
||||
- The attribute to match. Must be part of O(extended_query.attributes).
|
||||
type: str
|
||||
required: true
|
||||
is:
|
||||
description:
|
||||
- The operator to use for matching.
|
||||
- For equality use C(==) or C(eq). For less use C(<) or C(less). For more use C(>) or C(more).
|
||||
- Use C(in) to check whether the value is part of a list. In that case, I(value) must be a list.
|
||||
- For equality use V(==) or V(eq). For less use V(<) or V(less). For more use V(>) or V(more).
|
||||
- Use V(in) to check whether the value is part of a list. In that case, O(extended_query.where[].or[].value)
|
||||
must be a list.
|
||||
type: str
|
||||
choices: ["==", "!=", ">", "<", "in", "eq", "not", "more", "less"]
|
||||
required: true
|
||||
value:
|
||||
description:
|
||||
- The value to compare to. Must be a list for I(is=in).
|
||||
- The value to compare to. Must be a list for O(extended_query.where[].or[].is=in).
|
||||
type: raw
|
||||
required: true
|
||||
cmd:
|
||||
description:
|
||||
- Execute any/arbitrary command in selected path, after the command we can add C(.id).
|
||||
- Example path C(system script) and cmd C(run .id=*03) is equivalent in RouterOS CLI C(/system script run number=0).
|
||||
- Example path C(ip address) and cmd C(print) is equivalent in RouterOS CLI C(/ip address print).
|
||||
- Example path V(system script) and cmd V(run .id=*03) is equivalent in RouterOS CLI C(/system script run number=0).
|
||||
- Example path V(ip address) and cmd V(print) is equivalent in RouterOS CLI C(/ip address print).
|
||||
type: str
|
||||
seealso:
|
||||
- ref: ansible_collections.community.routeros.docsite.quoting
|
||||
description: How to quote and unquote commands and arguments
|
||||
description: How to quote and unquote commands and arguments.
|
||||
- module: community.routeros.api_facts
|
||||
- module: community.routeros.api_find_and_modify
|
||||
- module: community.routeros.api_info
|
||||
- module: community.routeros.api_modify
|
||||
'''
|
||||
"""
|
||||
|
||||
EXAMPLES = '''
|
||||
EXAMPLES = r"""
|
||||
---
|
||||
- name: Get example - ip address print
|
||||
community.routeros.api:
|
||||
hostname: "{{ hostname }}"
|
||||
|
@ -201,24 +223,24 @@ EXAMPLES = '''
|
|||
- attribute: "network"
|
||||
is: "in"
|
||||
value:
|
||||
- "10.20.36.0"
|
||||
- "192.168.255.0"
|
||||
- "10.20.36.0"
|
||||
- "192.168.255.0"
|
||||
register: extended_queryout
|
||||
|
||||
- name: Dump "Extended query example" output
|
||||
ansible.builtin.debug:
|
||||
msg: '{{ extended_queryout }}'
|
||||
|
||||
- name: Update example - ether2 ip addres with ".id = *14"
|
||||
- name: Update example - ether2 ip address with ".id = *14"
|
||||
community.routeros.api:
|
||||
hostname: "{{ hostname }}"
|
||||
password: "{{ password }}"
|
||||
username: "{{ username }}"
|
||||
path: "ip address"
|
||||
update: >-
|
||||
.id=*14
|
||||
address=192.168.255.20/24
|
||||
comment={{ 'Update 192.168.255.10/24 to 192.168.255.20/24 on ether2' | community.routeros.quote_argument_value }}
|
||||
.id=*14
|
||||
address=192.168.255.20/24
|
||||
comment={{ 'Update 192.168.255.10/24 to 192.168.255.20/24 on ether2' | community.routeros.quote_argument_value }}
|
||||
|
||||
- name: Remove example - ether2 ip 192.168.255.20/24 with ".id = *14"
|
||||
community.routeros.api:
|
||||
|
@ -240,19 +262,19 @@ EXAMPLES = '''
|
|||
- name: Dump "Arbitrary command example" output
|
||||
ansible.builtin.debug:
|
||||
msg: '{{ arbitraryout }}'
|
||||
'''
|
||||
"""
|
||||
|
||||
RETURN = '''
|
||||
---
|
||||
RETURN = r"""
|
||||
message:
|
||||
description: All outputs are in list with dictionary elements returned from RouterOS api.
|
||||
sample: C([{...},{...}])
|
||||
type: list
|
||||
returned: always
|
||||
'''
|
||||
description: All outputs are in list with dictionary elements returned from RouterOS API.
|
||||
sample:
|
||||
- address: 1.2.3.4
|
||||
- address: 2.3.4.5
|
||||
type: list
|
||||
returned: always
|
||||
"""
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.basic import missing_required_lib
|
||||
from ansible.module_utils.common.text.converters import to_native
|
||||
|
||||
from ansible_collections.community.routeros.plugins.module_utils.quoting import (
|
||||
|
@ -269,8 +291,6 @@ from ansible_collections.community.routeros.plugins.module_utils.api import (
|
|||
)
|
||||
|
||||
import re
|
||||
import ssl
|
||||
import traceback
|
||||
|
||||
try:
|
||||
from librouteros.exceptions import LibRouterosError
|
||||
|
|
|
@ -9,36 +9,41 @@
|
|||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
DOCUMENTATION = r"""
|
||||
module: api_facts
|
||||
author:
|
||||
- "Egor Zaitsev (@heuels)"
|
||||
- "Nikolay Dachev (@NikolayDachev)"
|
||||
- "Felix Fontein (@felixfontein)"
|
||||
- "Egor Zaitsev (@heuels)"
|
||||
- "Nikolay Dachev (@NikolayDachev)"
|
||||
- "Felix Fontein (@felixfontein)"
|
||||
version_added: 2.1.0
|
||||
short_description: Collect facts from remote devices running MikroTik RouterOS using the API
|
||||
description:
|
||||
- Collects a base set of device facts from a remote device that
|
||||
is running RouterOS. This module prepends all of the
|
||||
base network fact keys with C(ansible_net_<fact>). The facts
|
||||
module will always collect a base set of facts from the device
|
||||
- Collects a base set of device facts from a remote device that is running RouterOS. This module prepends all of the base
|
||||
network fact keys with C(ansible_net_<fact>). The facts module will always collect a base set of facts from the device
|
||||
and can enable or disable collection of additional facts.
|
||||
- As opposed to the M(community.routeros.facts) module, it uses the
|
||||
RouterOS API, similar to the M(community.routeros.api) module.
|
||||
- As opposed to the M(community.routeros.facts) module, it uses the RouterOS API, similar to the M(community.routeros.api)
|
||||
module.
|
||||
extends_documentation_fragment:
|
||||
- community.routeros.api
|
||||
- community.routeros.attributes
|
||||
- community.routeros.attributes.actiongroup_api
|
||||
- community.routeros.attributes.facts
|
||||
- community.routeros.attributes.facts_module
|
||||
- community.routeros.attributes.idempotent_not_modify_state
|
||||
attributes:
|
||||
platform:
|
||||
support: full
|
||||
platforms: RouterOS
|
||||
options:
|
||||
gather_subset:
|
||||
description:
|
||||
- When supplied, this argument will restrict the facts collected
|
||||
to a given subset. Possible values for this argument include
|
||||
C(all), C(hardware), C(interfaces), and C(routing).
|
||||
- Can specify a list of values to include a larger subset.
|
||||
Values can also be used with an initial C(!) to specify that a
|
||||
specific subset should not be collected.
|
||||
- When supplied, this argument will restrict the facts collected to a given subset. Possible values for this argument
|
||||
include V(all), V(hardware), V(interfaces), and V(routing).
|
||||
- Can specify a list of values to include a larger subset. Values can also be used with an initial V(!) to specify that
|
||||
a specific subset should not be collected.
|
||||
required: false
|
||||
default: 'all'
|
||||
default:
|
||||
- all
|
||||
type: list
|
||||
elements: str
|
||||
seealso:
|
||||
|
@ -47,9 +52,10 @@ seealso:
|
|||
- module: community.routeros.api_find_and_modify
|
||||
- module: community.routeros.api_info
|
||||
- module: community.routeros.api_modify
|
||||
'''
|
||||
"""
|
||||
|
||||
EXAMPLES = """
|
||||
EXAMPLES = r"""
|
||||
---
|
||||
- name: Collect all facts from the device
|
||||
community.routeros.api_facts:
|
||||
hostname: 192.168.88.1
|
||||
|
@ -66,7 +72,7 @@ EXAMPLES = """
|
|||
- "!hardware"
|
||||
"""
|
||||
|
||||
RETURN = """
|
||||
RETURN = r"""
|
||||
ansible_facts:
|
||||
description: "Dictionary of IP geolocation facts for a host's IP address."
|
||||
returned: always
|
||||
|
@ -80,96 +86,95 @@ ansible_facts:
|
|||
# default
|
||||
ansible_net_model:
|
||||
description: The model name returned from the device.
|
||||
returned: I(gather_subset) contains C(default)
|
||||
returned: O(gather_subset) contains V(default)
|
||||
type: str
|
||||
ansible_net_serialnum:
|
||||
description: The serial number of the remote device.
|
||||
returned: I(gather_subset) contains C(default)
|
||||
returned: O(gather_subset) contains V(default)
|
||||
type: str
|
||||
ansible_net_version:
|
||||
description: The operating system version running on the remote device.
|
||||
returned: I(gather_subset) contains C(default)
|
||||
returned: O(gather_subset) contains V(default)
|
||||
type: str
|
||||
ansible_net_hostname:
|
||||
description: The configured hostname of the device.
|
||||
returned: I(gather_subset) contains C(default)
|
||||
returned: O(gather_subset) contains V(default)
|
||||
type: str
|
||||
ansible_net_arch:
|
||||
description: The CPU architecture of the device.
|
||||
returned: I(gather_subset) contains C(default)
|
||||
returned: O(gather_subset) contains V(default)
|
||||
type: str
|
||||
ansible_net_uptime:
|
||||
description: The uptime of the device.
|
||||
returned: I(gather_subset) contains C(default)
|
||||
returned: O(gather_subset) contains V(default)
|
||||
type: str
|
||||
ansible_net_cpu_load:
|
||||
description: Current CPU load.
|
||||
returned: I(gather_subset) contains C(default)
|
||||
returned: O(gather_subset) contains V(default)
|
||||
type: str
|
||||
|
||||
# hardware
|
||||
ansible_net_spacefree_mb:
|
||||
description: The available disk space on the remote device in MiB.
|
||||
returned: I(gather_subset) contains C(hardware)
|
||||
returned: O(gather_subset) contains V(hardware)
|
||||
type: dict
|
||||
ansible_net_spacetotal_mb:
|
||||
description: The total disk space on the remote device in MiB.
|
||||
returned: I(gather_subset) contains C(hardware)
|
||||
returned: O(gather_subset) contains V(hardware)
|
||||
type: dict
|
||||
ansible_net_memfree_mb:
|
||||
description: The available free memory on the remote device in MiB.
|
||||
returned: I(gather_subset) contains C(hardware)
|
||||
returned: O(gather_subset) contains V(hardware)
|
||||
type: int
|
||||
ansible_net_memtotal_mb:
|
||||
description: The total memory on the remote device in MiB.
|
||||
returned: I(gather_subset) contains C(hardware)
|
||||
returned: O(gather_subset) contains V(hardware)
|
||||
type: int
|
||||
|
||||
# interfaces
|
||||
ansible_net_all_ipv4_addresses:
|
||||
description: All IPv4 addresses configured on the device.
|
||||
returned: I(gather_subset) contains C(interfaces)
|
||||
returned: O(gather_subset) contains V(interfaces)
|
||||
type: list
|
||||
ansible_net_all_ipv6_addresses:
|
||||
description: All IPv6 addresses configured on the device.
|
||||
returned: I(gather_subset) contains C(interfaces)
|
||||
returned: O(gather_subset) contains V(interfaces)
|
||||
type: list
|
||||
ansible_net_interfaces:
|
||||
description: A hash of all interfaces running on the system.
|
||||
returned: I(gather_subset) contains C(interfaces)
|
||||
returned: O(gather_subset) contains V(interfaces)
|
||||
type: dict
|
||||
ansible_net_neighbors:
|
||||
description: The list of neighbors from the remote device.
|
||||
returned: I(gather_subset) contains C(interfaces)
|
||||
returned: O(gather_subset) contains V(interfaces)
|
||||
type: dict
|
||||
|
||||
# routing
|
||||
ansible_net_bgp_peer:
|
||||
description: A dictionary with BGP peer information.
|
||||
returned: I(gather_subset) contains C(routing)
|
||||
returned: O(gather_subset) contains V(routing)
|
||||
type: dict
|
||||
ansible_net_bgp_vpnv4_route:
|
||||
description: A dictionary with BGP vpnv4 route information.
|
||||
returned: I(gather_subset) contains C(routing)
|
||||
returned: O(gather_subset) contains V(routing)
|
||||
type: dict
|
||||
ansible_net_bgp_instance:
|
||||
description: A dictionary with BGP instance information.
|
||||
returned: I(gather_subset) contains C(routing)
|
||||
returned: O(gather_subset) contains V(routing)
|
||||
type: dict
|
||||
ansible_net_route:
|
||||
description: A dictionary for routes in all routing tables.
|
||||
returned: I(gather_subset) contains C(routing)
|
||||
returned: O(gather_subset) contains V(routing)
|
||||
type: dict
|
||||
ansible_net_ospf_instance:
|
||||
description: A dictionary with OSPF instances.
|
||||
returned: I(gather_subset) contains C(routing)
|
||||
returned: O(gather_subset) contains V(routing)
|
||||
type: dict
|
||||
ansible_net_ospf_neighbor:
|
||||
description: A dictionary with OSPF neighbors.
|
||||
returned: I(gather_subset) contains C(routing)
|
||||
returned: O(gather_subset) contains V(routing)
|
||||
type: dict
|
||||
"""
|
||||
import re
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.six import iteritems
|
||||
|
@ -312,8 +317,10 @@ class Interfaces(FactsBase):
|
|||
def populate_addresses(self, data, family):
|
||||
for value in data:
|
||||
key = value['interface']
|
||||
if family not in self.facts['interfaces'][key]:
|
||||
self.facts['interfaces'][key][family] = []
|
||||
iface = self.facts['interfaces'].setdefault(key, (
|
||||
{"type": "ansible:unknown"} if key.startswith('*') else
|
||||
{"type": "ansible:mismatch"}))
|
||||
iface_addrs = iface.setdefault(family, [])
|
||||
addr, subnet = value['address'].split('/')
|
||||
subnet = subnet.strip()
|
||||
# Try to convert subnet to an integer
|
||||
|
@ -323,7 +330,7 @@ class Interfaces(FactsBase):
|
|||
pass
|
||||
ip = dict(address=addr.strip(), subnet=subnet)
|
||||
self.add_ip_address(addr.strip(), family)
|
||||
self.facts['interfaces'][key][family].append(ip)
|
||||
iface_addrs.append(ip)
|
||||
|
||||
def add_ip_address(self, address, family):
|
||||
if family == 'ipv4':
|
||||
|
@ -414,8 +421,6 @@ FACT_SUBSETS = dict(
|
|||
|
||||
VALID_SUBSETS = frozenset(FACT_SUBSETS.keys())
|
||||
|
||||
warnings = []
|
||||
|
||||
|
||||
def main():
|
||||
argument_spec = dict(
|
||||
|
@ -480,7 +485,7 @@ def main():
|
|||
key = 'ansible_net_%s' % key
|
||||
ansible_facts[key] = value
|
||||
|
||||
module.exit_json(ansible_facts=ansible_facts, warnings=warnings)
|
||||
module.exit_json(ansible_facts=ansible_facts)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -8,8 +8,7 @@
|
|||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
DOCUMENTATION = r"""
|
||||
module: api_find_and_modify
|
||||
author:
|
||||
- "Felix Fontein (@felixfontein)"
|
||||
|
@ -17,35 +16,46 @@ short_description: Find and modify information using the API
|
|||
version_added: 2.1.0
|
||||
description:
|
||||
- Allows to find entries for a path by conditions and modify the values of these entries.
|
||||
- Use the M(community.routeros.api_find_and_modify) module to set all entries of a path to specific values,
|
||||
or change multiple entries in different ways in one step.
|
||||
- Use the M(community.routeros.api_find_and_modify) module to set all entries of a path to specific values, or change multiple
|
||||
entries in different ways in one step.
|
||||
notes:
|
||||
- "If you want to change values based on their old values (like change all comments 'foo' to 'bar') and make sure that
|
||||
there are at least N such values, you can use I(require_matches_min=N) together with I(allow_no_matches=true).
|
||||
This will make the module fail if there are less than N such entries, but not if there is no match. The latter case
|
||||
is needed for idempotency of the task: once the values have been changed, there should be no further match."
|
||||
- Supports I(check_mode).
|
||||
- "If you want to change values based on their old values (like change all comments 'foo' to 'bar') and make sure that there
|
||||
are at least N such values, you can use O(require_matches_min=N) together with O(allow_no_matches=true). This will make
|
||||
the module fail if there are less than N such entries, but not if there is no match. The latter case is needed for idempotency
|
||||
of the task: once the values have been changed, there should be no further match."
|
||||
extends_documentation_fragment:
|
||||
- community.routeros.api
|
||||
- community.routeros.attributes
|
||||
- community.routeros.attributes.actiongroup_api
|
||||
attributes:
|
||||
check_mode:
|
||||
support: full
|
||||
diff_mode:
|
||||
support: full
|
||||
platform:
|
||||
support: full
|
||||
platforms: RouterOS
|
||||
idempotent:
|
||||
support: full
|
||||
options:
|
||||
path:
|
||||
description:
|
||||
- Path to query.
|
||||
- An example value is C(ip address). This is equivalent to running C(/ip address) in the RouterOS CLI.
|
||||
- An example value is V(ip address). This is equivalent to running C(/ip address) in the RouterOS CLI.
|
||||
required: true
|
||||
type: str
|
||||
find:
|
||||
description:
|
||||
- Fields to search for.
|
||||
- The module will only consider entries in the given I(path) that match all fields provided here.
|
||||
- Use YAML C(~), or prepend keys with C(!), to specify an unset value.
|
||||
- The module will only consider entries in the given O(path) that match all fields provided here.
|
||||
- Use YAML V(~), or prepend keys with V(!), to specify an unset value.
|
||||
- Note that if the dictionary specified here is empty, every entry in the path will be matched.
|
||||
required: true
|
||||
type: dict
|
||||
values:
|
||||
description:
|
||||
- On all entries matching the conditions in I(find), set the keys of this option to the values specified here.
|
||||
- Use YAML C(~), or prepend keys with C(!), to specify to unset a value.
|
||||
- On all entries matching the conditions in O(find), set the keys of this option to the values specified here.
|
||||
- Use YAML V(~), or prepend keys with V(!), to specify to unset a value.
|
||||
required: true
|
||||
type: dict
|
||||
require_matches_min:
|
||||
|
@ -63,16 +73,32 @@ options:
|
|||
allow_no_matches:
|
||||
description:
|
||||
- Whether to allow that no match is found.
|
||||
- If not specified, this value is induced from whether I(require_matches_min) is 0 or larger.
|
||||
- If not specified, this value is induced from whether O(require_matches_min) is 0 or larger.
|
||||
type: bool
|
||||
ignore_dynamic:
|
||||
description:
|
||||
- Whether to ignore dynamic entries.
|
||||
- By default, they are considered. If set to V(true), they are not considered.
|
||||
- It is generally recommended to set this to V(true) unless when you really need to modify dynamic entries.
|
||||
type: bool
|
||||
default: false
|
||||
version_added: 3.7.0
|
||||
ignore_builtin:
|
||||
description:
|
||||
- Whether to ignore builtin entries.
|
||||
- By default, they are considered. If set to V(true), they are not considered.
|
||||
- It is generally recommended to set this to V(true) unless when you really need to modify builtin entries.
|
||||
type: bool
|
||||
default: false
|
||||
version_added: 3.7.0
|
||||
seealso:
|
||||
- module: community.routeros.api
|
||||
- module: community.routeros.api_facts
|
||||
- module: community.routeros.api_modify
|
||||
- module: community.routeros.api_info
|
||||
'''
|
||||
"""
|
||||
|
||||
EXAMPLES = '''
|
||||
EXAMPLES = r"""
|
||||
---
|
||||
- name: Rename bridge from 'bridge' to 'my-bridge'
|
||||
community.routeros.api_find_and_modify:
|
||||
|
@ -84,6 +110,10 @@ EXAMPLES = '''
|
|||
name: bridge
|
||||
values:
|
||||
name: my-bridge
|
||||
# Always ignore dynamic and builtin entries
|
||||
# (not relevant for this path, but generally recommended)
|
||||
ignore_dynamic: true
|
||||
ignore_builtin: true
|
||||
|
||||
- name: Change IP address to 192.168.1.1 for interface bridge - assuming there is only one
|
||||
community.routeros.api_find_and_modify:
|
||||
|
@ -99,55 +129,58 @@ EXAMPLES = '''
|
|||
# exactly one is configured.
|
||||
require_matches_min: 1
|
||||
require_matches_max: 1
|
||||
'''
|
||||
# Always ignore dynamic and builtin entries
|
||||
# (not relevant for this path, but generally recommended)
|
||||
ignore_dynamic: true
|
||||
ignore_builtin: true
|
||||
"""
|
||||
|
||||
RETURN = '''
|
||||
---
|
||||
RETURN = r"""
|
||||
old_data:
|
||||
description:
|
||||
- A list of all elements for the current path before a change was made.
|
||||
sample:
|
||||
- '.id': '*1'
|
||||
actual-interface: bridge
|
||||
address: "192.168.88.1/24"
|
||||
comment: defconf
|
||||
disabled: false
|
||||
dynamic: false
|
||||
interface: bridge
|
||||
invalid: false
|
||||
network: 192.168.88.0
|
||||
type: list
|
||||
elements: dict
|
||||
returned: success
|
||||
description:
|
||||
- A list of all elements for the current path before a change was made.
|
||||
sample:
|
||||
- '.id': '*1'
|
||||
actual-interface: bridge
|
||||
address: "192.168.88.1/24"
|
||||
comment: defconf
|
||||
disabled: false
|
||||
dynamic: false
|
||||
interface: bridge
|
||||
invalid: false
|
||||
network: 192.168.88.0
|
||||
type: list
|
||||
elements: dict
|
||||
returned: success
|
||||
new_data:
|
||||
description:
|
||||
- A list of all elements for the current path after a change was made.
|
||||
sample:
|
||||
- '.id': '*1'
|
||||
actual-interface: bridge
|
||||
address: "192.168.1.1/24"
|
||||
comment: awesome
|
||||
disabled: false
|
||||
dynamic: false
|
||||
interface: bridge
|
||||
invalid: false
|
||||
network: 192.168.1.0
|
||||
type: list
|
||||
elements: dict
|
||||
returned: success
|
||||
description:
|
||||
- A list of all elements for the current path after a change was made.
|
||||
sample:
|
||||
- '.id': '*1'
|
||||
actual-interface: bridge
|
||||
address: "192.168.1.1/24"
|
||||
comment: awesome
|
||||
disabled: false
|
||||
dynamic: false
|
||||
interface: bridge
|
||||
invalid: false
|
||||
network: 192.168.1.0
|
||||
type: list
|
||||
elements: dict
|
||||
returned: success
|
||||
match_count:
|
||||
description:
|
||||
- The number of entries that matched the criteria in I(find).
|
||||
sample: 1
|
||||
type: int
|
||||
returned: success
|
||||
description:
|
||||
- The number of entries that matched the criteria in O(find).
|
||||
sample: 1
|
||||
type: int
|
||||
returned: success
|
||||
modify__count:
|
||||
description:
|
||||
- The number of entries that were modified.
|
||||
sample: 1
|
||||
type: int
|
||||
returned: success
|
||||
'''
|
||||
description:
|
||||
- The number of entries that were modified.
|
||||
sample: 1
|
||||
type: int
|
||||
returned: success
|
||||
"""
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.common.text.converters import to_native
|
||||
|
@ -176,6 +209,17 @@ def compose_api_path(api, path):
|
|||
return api_path
|
||||
|
||||
|
||||
def filter_entries(entries, ignore_dynamic=False, ignore_builtin=False):
|
||||
result = []
|
||||
for entry in entries:
|
||||
if ignore_dynamic and entry.get('dynamic', False):
|
||||
continue
|
||||
if ignore_builtin and entry.get('builtin', False):
|
||||
continue
|
||||
result.append(entry)
|
||||
return result
|
||||
|
||||
|
||||
DISABLED_MEANS_EMPTY_STRING = ('comment', )
|
||||
|
||||
|
||||
|
@ -187,6 +231,8 @@ def main():
|
|||
require_matches_min=dict(type='int', default=0),
|
||||
require_matches_max=dict(type='int'),
|
||||
allow_no_matches=dict(type='bool'),
|
||||
ignore_dynamic=dict(type='bool', default=False),
|
||||
ignore_builtin=dict(type='bool', default=False),
|
||||
)
|
||||
module_args.update(api_argument_spec())
|
||||
|
||||
|
@ -214,6 +260,9 @@ def main():
|
|||
if key in values:
|
||||
module.fail_json(msg='`values` must not contain both "{key}" and "!{key}"!'.format(key=key))
|
||||
|
||||
ignore_dynamic = module.params['ignore_dynamic']
|
||||
ignore_builtin = module.params['ignore_builtin']
|
||||
|
||||
check_has_library(module)
|
||||
api = create_api(module)
|
||||
|
||||
|
@ -221,7 +270,7 @@ def main():
|
|||
|
||||
api_path = compose_api_path(api, path)
|
||||
|
||||
old_data = list(api_path)
|
||||
old_data = filter_entries(list(api_path), ignore_dynamic=ignore_dynamic, ignore_builtin=ignore_builtin)
|
||||
new_data = [entry.copy() for entry in old_data]
|
||||
|
||||
# Find matching entries
|
||||
|
@ -290,7 +339,7 @@ def main():
|
|||
error=to_native(e),
|
||||
)
|
||||
)
|
||||
new_data = list(api_path)
|
||||
new_data = filter_entries(list(api_path), ignore_dynamic=ignore_dynamic, ignore_builtin=ignore_builtin)
|
||||
|
||||
# Produce return value
|
||||
more = {}
|
||||
|
|
|
@ -8,8 +8,7 @@
|
|||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
DOCUMENTATION = r"""
|
||||
module: api_info
|
||||
author:
|
||||
- "Felix Fontein (@felixfontein)"
|
||||
|
@ -18,113 +17,258 @@ version_added: 2.2.0
|
|||
description:
|
||||
- Allows to retrieve information for a path using the API.
|
||||
- This can be used to backup a path to restore it with the M(community.routeros.api_modify) module.
|
||||
- Entries are normalized, and dynamic entries are not returned. Use the I(handle_disabled) and
|
||||
I(hide_defaults) options to control normalization, the I(include_dynamic) option to also return
|
||||
dynamic entries, and use I(unfiltered) to return all fields including counters.
|
||||
- B(Note) that this module is still heavily in development, and only supports B(some) paths.
|
||||
If you want to support new paths, or think you found problems with existing paths, please first
|
||||
L(create an issue in the community.routeros Issue Tracker,https://github.com/ansible-collections/community.routeros/issues/).
|
||||
notes:
|
||||
- Supports I(check_mode).
|
||||
- Entries are normalized, dynamic and builtin entries are not returned. Use the O(handle_disabled) and O(hide_defaults)
|
||||
options to control normalization, the O(include_dynamic) and O(include_builtin) options to also return dynamic resp. builtin
|
||||
entries, and use O(unfiltered) to return all fields including counters.
|
||||
- B(Note) that this module is still heavily in development, and only supports B(some) paths. If you want to support new
|
||||
paths, or think you found problems with existing paths, please first L(create an issue in the community.routeros Issue
|
||||
Tracker,https://github.com/ansible-collections/community.routeros/issues/).
|
||||
extends_documentation_fragment:
|
||||
- community.routeros.api
|
||||
- community.routeros.api.restrict
|
||||
- community.routeros.attributes
|
||||
- community.routeros.attributes.actiongroup_api
|
||||
- community.routeros.attributes.idempotent_not_modify_state
|
||||
- community.routeros.attributes.info_module
|
||||
attributes:
|
||||
platform:
|
||||
support: full
|
||||
platforms: RouterOS
|
||||
options:
|
||||
path:
|
||||
description:
|
||||
- Path to query.
|
||||
- An example value is C(ip address). This is equivalent to running C(/ip address print) in the RouterOS CLI.
|
||||
- An example value is V(ip address). This is equivalent to running C(/ip address print) in the RouterOS CLI.
|
||||
required: true
|
||||
type: str
|
||||
choices:
|
||||
# BEGIN PATH LIST
|
||||
- caps-man aaa
|
||||
- certificate settings
|
||||
- interface bridge port
|
||||
- interface bridge port-controller
|
||||
- interface bridge port-extender
|
||||
- interface bridge settings
|
||||
- interface detect-internet
|
||||
- interface ethernet
|
||||
- interface ethernet switch
|
||||
- interface ethernet switch port
|
||||
- interface l2tp-server server
|
||||
- interface ovpn-server server
|
||||
- interface pptp-server server
|
||||
- interface sstp-server server
|
||||
- interface wireless align
|
||||
- interface wireless cap
|
||||
- interface wireless sniffer
|
||||
- interface wireless snooper
|
||||
- ip accounting
|
||||
- ip accounting web-access
|
||||
- ip address
|
||||
- ip cloud
|
||||
- ip cloud advanced
|
||||
- ip dhcp-client
|
||||
- ip dhcp-client option
|
||||
- ip dhcp-server
|
||||
- ip dhcp-server config
|
||||
- ip dhcp-server lease
|
||||
- ip dhcp-server network
|
||||
- ip dns
|
||||
- ip dns static
|
||||
- ip firewall address-list
|
||||
- ip firewall connection tracking
|
||||
- ip firewall filter
|
||||
- ip firewall nat
|
||||
- ip firewall service-port
|
||||
- ip hotspot service-port
|
||||
- ip ipsec settings
|
||||
- ip neighbor discovery-settings
|
||||
- ip pool
|
||||
- ip proxy
|
||||
- ip service
|
||||
- ip settings
|
||||
- ip smb
|
||||
- ip socks
|
||||
- ip ssh
|
||||
- ip tftp settings
|
||||
- ip traffic-flow
|
||||
- ip traffic-flow ipfix
|
||||
- ip upnp
|
||||
- ipv6 dhcp-client
|
||||
- ipv6 firewall address-list
|
||||
- ipv6 firewall filter
|
||||
- ipv6 nd prefix default
|
||||
- ipv6 settings
|
||||
- mpls
|
||||
- mpls ldp
|
||||
- port firmware
|
||||
- ppp aaa
|
||||
- queue interface
|
||||
- radius incoming
|
||||
- routing bgp instance
|
||||
- routing mme
|
||||
- routing rip
|
||||
- routing ripng
|
||||
- snmp
|
||||
- system clock
|
||||
- system clock manual
|
||||
- system identity
|
||||
- system leds settings
|
||||
- system note
|
||||
- system ntp client
|
||||
- system package update
|
||||
- system routerboard settings
|
||||
- system upgrade mirror
|
||||
- system watchdog
|
||||
- tool bandwidth-server
|
||||
- tool e-mail
|
||||
- tool graphing
|
||||
- tool mac-server
|
||||
- tool mac-server mac-winbox
|
||||
- tool mac-server ping
|
||||
- tool romon
|
||||
- tool sms
|
||||
- tool sniffer
|
||||
- tool traffic-generator
|
||||
- user aaa
|
||||
- user group
|
||||
- caps-man aaa
|
||||
- caps-man access-list
|
||||
- caps-man channel
|
||||
- caps-man configuration
|
||||
- caps-man datapath
|
||||
- caps-man manager
|
||||
- caps-man manager interface
|
||||
- caps-man provisioning
|
||||
- caps-man security
|
||||
- certificate settings
|
||||
- interface 6to4
|
||||
- interface bonding
|
||||
- interface bridge
|
||||
- interface bridge mlag
|
||||
- interface bridge port
|
||||
- interface bridge port-controller
|
||||
- interface bridge port-extender
|
||||
- interface bridge settings
|
||||
- interface bridge vlan
|
||||
- interface detect-internet
|
||||
- interface eoip
|
||||
- interface ethernet
|
||||
- interface ethernet poe
|
||||
- interface ethernet switch
|
||||
- interface ethernet switch port
|
||||
- interface ethernet switch port-isolation
|
||||
- interface gre
|
||||
- interface gre6
|
||||
- interface l2tp-client
|
||||
- interface l2tp-server server
|
||||
- interface list
|
||||
- interface list member
|
||||
- interface ovpn-client
|
||||
- interface ovpn-server server
|
||||
- interface ppp-client
|
||||
- interface pppoe-client
|
||||
- interface pppoe-server server
|
||||
- interface pptp-server server
|
||||
- interface sstp-server server
|
||||
- interface vlan
|
||||
- interface vrrp
|
||||
- interface wifi
|
||||
- interface wifi aaa
|
||||
- interface wifi access-list
|
||||
- interface wifi cap
|
||||
- interface wifi capsman
|
||||
- interface wifi channel
|
||||
- interface wifi configuration
|
||||
- interface wifi datapath
|
||||
- interface wifi interworking
|
||||
- interface wifi provisioning
|
||||
- interface wifi security
|
||||
- interface wifi steering
|
||||
- interface wifiwave2
|
||||
- interface wifiwave2 aaa
|
||||
- interface wifiwave2 access-list
|
||||
- interface wifiwave2 cap
|
||||
- interface wifiwave2 capsman
|
||||
- interface wifiwave2 channel
|
||||
- interface wifiwave2 configuration
|
||||
- interface wifiwave2 datapath
|
||||
- interface wifiwave2 interworking
|
||||
- interface wifiwave2 provisioning
|
||||
- interface wifiwave2 security
|
||||
- interface wifiwave2 steering
|
||||
- interface wireguard
|
||||
- interface wireguard peers
|
||||
- interface wireless
|
||||
- interface wireless access-list
|
||||
- interface wireless align
|
||||
- interface wireless cap
|
||||
- interface wireless connect-list
|
||||
- interface wireless security-profiles
|
||||
- interface wireless sniffer
|
||||
- interface wireless snooper
|
||||
- iot modbus
|
||||
- ip accounting
|
||||
- ip accounting web-access
|
||||
- ip address
|
||||
- ip arp
|
||||
- ip cloud
|
||||
- ip cloud advanced
|
||||
- ip dhcp-client
|
||||
- ip dhcp-client option
|
||||
- ip dhcp-relay
|
||||
- ip dhcp-server
|
||||
- ip dhcp-server config
|
||||
- ip dhcp-server lease
|
||||
- ip dhcp-server matcher
|
||||
- ip dhcp-server network
|
||||
- ip dhcp-server option
|
||||
- ip dhcp-server option sets
|
||||
- ip dns
|
||||
- ip dns adlist
|
||||
- ip dns forwarders
|
||||
- ip dns static
|
||||
- ip firewall address-list
|
||||
- ip firewall connection tracking
|
||||
- ip firewall filter
|
||||
- ip firewall layer7-protocol
|
||||
- ip firewall mangle
|
||||
- ip firewall nat
|
||||
- ip firewall raw
|
||||
- ip firewall service-port
|
||||
- ip hotspot service-port
|
||||
- ip ipsec identity
|
||||
- ip ipsec mode-config
|
||||
- ip ipsec peer
|
||||
- ip ipsec policy
|
||||
- ip ipsec profile
|
||||
- ip ipsec proposal
|
||||
- ip ipsec settings
|
||||
- ip neighbor discovery-settings
|
||||
- ip pool
|
||||
- ip proxy
|
||||
- ip route
|
||||
- ip route rule
|
||||
- ip route vrf
|
||||
- ip service
|
||||
- ip settings
|
||||
- ip smb
|
||||
- ip socks
|
||||
- ip ssh
|
||||
- ip tftp settings
|
||||
- ip traffic-flow
|
||||
- ip traffic-flow ipfix
|
||||
- ip traffic-flow target
|
||||
- ip upnp
|
||||
- ip upnp interfaces
|
||||
- ip vrf
|
||||
- ipv6 address
|
||||
- ipv6 dhcp-client
|
||||
- ipv6 dhcp-server
|
||||
- ipv6 dhcp-server option
|
||||
- ipv6 firewall address-list
|
||||
- ipv6 firewall filter
|
||||
- ipv6 firewall mangle
|
||||
- ipv6 firewall nat
|
||||
- ipv6 firewall raw
|
||||
- ipv6 nd
|
||||
- ipv6 nd prefix
|
||||
- ipv6 nd prefix default
|
||||
- ipv6 route
|
||||
- ipv6 settings
|
||||
- mpls
|
||||
- mpls interface
|
||||
- mpls ldp
|
||||
- mpls ldp accept-filter
|
||||
- mpls ldp advertise-filter
|
||||
- mpls ldp interface
|
||||
- port firmware
|
||||
- port remote-access
|
||||
- ppp aaa
|
||||
- ppp profile
|
||||
- ppp secret
|
||||
- queue interface
|
||||
- queue simple
|
||||
- queue tree
|
||||
- queue type
|
||||
- radius
|
||||
- radius incoming
|
||||
- routing bfd configuration
|
||||
- routing bgp aggregate
|
||||
- routing bgp connection
|
||||
- routing bgp instance
|
||||
- routing bgp network
|
||||
- routing bgp peer
|
||||
- routing bgp template
|
||||
- routing filter
|
||||
- routing filter community-list
|
||||
- routing filter num-list
|
||||
- routing filter rule
|
||||
- routing filter select-rule
|
||||
- routing id
|
||||
- routing igmp-proxy
|
||||
- routing igmp-proxy interface
|
||||
- routing mme
|
||||
- routing ospf area
|
||||
- routing ospf area range
|
||||
- routing ospf instance
|
||||
- routing ospf interface-template
|
||||
- routing ospf static-neighbor
|
||||
- routing pimsm instance
|
||||
- routing pimsm interface-template
|
||||
- routing rip
|
||||
- routing ripng
|
||||
- routing rule
|
||||
- routing table
|
||||
- snmp
|
||||
- snmp community
|
||||
- system clock
|
||||
- system clock manual
|
||||
- system health settings
|
||||
- system identity
|
||||
- system leds settings
|
||||
- system logging
|
||||
- system logging action
|
||||
- system note
|
||||
- system ntp client
|
||||
- system ntp client servers
|
||||
- system ntp server
|
||||
- system package update
|
||||
- system resource irq rps
|
||||
- system routerboard settings
|
||||
- system scheduler
|
||||
- system script
|
||||
- system upgrade mirror
|
||||
- system ups
|
||||
- system watchdog
|
||||
- tool bandwidth-server
|
||||
- tool e-mail
|
||||
- tool graphing
|
||||
- tool graphing interface
|
||||
- tool graphing resource
|
||||
- tool mac-server
|
||||
- tool mac-server mac-winbox
|
||||
- tool mac-server ping
|
||||
- tool netwatch
|
||||
- tool romon
|
||||
- tool sms
|
||||
- tool sniffer
|
||||
- tool traffic-generator
|
||||
- user
|
||||
- user aaa
|
||||
- user group
|
||||
- user settings
|
||||
# END PATH LIST
|
||||
unfiltered:
|
||||
description:
|
||||
|
@ -135,9 +279,9 @@ options:
|
|||
handle_disabled:
|
||||
description:
|
||||
- How to handle unset values.
|
||||
- C(exclamation) prepends the keys with C(!) in the output with value C(null).
|
||||
- C(null-value) uses the regular key with value C(null).
|
||||
- C(omit) omits these values from the result.
|
||||
- V(exclamation) prepends the keys with V(!) in the output with value V(null).
|
||||
- V(null-value) uses the regular key with value V(null).
|
||||
- V(omit) omits these values from the result.
|
||||
type: str
|
||||
choices:
|
||||
- exclamation
|
||||
|
@ -153,17 +297,36 @@ options:
|
|||
description:
|
||||
- Whether to include dynamic values.
|
||||
- By default, they are not returned, and the C(dynamic) keys are omitted.
|
||||
- If set to C(true), they are returned as well, and the C(dynamic) keys are returned as well.
|
||||
- If set to V(true), they are returned as well, and the C(dynamic) keys are returned as well.
|
||||
type: bool
|
||||
default: false
|
||||
include_builtin:
|
||||
description:
|
||||
- Whether to include builtin values.
|
||||
- By default, they are not returned, and the C(builtin) keys are omitted.
|
||||
- If set to V(true), they are returned as well, and the C(builtin) keys are returned as well.
|
||||
type: bool
|
||||
default: false
|
||||
version_added: 2.4.0
|
||||
include_read_only:
|
||||
description:
|
||||
- Whether to include read-only fields.
|
||||
- By default, they are not returned.
|
||||
type: bool
|
||||
default: false
|
||||
version_added: 2.10.0
|
||||
restrict:
|
||||
description:
|
||||
- Restrict output to entries matching the following criteria.
|
||||
version_added: 2.18.0
|
||||
seealso:
|
||||
- module: community.routeros.api
|
||||
- module: community.routeros.api_facts
|
||||
- module: community.routeros.api_find_and_modify
|
||||
- module: community.routeros.api_modify
|
||||
'''
|
||||
"""
|
||||
|
||||
EXAMPLES = '''
|
||||
EXAMPLES = r"""
|
||||
---
|
||||
- name: Get IP addresses
|
||||
community.routeros.api_info:
|
||||
|
@ -176,26 +339,37 @@ EXAMPLES = '''
|
|||
- name: Print data for IP addresses
|
||||
ansible.builtin.debug:
|
||||
var: ip_addresses.result
|
||||
'''
|
||||
|
||||
RETURN = '''
|
||||
---
|
||||
- name: Get IP addresses
|
||||
community.routeros.api_info:
|
||||
hostname: "{{ hostname }}"
|
||||
password: "{{ password }}"
|
||||
username: "{{ username }}"
|
||||
path: ip address
|
||||
register: ip_addresses
|
||||
|
||||
- name: Print data for IP addresses
|
||||
ansible.builtin.debug:
|
||||
var: ip_addresses.result
|
||||
"""
|
||||
|
||||
RETURN = r"""
|
||||
result:
|
||||
description: A list of all elements for the current path.
|
||||
sample:
|
||||
- '.id': '*1'
|
||||
actual-interface: bridge
|
||||
address: "192.168.88.1/24"
|
||||
comment: defconf
|
||||
disabled: false
|
||||
dynamic: false
|
||||
interface: bridge
|
||||
invalid: false
|
||||
network: 192.168.88.0
|
||||
type: list
|
||||
elements: dict
|
||||
returned: always
|
||||
'''
|
||||
description: A list of all elements for the current path.
|
||||
sample:
|
||||
- '.id': '*1'
|
||||
actual-interface: bridge
|
||||
address: "192.168.88.1/24"
|
||||
comment: defconf
|
||||
disabled: false
|
||||
dynamic: false
|
||||
interface: bridge
|
||||
invalid: false
|
||||
network: 192.168.88.0
|
||||
type: list
|
||||
elements: dict
|
||||
returned: always
|
||||
"""
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.common.text.converters import to_native
|
||||
|
@ -204,6 +378,7 @@ from ansible_collections.community.routeros.plugins.module_utils.api import (
|
|||
api_argument_spec,
|
||||
check_has_library,
|
||||
create_api,
|
||||
get_api_version,
|
||||
)
|
||||
|
||||
from ansible_collections.community.routeros.plugins.module_utils._api_data import (
|
||||
|
@ -212,6 +387,12 @@ from ansible_collections.community.routeros.plugins.module_utils._api_data impor
|
|||
split_path,
|
||||
)
|
||||
|
||||
from ansible_collections.community.routeros.plugins.module_utils._api_helper import (
|
||||
restrict_argument_spec,
|
||||
restrict_entry_accepted,
|
||||
validate_and_prepare_restrict,
|
||||
)
|
||||
|
||||
try:
|
||||
from librouteros.exceptions import LibRouterosError
|
||||
except Exception:
|
||||
|
@ -233,8 +414,11 @@ def main():
|
|||
handle_disabled=dict(type='str', choices=['exclamation', 'null-value', 'omit'], default='exclamation'),
|
||||
hide_defaults=dict(type='bool', default=True),
|
||||
include_dynamic=dict(type='bool', default=False),
|
||||
include_builtin=dict(type='bool', default=False),
|
||||
include_read_only=dict(type='bool', default=False),
|
||||
)
|
||||
module_args.update(api_argument_spec())
|
||||
module_args.update(restrict_argument_spec())
|
||||
|
||||
module = AnsibleModule(
|
||||
argument_spec=module_args,
|
||||
|
@ -245,13 +429,25 @@ def main():
|
|||
api = create_api(module)
|
||||
|
||||
path = split_path(module.params['path'])
|
||||
path_info = PATHS.get(tuple(path))
|
||||
if path_info is None:
|
||||
versioned_path_info = PATHS.get(tuple(path))
|
||||
if versioned_path_info is None:
|
||||
module.fail_json(msg='Path /{path} is not yet supported'.format(path='/'.join(path)))
|
||||
if versioned_path_info.needs_version:
|
||||
api_version = get_api_version(api)
|
||||
supported, not_supported_msg = versioned_path_info.provide_version(api_version)
|
||||
if not supported:
|
||||
msg = 'Path /{path} is not supported for API version {api_version}'.format(path='/'.join(path), api_version=api_version)
|
||||
if not_supported_msg:
|
||||
msg = '{0}: {1}'.format(msg, not_supported_msg)
|
||||
module.fail_json(msg=msg)
|
||||
path_info = versioned_path_info.get_data()
|
||||
|
||||
handle_disabled = module.params['handle_disabled']
|
||||
hide_defaults = module.params['hide_defaults']
|
||||
include_dynamic = module.params['include_dynamic']
|
||||
include_builtin = module.params['include_builtin']
|
||||
include_read_only = module.params['include_read_only']
|
||||
restrict_data = validate_and_prepare_restrict(module, path_info)
|
||||
try:
|
||||
api_path = compose_api_path(api, path)
|
||||
|
||||
|
@ -261,24 +457,38 @@ def main():
|
|||
if not include_dynamic:
|
||||
if entry.get('dynamic', False):
|
||||
continue
|
||||
if not include_builtin:
|
||||
if entry.get('builtin', False):
|
||||
continue
|
||||
if not restrict_entry_accepted(entry, path_info, restrict_data):
|
||||
continue
|
||||
if not unfiltered:
|
||||
for k in list(entry):
|
||||
if k == '.id':
|
||||
continue
|
||||
if k == 'dynamic' and include_dynamic:
|
||||
continue
|
||||
if k == 'builtin' and include_builtin:
|
||||
continue
|
||||
if k not in path_info.fields:
|
||||
entry.pop(k)
|
||||
if handle_disabled != 'omit':
|
||||
for k in path_info.fields:
|
||||
for k, field_info in path_info.fields.items():
|
||||
if field_info.write_only:
|
||||
entry.pop(k, None)
|
||||
continue
|
||||
if k not in entry:
|
||||
if handle_disabled == 'exclamation':
|
||||
k = '!%s' % k
|
||||
entry[k] = None
|
||||
if hide_defaults:
|
||||
for k, field_info in path_info.fields.items():
|
||||
for k, field_info in path_info.fields.items():
|
||||
if hide_defaults:
|
||||
if field_info.default is not None and entry.get(k) == field_info.default:
|
||||
entry.pop(k)
|
||||
if field_info.absent_value and k not in entry:
|
||||
entry[k] = field_info.absent_value
|
||||
if not include_read_only and k in entry and field_info.read_only:
|
||||
entry.pop(k)
|
||||
result.append(entry)
|
||||
|
||||
module.exit_json(result=result)
|
||||
|
|
|
@ -8,8 +8,7 @@
|
|||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
DOCUMENTATION = r"""
|
||||
module: api_modify
|
||||
author:
|
||||
- "Felix Fontein (@felixfontein)"
|
||||
|
@ -17,116 +16,270 @@ short_description: Modify data at paths with API
|
|||
version_added: 2.2.0
|
||||
description:
|
||||
- Allows to modify information for a path using the API.
|
||||
- Use the M(community.routeros.api_find_and_modify) module to modify one or multiple entries in a controlled way
|
||||
depending on some search conditions.
|
||||
- Use the M(community.routeros.api_find_and_modify) module to modify one or multiple entries in a controlled way depending
|
||||
on some search conditions.
|
||||
- To make a backup of a path that can be restored with this module, use the M(community.routeros.api_info) module.
|
||||
- The module ignores dynamic entries.
|
||||
- B(Note) that this module is still heavily in development, and only supports B(some) paths.
|
||||
If you want to support new paths, or think you found problems with existing paths, please first
|
||||
L(create an issue in the community.routeros Issue Tracker,https://github.com/ansible-collections/community.routeros/issues/).
|
||||
- The module ignores dynamic and builtin entries.
|
||||
- B(Note) that this module is still heavily in development, and only supports B(some) paths. If you want to support new
|
||||
paths, or think you found problems with existing paths, please first L(create an issue in the community.routeros Issue
|
||||
Tracker,https://github.com/ansible-collections/community.routeros/issues/).
|
||||
notes:
|
||||
- Supports I(check_mode).
|
||||
- If write-only fields are present in the path, the module is B(not idempotent) in a strict sense, since it is not able
|
||||
to verify the current value of these fields. The behavior the module should assume can be controlled with the O(handle_write_only)
|
||||
option.
|
||||
requirements:
|
||||
- Needs L(ordereddict,https://pypi.org/project/ordereddict) for Python 2.6
|
||||
extends_documentation_fragment:
|
||||
- community.routeros.api
|
||||
- community.routeros.api.restrict
|
||||
- community.routeros.attributes
|
||||
- community.routeros.attributes.actiongroup_api
|
||||
attributes:
|
||||
check_mode:
|
||||
support: full
|
||||
diff_mode:
|
||||
support: full
|
||||
platform:
|
||||
support: full
|
||||
platforms: RouterOS
|
||||
idempotent:
|
||||
support: full
|
||||
options:
|
||||
path:
|
||||
description:
|
||||
- Path to query.
|
||||
- An example value is C(ip address). This is equivalent to running modification commands in C(/ip address) in the RouterOS CLI.
|
||||
- An example value is V(ip address). This is equivalent to running modification commands in C(/ip address) in the RouterOS
|
||||
CLI.
|
||||
required: true
|
||||
type: str
|
||||
choices:
|
||||
# BEGIN PATH LIST
|
||||
- caps-man aaa
|
||||
- certificate settings
|
||||
- interface bridge port
|
||||
- interface bridge port-controller
|
||||
- interface bridge port-extender
|
||||
- interface bridge settings
|
||||
- interface detect-internet
|
||||
- interface ethernet
|
||||
- interface ethernet switch
|
||||
- interface ethernet switch port
|
||||
- interface l2tp-server server
|
||||
- interface ovpn-server server
|
||||
- interface pptp-server server
|
||||
- interface sstp-server server
|
||||
- interface wireless align
|
||||
- interface wireless cap
|
||||
- interface wireless sniffer
|
||||
- interface wireless snooper
|
||||
- ip accounting
|
||||
- ip accounting web-access
|
||||
- ip address
|
||||
- ip cloud
|
||||
- ip cloud advanced
|
||||
- ip dhcp-client
|
||||
- ip dhcp-client option
|
||||
- ip dhcp-server
|
||||
- ip dhcp-server config
|
||||
- ip dhcp-server lease
|
||||
- ip dhcp-server network
|
||||
- ip dns
|
||||
- ip dns static
|
||||
- ip firewall address-list
|
||||
- ip firewall connection tracking
|
||||
- ip firewall filter
|
||||
- ip firewall nat
|
||||
- ip firewall service-port
|
||||
- ip hotspot service-port
|
||||
- ip ipsec settings
|
||||
- ip neighbor discovery-settings
|
||||
- ip pool
|
||||
- ip proxy
|
||||
- ip service
|
||||
- ip settings
|
||||
- ip smb
|
||||
- ip socks
|
||||
- ip ssh
|
||||
- ip tftp settings
|
||||
- ip traffic-flow
|
||||
- ip traffic-flow ipfix
|
||||
- ip upnp
|
||||
- ipv6 dhcp-client
|
||||
- ipv6 firewall address-list
|
||||
- ipv6 firewall filter
|
||||
- ipv6 nd prefix default
|
||||
- ipv6 settings
|
||||
- mpls
|
||||
- mpls ldp
|
||||
- port firmware
|
||||
- ppp aaa
|
||||
- queue interface
|
||||
- radius incoming
|
||||
- routing bgp instance
|
||||
- routing mme
|
||||
- routing rip
|
||||
- routing ripng
|
||||
- snmp
|
||||
- system clock
|
||||
- system clock manual
|
||||
- system identity
|
||||
- system leds settings
|
||||
- system note
|
||||
- system ntp client
|
||||
- system package update
|
||||
- system routerboard settings
|
||||
- system upgrade mirror
|
||||
- system watchdog
|
||||
- tool bandwidth-server
|
||||
- tool e-mail
|
||||
- tool graphing
|
||||
- tool mac-server
|
||||
- tool mac-server mac-winbox
|
||||
- tool mac-server ping
|
||||
- tool romon
|
||||
- tool sms
|
||||
- tool sniffer
|
||||
- tool traffic-generator
|
||||
- user aaa
|
||||
- user group
|
||||
- caps-man aaa
|
||||
- caps-man access-list
|
||||
- caps-man channel
|
||||
- caps-man configuration
|
||||
- caps-man datapath
|
||||
- caps-man manager
|
||||
- caps-man manager interface
|
||||
- caps-man provisioning
|
||||
- caps-man security
|
||||
- certificate settings
|
||||
- interface 6to4
|
||||
- interface bonding
|
||||
- interface bridge
|
||||
- interface bridge mlag
|
||||
- interface bridge port
|
||||
- interface bridge port-controller
|
||||
- interface bridge port-extender
|
||||
- interface bridge settings
|
||||
- interface bridge vlan
|
||||
- interface detect-internet
|
||||
- interface eoip
|
||||
- interface ethernet
|
||||
- interface ethernet poe
|
||||
- interface ethernet switch
|
||||
- interface ethernet switch port
|
||||
- interface ethernet switch port-isolation
|
||||
- interface gre
|
||||
- interface gre6
|
||||
- interface l2tp-client
|
||||
- interface l2tp-server server
|
||||
- interface list
|
||||
- interface list member
|
||||
- interface ovpn-client
|
||||
- interface ovpn-server server
|
||||
- interface ppp-client
|
||||
- interface pppoe-client
|
||||
- interface pppoe-server server
|
||||
- interface pptp-server server
|
||||
- interface sstp-server server
|
||||
- interface vlan
|
||||
- interface vrrp
|
||||
- interface wifi
|
||||
- interface wifi aaa
|
||||
- interface wifi access-list
|
||||
- interface wifi cap
|
||||
- interface wifi capsman
|
||||
- interface wifi channel
|
||||
- interface wifi configuration
|
||||
- interface wifi datapath
|
||||
- interface wifi interworking
|
||||
- interface wifi provisioning
|
||||
- interface wifi security
|
||||
- interface wifi steering
|
||||
- interface wifiwave2
|
||||
- interface wifiwave2 aaa
|
||||
- interface wifiwave2 access-list
|
||||
- interface wifiwave2 cap
|
||||
- interface wifiwave2 capsman
|
||||
- interface wifiwave2 channel
|
||||
- interface wifiwave2 configuration
|
||||
- interface wifiwave2 datapath
|
||||
- interface wifiwave2 interworking
|
||||
- interface wifiwave2 provisioning
|
||||
- interface wifiwave2 security
|
||||
- interface wifiwave2 steering
|
||||
- interface wireguard
|
||||
- interface wireguard peers
|
||||
- interface wireless
|
||||
- interface wireless access-list
|
||||
- interface wireless align
|
||||
- interface wireless cap
|
||||
- interface wireless connect-list
|
||||
- interface wireless security-profiles
|
||||
- interface wireless sniffer
|
||||
- interface wireless snooper
|
||||
- iot modbus
|
||||
- ip accounting
|
||||
- ip accounting web-access
|
||||
- ip address
|
||||
- ip arp
|
||||
- ip cloud
|
||||
- ip cloud advanced
|
||||
- ip dhcp-client
|
||||
- ip dhcp-client option
|
||||
- ip dhcp-relay
|
||||
- ip dhcp-server
|
||||
- ip dhcp-server config
|
||||
- ip dhcp-server lease
|
||||
- ip dhcp-server matcher
|
||||
- ip dhcp-server network
|
||||
- ip dhcp-server option
|
||||
- ip dhcp-server option sets
|
||||
- ip dns
|
||||
- ip dns adlist
|
||||
- ip dns forwarders
|
||||
- ip dns static
|
||||
- ip firewall address-list
|
||||
- ip firewall connection tracking
|
||||
- ip firewall filter
|
||||
- ip firewall layer7-protocol
|
||||
- ip firewall mangle
|
||||
- ip firewall nat
|
||||
- ip firewall raw
|
||||
- ip firewall service-port
|
||||
- ip hotspot service-port
|
||||
- ip ipsec identity
|
||||
- ip ipsec mode-config
|
||||
- ip ipsec peer
|
||||
- ip ipsec policy
|
||||
- ip ipsec profile
|
||||
- ip ipsec proposal
|
||||
- ip ipsec settings
|
||||
- ip neighbor discovery-settings
|
||||
- ip pool
|
||||
- ip proxy
|
||||
- ip route
|
||||
- ip route rule
|
||||
- ip route vrf
|
||||
- ip service
|
||||
- ip settings
|
||||
- ip smb
|
||||
- ip socks
|
||||
- ip ssh
|
||||
- ip tftp settings
|
||||
- ip traffic-flow
|
||||
- ip traffic-flow ipfix
|
||||
- ip traffic-flow target
|
||||
- ip upnp
|
||||
- ip upnp interfaces
|
||||
- ip vrf
|
||||
- ipv6 address
|
||||
- ipv6 dhcp-client
|
||||
- ipv6 dhcp-server
|
||||
- ipv6 dhcp-server option
|
||||
- ipv6 firewall address-list
|
||||
- ipv6 firewall filter
|
||||
- ipv6 firewall mangle
|
||||
- ipv6 firewall nat
|
||||
- ipv6 firewall raw
|
||||
- ipv6 nd
|
||||
- ipv6 nd prefix
|
||||
- ipv6 nd prefix default
|
||||
- ipv6 route
|
||||
- ipv6 settings
|
||||
- mpls
|
||||
- mpls interface
|
||||
- mpls ldp
|
||||
- mpls ldp accept-filter
|
||||
- mpls ldp advertise-filter
|
||||
- mpls ldp interface
|
||||
- port firmware
|
||||
- port remote-access
|
||||
- ppp aaa
|
||||
- ppp profile
|
||||
- ppp secret
|
||||
- queue interface
|
||||
- queue simple
|
||||
- queue tree
|
||||
- queue type
|
||||
- radius
|
||||
- radius incoming
|
||||
- routing bfd configuration
|
||||
- routing bgp aggregate
|
||||
- routing bgp connection
|
||||
- routing bgp instance
|
||||
- routing bgp network
|
||||
- routing bgp peer
|
||||
- routing bgp template
|
||||
- routing filter
|
||||
- routing filter community-list
|
||||
- routing filter num-list
|
||||
- routing filter rule
|
||||
- routing filter select-rule
|
||||
- routing id
|
||||
- routing igmp-proxy
|
||||
- routing igmp-proxy interface
|
||||
- routing mme
|
||||
- routing ospf area
|
||||
- routing ospf area range
|
||||
- routing ospf instance
|
||||
- routing ospf interface-template
|
||||
- routing ospf static-neighbor
|
||||
- routing pimsm instance
|
||||
- routing pimsm interface-template
|
||||
- routing rip
|
||||
- routing ripng
|
||||
- routing rule
|
||||
- routing table
|
||||
- snmp
|
||||
- snmp community
|
||||
- system clock
|
||||
- system clock manual
|
||||
- system health settings
|
||||
- system identity
|
||||
- system leds settings
|
||||
- system logging
|
||||
- system logging action
|
||||
- system note
|
||||
- system ntp client
|
||||
- system ntp client servers
|
||||
- system ntp server
|
||||
- system package update
|
||||
- system resource irq rps
|
||||
- system routerboard settings
|
||||
- system scheduler
|
||||
- system script
|
||||
- system upgrade mirror
|
||||
- system ups
|
||||
- system watchdog
|
||||
- tool bandwidth-server
|
||||
- tool e-mail
|
||||
- tool graphing
|
||||
- tool graphing interface
|
||||
- tool graphing resource
|
||||
- tool mac-server
|
||||
- tool mac-server mac-winbox
|
||||
- tool mac-server ping
|
||||
- tool netwatch
|
||||
- tool romon
|
||||
- tool sms
|
||||
- tool sniffer
|
||||
- tool traffic-generator
|
||||
- user
|
||||
- user aaa
|
||||
- user group
|
||||
- user settings
|
||||
# END PATH LIST
|
||||
data:
|
||||
description:
|
||||
|
@ -138,15 +291,15 @@ options:
|
|||
elements: dict
|
||||
ensure_order:
|
||||
description:
|
||||
- Whether to ensure the same order of the config as present in I(data).
|
||||
- Requires I(handle_absent_entries=remove).
|
||||
- Whether to ensure the same order of the config as present in O(data).
|
||||
- Requires O(handle_absent_entries=remove).
|
||||
type: bool
|
||||
default: false
|
||||
handle_absent_entries:
|
||||
description:
|
||||
- How to handle entries that are present in the current config, but not in I(data).
|
||||
- C(ignore) ignores them.
|
||||
- C(remove) removes them.
|
||||
- How to handle entries that are present in the current config, but not in O(data).
|
||||
- V(ignore) ignores them.
|
||||
- V(remove) removes them.
|
||||
type: str
|
||||
choices:
|
||||
- ignore
|
||||
|
@ -154,26 +307,62 @@ options:
|
|||
default: ignore
|
||||
handle_entries_content:
|
||||
description:
|
||||
- For a single entry in I(data), this describes how to handle fields that are not mentioned
|
||||
in that entry, but appear in the actual config.
|
||||
- If C(ignore), they are not modified.
|
||||
- If C(remove), they are removed. If at least one cannot be removed, the module will fail.
|
||||
- If C(remove_as_much_as_possible), all that can be removed will be removed. The ones that
|
||||
cannot be removed will be kept.
|
||||
- For a single entry in O(data), this describes how to handle fields that are not mentioned in that entry, but appear
|
||||
in the actual config.
|
||||
- If V(ignore), they are not modified.
|
||||
- If V(remove), they are removed. If at least one cannot be removed, the module will fail.
|
||||
- If V(remove_as_much_as_possible), all that can be removed will be removed. The ones that cannot be removed will be
|
||||
kept.
|
||||
- Note that V(remove) and V(remove_as_much_as_possible) do not apply to write-only fields.
|
||||
type: str
|
||||
choices:
|
||||
- ignore
|
||||
- remove
|
||||
- remove_as_much_as_possible
|
||||
default: ignore
|
||||
handle_read_only:
|
||||
description:
|
||||
- How to handle values passed in for read-only fields.
|
||||
- If V(ignore), they are not passed to the API.
|
||||
- If V(validate), the values are not passed for creation, and for updating they are compared to the value returned for
|
||||
the object. If they differ, the module fails.
|
||||
- If V(error), the module will fail if read-only fields are provided.
|
||||
type: str
|
||||
choices:
|
||||
- ignore
|
||||
- validate
|
||||
- error
|
||||
default: error
|
||||
version_added: 2.10.0
|
||||
handle_write_only:
|
||||
description:
|
||||
- How to handle values passed in for write-only fields.
|
||||
- If V(create_only), they are passed on creation, and ignored for updating.
|
||||
- If V(always_update), they are always passed to the API. This means that if such a value is present, the module will
|
||||
always result in C(changed) since there is no way to validate whether the value actually changed.
|
||||
- If V(error), the module will fail if write-only fields are provided.
|
||||
type: str
|
||||
choices:
|
||||
- create_only
|
||||
- always_update
|
||||
- error
|
||||
default: create_only
|
||||
version_added: 2.10.0
|
||||
restrict:
|
||||
description:
|
||||
- Restrict operation to entries matching the following criteria.
|
||||
- This can be useful together with O(handle_absent_entries=remove) to operate on a subset of the values.
|
||||
- For example, for O(path=ip firewall filter), you can set O(restrict[].field=chain) and O(restrict[].values=input)
|
||||
to restrict operation to the input chain, and ignore the forward and output chains.
|
||||
version_added: 2.18.0
|
||||
seealso:
|
||||
- module: community.routeros.api
|
||||
- module: community.routeros.api_facts
|
||||
- module: community.routeros.api_find_and_modify
|
||||
- module: community.routeros.api_info
|
||||
'''
|
||||
"""
|
||||
|
||||
EXAMPLES = '''
|
||||
EXAMPLES = r"""
|
||||
---
|
||||
- name: Setup DHCP server networks
|
||||
# Ensures that we have exactly two DHCP server networks (in the specified order)
|
||||
|
@ -211,43 +400,59 @@ EXAMPLES = '''
|
|||
out-interface:
|
||||
to-addresses: ~
|
||||
'!to-ports':
|
||||
'''
|
||||
|
||||
RETURN = '''
|
||||
---
|
||||
- name: Block all incoming connections
|
||||
community.routeros.api_modify:
|
||||
hostname: "{{ hostname }}"
|
||||
password: "{{ password }}"
|
||||
username: "{{ username }}"
|
||||
path: ip firewall filter
|
||||
handle_absent_entries: remove
|
||||
handle_entries_content: remove_as_much_as_possible
|
||||
restrict:
|
||||
# Do not touch any chain except the input chain
|
||||
- field: chain
|
||||
values:
|
||||
- input
|
||||
data:
|
||||
- action: drop
|
||||
chain: input
|
||||
"""
|
||||
|
||||
RETURN = r"""
|
||||
old_data:
|
||||
description:
|
||||
- A list of all elements for the current path before a change was made.
|
||||
sample:
|
||||
- '.id': '*1'
|
||||
actual-interface: bridge
|
||||
address: "192.168.88.1/24"
|
||||
comment: defconf
|
||||
disabled: false
|
||||
dynamic: false
|
||||
interface: bridge
|
||||
invalid: false
|
||||
network: 192.168.88.0
|
||||
type: list
|
||||
elements: dict
|
||||
returned: always
|
||||
description:
|
||||
- A list of all elements for the current path before a change was made.
|
||||
sample:
|
||||
- '.id': '*1'
|
||||
actual-interface: bridge
|
||||
address: "192.168.88.1/24"
|
||||
comment: defconf
|
||||
disabled: false
|
||||
dynamic: false
|
||||
interface: bridge
|
||||
invalid: false
|
||||
network: 192.168.88.0
|
||||
type: list
|
||||
elements: dict
|
||||
returned: always
|
||||
new_data:
|
||||
description:
|
||||
- A list of all elements for the current path after a change was made.
|
||||
sample:
|
||||
- '.id': '*1'
|
||||
actual-interface: bridge
|
||||
address: "192.168.1.1/24"
|
||||
comment: awesome
|
||||
disabled: false
|
||||
dynamic: false
|
||||
interface: bridge
|
||||
invalid: false
|
||||
network: 192.168.1.0
|
||||
type: list
|
||||
elements: dict
|
||||
returned: always
|
||||
'''
|
||||
description:
|
||||
- A list of all elements for the current path after a change was made.
|
||||
sample:
|
||||
- '.id': '*1'
|
||||
actual-interface: bridge
|
||||
address: "192.168.1.1/24"
|
||||
comment: awesome
|
||||
disabled: false
|
||||
dynamic: false
|
||||
interface: bridge
|
||||
invalid: false
|
||||
network: 192.168.1.0
|
||||
type: list
|
||||
elements: dict
|
||||
returned: always
|
||||
"""
|
||||
|
||||
from collections import defaultdict
|
||||
|
||||
|
@ -258,6 +463,7 @@ from ansible_collections.community.routeros.plugins.module_utils.api import (
|
|||
api_argument_spec,
|
||||
check_has_library,
|
||||
create_api,
|
||||
get_api_version,
|
||||
)
|
||||
|
||||
from ansible_collections.community.routeros.plugins.module_utils._api_data import (
|
||||
|
@ -266,6 +472,12 @@ from ansible_collections.community.routeros.plugins.module_utils._api_data impor
|
|||
split_path,
|
||||
)
|
||||
|
||||
from ansible_collections.community.routeros.plugins.module_utils._api_helper import (
|
||||
restrict_argument_spec,
|
||||
restrict_entry_accepted,
|
||||
validate_and_prepare_restrict,
|
||||
)
|
||||
|
||||
HAS_ORDEREDDICT = True
|
||||
try:
|
||||
from collections import OrderedDict
|
||||
|
@ -309,8 +521,20 @@ def find_modifications(old_entry, new_entry, path_info, module, for_text='', ret
|
|||
modifications['!%s' % disabled_k] = ''
|
||||
del updated_entry[disabled_k]
|
||||
continue
|
||||
if k not in old_entry and path_info.fields[k].default == v:
|
||||
if k not in old_entry and path_info.fields[k].default == v and not path_info.fields[k].can_disable:
|
||||
continue
|
||||
key_info = path_info.fields[k]
|
||||
if key_info.read_only:
|
||||
# handle_read_only must be 'validate'
|
||||
if old_entry.get(k) != v:
|
||||
module.fail_json(
|
||||
msg='Read-only key "{key}" has value "{old_value}", but should have new value "{new_value}"{for_text}.'.format(
|
||||
key=k, old_value=old_entry.get(k), new_value=v, for_text=for_text))
|
||||
continue
|
||||
if key_info.write_only:
|
||||
if module.params['handle_write_only'] == 'create_only':
|
||||
# do not update this value
|
||||
continue
|
||||
if k not in old_entry or old_entry[k] != v:
|
||||
modifications[k] = v
|
||||
updated_entry[k] = v
|
||||
|
@ -325,7 +549,9 @@ def find_modifications(old_entry, new_entry, path_info, module, for_text='', ret
|
|||
if field_info.remove_value is not None and field_info.remove_value == old_entry[k]:
|
||||
continue
|
||||
if field_info.can_disable:
|
||||
if field_info.remove_value is not None:
|
||||
if field_info.default is not None:
|
||||
modifications[k] = field_info.default
|
||||
elif field_info.remove_value is not None:
|
||||
modifications[k] = field_info.remove_value
|
||||
else:
|
||||
modifications['!%s' % k] = ''
|
||||
|
@ -337,6 +563,11 @@ def find_modifications(old_entry, new_entry, path_info, module, for_text='', ret
|
|||
if return_none_instead_of_fail:
|
||||
return None, None
|
||||
module.fail_json(msg='Key "{key}" cannot be removed{for_text}.'.format(key=k, for_text=for_text))
|
||||
for k in path_info.fields:
|
||||
field_info = path_info.fields[k]
|
||||
if k not in old_entry and k not in new_entry and field_info.can_disable and field_info.default is not None:
|
||||
modifications[k] = field_info.default
|
||||
updated_entry[k] = field_info.default
|
||||
return modifications, updated_entry
|
||||
|
||||
|
||||
|
@ -372,6 +603,18 @@ def essentially_same_weight(old_entry, new_entry, path_info, module):
|
|||
return weight
|
||||
|
||||
|
||||
def remove_read_only(entry, path_info):
|
||||
to_remove = []
|
||||
for real_k, v in entry.items():
|
||||
k = real_k
|
||||
if k.startswith('!'):
|
||||
k = k[1:]
|
||||
if path_info.fields[k].read_only:
|
||||
to_remove.append(real_k)
|
||||
for k in to_remove:
|
||||
entry.pop(k)
|
||||
|
||||
|
||||
def format_pk(primary_keys, values):
|
||||
return ', '.join('{pk}="{value}"'.format(pk=pk, value=value) for pk, value in zip(primary_keys, values))
|
||||
|
||||
|
@ -379,6 +622,7 @@ def format_pk(primary_keys, values):
|
|||
def polish_entry(entry, path_info, module, for_text):
|
||||
if '.id' in entry:
|
||||
entry.pop('.id')
|
||||
to_remove = []
|
||||
for key, value in entry.items():
|
||||
real_key = key
|
||||
disabled_key = False
|
||||
|
@ -398,9 +642,37 @@ def polish_entry(entry, path_info, module, for_text):
|
|||
elif value is None:
|
||||
if not key_info.can_disable:
|
||||
module.fail_json(msg='Key "{key}" must not be disabled (value null/~/None){for_text}.'.format(key=key, for_text=for_text))
|
||||
if key_info.read_only:
|
||||
if module.params['handle_read_only'] == 'error':
|
||||
module.fail_json(msg='Key "{key}" is read-only{for_text}, and handle_read_only=error.'.format(key=key, for_text=for_text))
|
||||
if module.params['handle_read_only'] == 'ignore':
|
||||
to_remove.append(real_key)
|
||||
if key_info.write_only:
|
||||
if module.params['handle_write_only'] == 'error':
|
||||
module.fail_json(msg='Key "{key}" is write-only{for_text}, and handle_write_only=error.'.format(key=key, for_text=for_text))
|
||||
for key in to_remove:
|
||||
entry.pop(key)
|
||||
for key, field_info in path_info.fields.items():
|
||||
if field_info.required and key not in entry:
|
||||
module.fail_json(msg='Key "{key}" must be present{for_text}.'.format(key=key, for_text=for_text))
|
||||
for require_list in path_info.required_one_of:
|
||||
found_req_keys = [rk for rk in require_list if rk in entry]
|
||||
if len(require_list) > 0 and not found_req_keys:
|
||||
module.fail_json(
|
||||
msg='Every element in data must contain one of {required_keys}. For example, the element{for_text} does not provide it.'.format(
|
||||
required_keys=', '.join(['"{k}"'.format(k=k) for k in require_list]),
|
||||
for_text=for_text,
|
||||
)
|
||||
)
|
||||
for exclusive_list in path_info.mutually_exclusive:
|
||||
found_ex_keys = [ek for ek in exclusive_list if ek in entry]
|
||||
if len(found_ex_keys) > 1:
|
||||
module.fail_json(
|
||||
msg='Keys {exclusive_keys} cannot be used at the same time{for_text}.'.format(
|
||||
exclusive_keys=', '.join(['"{k}"'.format(k=k) for k in found_ex_keys]),
|
||||
for_text=for_text,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def remove_irrelevant_data(entry, path_info):
|
||||
|
@ -440,24 +712,60 @@ def match_entries(new_entries, old_entries, path_info, module):
|
|||
def remove_dynamic(entries):
|
||||
result = []
|
||||
for entry in entries:
|
||||
if entry.get('dynamic', False):
|
||||
if entry.get('dynamic', False) or entry.get('builtin', False):
|
||||
continue
|
||||
result.append(entry)
|
||||
return result
|
||||
|
||||
|
||||
def sync_list(module, api, path, path_info):
|
||||
def get_api_data(api_path, path_info):
|
||||
entries = list(api_path)
|
||||
for entry in entries:
|
||||
for k, field_info in path_info.fields.items():
|
||||
if field_info.absent_value is not None and k not in entry:
|
||||
entry[k] = field_info.absent_value
|
||||
return entries
|
||||
|
||||
|
||||
def prepare_for_add(entry, path_info):
|
||||
new_entry = {}
|
||||
for k, v in entry.items():
|
||||
if k.startswith('!'):
|
||||
real_k = k[1:]
|
||||
remove_value = path_info.fields[real_k].remove_value
|
||||
if remove_value is not None:
|
||||
k = real_k
|
||||
v = remove_value
|
||||
else:
|
||||
if v is None:
|
||||
v = path_info.fields[k].remove_value
|
||||
new_entry[k] = v
|
||||
return new_entry
|
||||
|
||||
|
||||
def remove_rejected(data, path_info, restrict_data):
|
||||
return [
|
||||
entry for entry in data
|
||||
if restrict_entry_accepted(entry, path_info, restrict_data)
|
||||
]
|
||||
|
||||
|
||||
def sync_list(module, api, path, path_info, restrict_data):
|
||||
handle_absent_entries = module.params['handle_absent_entries']
|
||||
handle_entries_content = module.params['handle_entries_content']
|
||||
if handle_absent_entries == 'remove':
|
||||
if handle_entries_content == 'ignore':
|
||||
module.fail_json('For this path, handle_absent_entries=remove cannot be combined with handle_entries_content=ignore')
|
||||
module.fail_json(
|
||||
msg='For this path, handle_absent_entries=remove cannot be combined with handle_entries_content=ignore'
|
||||
)
|
||||
|
||||
stratify_keys = path_info.stratify_keys or ()
|
||||
|
||||
data = module.params['data']
|
||||
stratified_data = defaultdict(list)
|
||||
for index, entry in enumerate(data):
|
||||
if not restrict_entry_accepted(entry, path_info, restrict_data):
|
||||
module.fail_json(msg='The element at index #{index} does not match `restrict`'.format(index=index + 1))
|
||||
for stratify_key in stratify_keys:
|
||||
if stratify_key not in entry:
|
||||
module.fail_json(
|
||||
|
@ -476,8 +784,9 @@ def sync_list(module, api, path, path_info):
|
|||
|
||||
api_path = compose_api_path(api, path)
|
||||
|
||||
old_data = list(api_path)
|
||||
old_data = get_api_data(api_path, path_info)
|
||||
old_data = remove_dynamic(old_data)
|
||||
old_data = remove_rejected(old_data, path_info, restrict_data)
|
||||
stratified_old_data = defaultdict(list)
|
||||
for index, entry in enumerate(old_data):
|
||||
sks = tuple(entry[stratify_key] for stratify_key in stratify_keys)
|
||||
|
@ -510,6 +819,7 @@ def sync_list(module, api, path, path_info):
|
|||
new_data.append((old_index, updated_entry))
|
||||
new_entry['.id'] = old_entry['.id']
|
||||
else:
|
||||
remove_read_only(new_entry, path_info)
|
||||
create_list.append(new_entry)
|
||||
|
||||
if handle_absent_entries == 'remove':
|
||||
|
@ -565,7 +875,7 @@ def sync_list(module, api, path, path_info):
|
|||
)
|
||||
for entry in create_list:
|
||||
try:
|
||||
entry['.id'] = api_path.add(**entry)
|
||||
entry['.id'] = api_path.add(**prepare_for_add(entry, path_info))
|
||||
except (LibRouterosError, UnicodeEncodeError) as e:
|
||||
module.fail_json(
|
||||
msg='Error while creating entry: {error}'.format(
|
||||
|
@ -588,7 +898,8 @@ def sync_list(module, api, path, path_info):
|
|||
|
||||
# For sake of completeness, retrieve the full new data:
|
||||
if modify_list or create_list or reorder_list:
|
||||
new_data = remove_dynamic(list(api_path))
|
||||
new_data = remove_dynamic(get_api_data(api_path, path_info))
|
||||
new_data = remove_rejected(new_data, path_info, restrict_data)
|
||||
|
||||
# Remove 'irrelevant' data
|
||||
for entry in old_data:
|
||||
|
@ -615,7 +926,7 @@ def sync_list(module, api, path, path_info):
|
|||
)
|
||||
|
||||
|
||||
def sync_with_primary_keys(module, api, path, path_info):
|
||||
def sync_with_primary_keys(module, api, path, path_info, restrict_data):
|
||||
primary_keys = path_info.primary_keys
|
||||
|
||||
if path_info.fixed_entries:
|
||||
|
@ -627,6 +938,8 @@ def sync_with_primary_keys(module, api, path, path_info):
|
|||
data = module.params['data']
|
||||
new_data_by_key = OrderedDict()
|
||||
for index, entry in enumerate(data):
|
||||
if not restrict_entry_accepted(entry, path_info, restrict_data):
|
||||
module.fail_json(msg='The element at index #{index} does not match `restrict`'.format(index=index + 1))
|
||||
for primary_key in primary_keys:
|
||||
if primary_key not in entry:
|
||||
module.fail_json(
|
||||
|
@ -656,8 +969,9 @@ def sync_with_primary_keys(module, api, path, path_info):
|
|||
|
||||
api_path = compose_api_path(api, path)
|
||||
|
||||
old_data = list(api_path)
|
||||
old_data = get_api_data(api_path, path_info)
|
||||
old_data = remove_dynamic(old_data)
|
||||
old_data = remove_rejected(old_data, path_info, restrict_data)
|
||||
old_data_by_key = OrderedDict()
|
||||
id_by_key = {}
|
||||
for entry in old_data:
|
||||
|
@ -702,6 +1016,7 @@ def sync_with_primary_keys(module, api, path, path_info):
|
|||
for primary_key in primary_keys
|
||||
]),
|
||||
))
|
||||
remove_read_only(new_entry, path_info)
|
||||
create_list.append(new_entry)
|
||||
new_entry = new_entry.copy()
|
||||
for key in list(new_entry):
|
||||
|
@ -754,7 +1069,7 @@ def sync_with_primary_keys(module, api, path, path_info):
|
|||
)
|
||||
for entry in create_list:
|
||||
try:
|
||||
entry['.id'] = api_path.add(**entry)
|
||||
entry['.id'] = api_path.add(**prepare_for_add(entry, path_info))
|
||||
# Store ID for primary keys
|
||||
pks = tuple(entry[primary_key] for primary_key in primary_keys)
|
||||
id_by_key[pks] = entry['.id']
|
||||
|
@ -782,7 +1097,8 @@ def sync_with_primary_keys(module, api, path, path_info):
|
|||
|
||||
# For sake of completeness, retrieve the full new data:
|
||||
if modify_list or create_list or reorder_list:
|
||||
new_data = remove_dynamic(list(api_path))
|
||||
new_data = remove_dynamic(get_api_data(api_path, path_info))
|
||||
new_data = remove_rejected(new_data, path_info, restrict_data)
|
||||
|
||||
# Remove 'irrelevant' data
|
||||
for entry in old_data:
|
||||
|
@ -809,7 +1125,9 @@ def sync_with_primary_keys(module, api, path, path_info):
|
|||
)
|
||||
|
||||
|
||||
def sync_single_value(module, api, path, path_info):
|
||||
def sync_single_value(module, api, path, path_info, restrict_data):
|
||||
if module.params['restrict'] is not None:
|
||||
module.fail_json(msg='The restrict option cannot be used with this path, since there is precisely one entry.')
|
||||
data = module.params['data']
|
||||
if len(data) != 1:
|
||||
module.fail_json(msg='Data must be a list with exactly one element.')
|
||||
|
@ -818,7 +1136,7 @@ def sync_single_value(module, api, path, path_info):
|
|||
|
||||
api_path = compose_api_path(api, path)
|
||||
|
||||
old_data = list(api_path)
|
||||
old_data = get_api_data(api_path, path_info)
|
||||
if len(old_data) != 1:
|
||||
module.fail_json(
|
||||
msg='Internal error: retrieving /{path} resulted in {count} elements. Expected exactly 1.'.format(
|
||||
|
@ -839,7 +1157,7 @@ def sync_single_value(module, api, path, path_info):
|
|||
except (LibRouterosError, UnicodeEncodeError) as e:
|
||||
module.fail_json(msg='Error while modifying: {error}'.format(error=to_native(e)))
|
||||
# Retrieve latest version
|
||||
new_data = list(api_path)
|
||||
new_data = get_api_data(api_path, path_info)
|
||||
if len(new_data) == 1:
|
||||
updated_entry = new_data[0]
|
||||
|
||||
|
@ -880,16 +1198,34 @@ def get_backend(path_info):
|
|||
return None
|
||||
|
||||
|
||||
def has_backend(versioned_path_info):
|
||||
if not versioned_path_info.fully_understood:
|
||||
return False
|
||||
|
||||
if versioned_path_info.unversioned is not None:
|
||||
return get_backend(versioned_path_info.unversioned) is not None
|
||||
|
||||
if versioned_path_info.versioned is not None:
|
||||
for dummy, dummy, unversioned in versioned_path_info.versioned:
|
||||
if unversioned and not isinstance(unversioned, str) and get_backend(unversioned) is not None:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def main():
|
||||
path_choices = sorted([join_path(path) for path, path_info in PATHS.items() if get_backend(path_info) is not None])
|
||||
path_choices = sorted([join_path(path) for path, versioned_path_info in PATHS.items() if has_backend(versioned_path_info)])
|
||||
module_args = dict(
|
||||
path=dict(type='str', required=True, choices=path_choices),
|
||||
data=dict(type='list', elements='dict', required=True),
|
||||
handle_absent_entries=dict(type='str', choices=['ignore', 'remove'], default='ignore'),
|
||||
handle_entries_content=dict(type='str', choices=['ignore', 'remove', 'remove_as_much_as_possible'], default='ignore'),
|
||||
ensure_order=dict(type='bool', default=False),
|
||||
handle_read_only=dict(type='str', default='error', choices=['ignore', 'validate', 'error']),
|
||||
handle_write_only=dict(type='str', default='create_only', choices=['create_only', 'always_update', 'error']),
|
||||
)
|
||||
module_args.update(api_argument_spec())
|
||||
module_args.update(restrict_argument_spec())
|
||||
|
||||
module = AnsibleModule(
|
||||
argument_spec=module_args,
|
||||
|
@ -906,12 +1242,24 @@ def main():
|
|||
api = create_api(module)
|
||||
|
||||
path = split_path(module.params['path'])
|
||||
path_info = PATHS.get(tuple(path))
|
||||
versioned_path_info = PATHS.get(tuple(path))
|
||||
if versioned_path_info.needs_version:
|
||||
api_version = get_api_version(api)
|
||||
supported, not_supported_msg = versioned_path_info.provide_version(api_version)
|
||||
if not supported:
|
||||
msg = 'Path /{path} is not supported for API version {api_version}'.format(path='/'.join(path), api_version=api_version)
|
||||
if not_supported_msg:
|
||||
msg = '{0}: {1}'.format(msg, not_supported_msg)
|
||||
module.fail_json(msg=msg)
|
||||
path_info = versioned_path_info.get_data()
|
||||
|
||||
backend = get_backend(path_info)
|
||||
if path_info is None or backend is None:
|
||||
module.fail_json(msg='Path /{path} is not yet supported'.format(path='/'.join(path)))
|
||||
|
||||
backend(module, api, path, path_info)
|
||||
restrict_data = validate_and_prepare_restrict(module, path_info)
|
||||
|
||||
backend(module, api, path, path_info, restrict_data)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -7,74 +7,77 @@
|
|||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
DOCUMENTATION = r"""
|
||||
module: command
|
||||
author: "Egor Zaitsev (@heuels)"
|
||||
short_description: Run commands on remote devices running MikroTik RouterOS
|
||||
description:
|
||||
- Sends arbitrary commands to an RouterOS 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.
|
||||
- The module always indicates a (changed) status. You can use
|
||||
R(the changed_when task property,override_the_changed_result) to determine
|
||||
whether a command task actually resulted in a change or not.
|
||||
- Sends arbitrary commands to an RouterOS 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.
|
||||
- The module always indicates a (changed) status. You can use R(the changed_when task property,override_the_changed_result)
|
||||
to determine whether a command task actually resulted in a change or not.
|
||||
extends_documentation_fragment:
|
||||
- community.routeros.attributes
|
||||
attributes:
|
||||
check_mode:
|
||||
support: none
|
||||
details:
|
||||
- Before community.routeros 3.0.0, the module claimed to support check mode. It simply executed the command in check
|
||||
mode.
|
||||
diff_mode:
|
||||
support: none
|
||||
platform:
|
||||
support: full
|
||||
platforms: RouterOS
|
||||
idempotent:
|
||||
support: N/A
|
||||
details:
|
||||
- Whether the executed command is idempotent depends on the command.
|
||||
options:
|
||||
commands:
|
||||
description:
|
||||
- List of commands to send to the remote RouterOS 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.
|
||||
- List of commands to send to the remote RouterOS device over the configured provider. The resulting output from the
|
||||
command is returned. If the O(wait_for) argument is provided, the module is not returned until the condition is satisfied
|
||||
or the number of retries has expired.
|
||||
required: true
|
||||
type: list
|
||||
elements: str
|
||||
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.
|
||||
- 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.
|
||||
type: list
|
||||
elements: str
|
||||
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.
|
||||
- The O(match) argument is used in conjunction with the O(wait_for) argument to specify the match policy. Valid values
|
||||
are V(all) or V(any). If the value is set to V(all) then all conditionals in the wait_for must be satisfied. If the
|
||||
value is set to V(any) then only one of the values must be satisfied.
|
||||
default: all
|
||||
choices: ['any', 'all']
|
||||
type: str
|
||||
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.
|
||||
- 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 O(wait_for) conditions.
|
||||
default: 10
|
||||
type: int
|
||||
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.
|
||||
- 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
|
||||
type: int
|
||||
seealso:
|
||||
- ref: ansible_collections.community.routeros.docsite.ssh-guide
|
||||
description: How to connect to RouterOS devices with SSH
|
||||
description: How to connect to RouterOS devices with SSH.
|
||||
- ref: ansible_collections.community.routeros.docsite.quoting
|
||||
description: How to quote and unquote commands and arguments
|
||||
'''
|
||||
description: How to quote and unquote commands and arguments.
|
||||
"""
|
||||
|
||||
EXAMPLES = """
|
||||
EXAMPLES = r"""
|
||||
---
|
||||
- name: Run command on remote devices
|
||||
community.routeros.command:
|
||||
commands: /system routerboard print
|
||||
|
@ -100,31 +103,29 @@ EXAMPLES = """
|
|||
- result[1] contains ether1
|
||||
"""
|
||||
|
||||
RETURN = """
|
||||
RETURN = r"""
|
||||
stdout:
|
||||
description: The set of responses from the commands
|
||||
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
|
||||
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
|
||||
description: The list of conditionals that have failed.
|
||||
returned: failed
|
||||
type: list
|
||||
sample: ['...', '...']
|
||||
"""
|
||||
|
||||
import re
|
||||
import time
|
||||
|
||||
from ansible_collections.community.routeros.plugins.module_utils.routeros import run_commands
|
||||
from ansible_collections.community.routeros.plugins.module_utils.routeros import routeros_argument_spec
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ComplexList
|
||||
from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.parsing import Conditional
|
||||
from ansible.module_utils.six import string_types
|
||||
|
||||
|
@ -152,7 +153,7 @@ def main():
|
|||
argument_spec.update(routeros_argument_spec)
|
||||
|
||||
module = AnsibleModule(argument_spec=argument_spec,
|
||||
supports_check_mode=True)
|
||||
supports_check_mode=False)
|
||||
|
||||
result = {'changed': False}
|
||||
|
||||
|
|
|
@ -7,36 +7,42 @@
|
|||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
DOCUMENTATION = r"""
|
||||
module: facts
|
||||
author: "Egor Zaitsev (@heuels)"
|
||||
short_description: Collect facts from remote devices running MikroTik RouterOS
|
||||
description:
|
||||
- Collects a base set of device facts from a remote device that
|
||||
is running RouterOS. This module prepends all of the
|
||||
base network fact keys with C(ansible_net_<fact>). The facts
|
||||
module will always collect a base set of facts from the device
|
||||
- Collects a base set of device facts from a remote device that is running RouterOS. This module prepends all of the base
|
||||
network fact keys with C(ansible_net_<fact>). The facts module will always collect a base set of facts from the device
|
||||
and can enable or disable collection of additional facts.
|
||||
extends_documentation_fragment:
|
||||
- community.routeros.attributes
|
||||
- community.routeros.attributes.facts
|
||||
- community.routeros.attributes.facts_module
|
||||
- community.routeros.attributes.idempotent_not_modify_state
|
||||
attributes:
|
||||
platform:
|
||||
support: full
|
||||
platforms: RouterOS
|
||||
options:
|
||||
gather_subset:
|
||||
description:
|
||||
- When supplied, this argument will restrict the facts collected
|
||||
to a given subset. Possible values for this argument include
|
||||
C(all), C(hardware), C(config), C(interfaces), and C(routing).
|
||||
- Can specify a list of values to include a larger subset.
|
||||
Values can also be used with an initial C(!) to specify that a
|
||||
specific subset should not be collected.
|
||||
- When supplied, this argument will restrict the facts collected to a given subset. Possible values for this argument
|
||||
include V(all), V(hardware), V(config), V(interfaces), and V(routing).
|
||||
- Can specify a list of values to include a larger subset. Values can also be used with an initial V(!) to specify that
|
||||
a specific subset should not be collected.
|
||||
required: false
|
||||
default: '!config'
|
||||
default:
|
||||
- '!config'
|
||||
type: list
|
||||
elements: str
|
||||
seealso:
|
||||
- ref: ansible_collections.community.routeros.docsite.ssh-guide
|
||||
description: How to connect to RouterOS devices with SSH
|
||||
'''
|
||||
description: How to connect to RouterOS devices with SSH.
|
||||
"""
|
||||
|
||||
EXAMPLES = """
|
||||
EXAMPLES = r"""
|
||||
---
|
||||
- name: Collect all facts from the device
|
||||
community.routeros.facts:
|
||||
gather_subset: all
|
||||
|
@ -52,7 +58,7 @@ EXAMPLES = """
|
|||
- "!hardware"
|
||||
"""
|
||||
|
||||
RETURN = """
|
||||
RETURN = r"""
|
||||
ansible_facts:
|
||||
description: "Dictionary of IP geolocation facts for a host's IP address."
|
||||
returned: always
|
||||
|
@ -66,109 +72,109 @@ ansible_facts:
|
|||
# default
|
||||
ansible_net_model:
|
||||
description: The model name returned from the device.
|
||||
returned: I(gather_subset) contains C(default)
|
||||
returned: O(gather_subset) contains V(default)
|
||||
type: str
|
||||
ansible_net_serialnum:
|
||||
description: The serial number of the remote device.
|
||||
returned: I(gather_subset) contains C(default)
|
||||
returned: O(gather_subset) contains V(default)
|
||||
type: str
|
||||
ansible_net_version:
|
||||
description: The operating system version running on the remote device.
|
||||
returned: I(gather_subset) contains C(default)
|
||||
returned: O(gather_subset) contains V(default)
|
||||
type: str
|
||||
ansible_net_hostname:
|
||||
description: The configured hostname of the device.
|
||||
returned: I(gather_subset) contains C(default)
|
||||
returned: O(gather_subset) contains V(default)
|
||||
type: str
|
||||
ansible_net_arch:
|
||||
description: The CPU architecture of the device.
|
||||
returned: I(gather_subset) contains C(default)
|
||||
returned: O(gather_subset) contains V(default)
|
||||
type: str
|
||||
ansible_net_uptime:
|
||||
description: The uptime of the device.
|
||||
returned: I(gather_subset) contains C(default)
|
||||
returned: O(gather_subset) contains V(default)
|
||||
type: str
|
||||
ansible_net_cpu_load:
|
||||
description: Current CPU load.
|
||||
returned: I(gather_subset) contains C(default)
|
||||
returned: O(gather_subset) contains V(default)
|
||||
type: str
|
||||
|
||||
# hardware
|
||||
ansible_net_spacefree_mb:
|
||||
description: The available disk space on the remote device in MiB.
|
||||
returned: I(gather_subset) contains C(hardware)
|
||||
returned: O(gather_subset) contains V(hardware)
|
||||
type: dict
|
||||
ansible_net_spacetotal_mb:
|
||||
description: The total disk space on the remote device in MiB.
|
||||
returned: I(gather_subset) contains C(hardware)
|
||||
returned: O(gather_subset) contains V(hardware)
|
||||
type: dict
|
||||
ansible_net_memfree_mb:
|
||||
description: The available free memory on the remote device in MiB.
|
||||
returned: I(gather_subset) contains C(hardware)
|
||||
returned: O(gather_subset) contains V(hardware)
|
||||
type: int
|
||||
ansible_net_memtotal_mb:
|
||||
description: The total memory on the remote device in MiB.
|
||||
returned: I(gather_subset) contains C(hardware)
|
||||
returned: O(gather_subset) contains V(hardware)
|
||||
type: int
|
||||
|
||||
# config
|
||||
ansible_net_config:
|
||||
description: The current active config from the device.
|
||||
returned: I(gather_subset) contains C(config)
|
||||
returned: O(gather_subset) contains V(config)
|
||||
type: str
|
||||
|
||||
ansible_net_config_nonverbose:
|
||||
description:
|
||||
- The current active config from the device in minimal form.
|
||||
- This value is idempotent in the sense that if the facts module is run twice and the device's config
|
||||
was not changed between the runs, the value is identical. This is achieved by running C(/export)
|
||||
and stripping the timestamp from the comment in the first line.
|
||||
returned: I(gather_subset) contains C(config)
|
||||
- This value is idempotent in the sense that if the facts module is run twice and the device's config was not changed
|
||||
between the runs, the value is identical. This is achieved by running C(/export) and stripping the timestamp from
|
||||
the comment in the first line.
|
||||
returned: O(gather_subset) contains V(config)
|
||||
type: str
|
||||
version_added: 1.2.0
|
||||
|
||||
# interfaces
|
||||
ansible_net_all_ipv4_addresses:
|
||||
description: All IPv4 addresses configured on the device.
|
||||
returned: I(gather_subset) contains C(interfaces)
|
||||
returned: O(gather_subset) contains V(interfaces)
|
||||
type: list
|
||||
ansible_net_all_ipv6_addresses:
|
||||
description: All IPv6 addresses configured on the device.
|
||||
returned: I(gather_subset) contains C(interfaces)
|
||||
returned: O(gather_subset) contains V(interfaces)
|
||||
type: list
|
||||
ansible_net_interfaces:
|
||||
description: A hash of all interfaces running on the system.
|
||||
returned: I(gather_subset) contains C(interfaces)
|
||||
returned: O(gather_subset) contains V(interfaces)
|
||||
type: dict
|
||||
ansible_net_neighbors:
|
||||
description: The list of neighbors from the remote device.
|
||||
returned: I(gather_subset) contains C(interfaces)
|
||||
returned: O(gather_subset) contains V(interfaces)
|
||||
type: dict
|
||||
|
||||
# routing
|
||||
ansible_net_bgp_peer:
|
||||
description: A dictionary with BGP peer information.
|
||||
returned: I(gather_subset) contains C(routing)
|
||||
returned: O(gather_subset) contains V(routing)
|
||||
type: dict
|
||||
ansible_net_bgp_vpnv4_route:
|
||||
description: A dictionary with BGP vpnv4 route information.
|
||||
returned: I(gather_subset) contains C(routing)
|
||||
returned: O(gather_subset) contains V(routing)
|
||||
type: dict
|
||||
ansible_net_bgp_instance:
|
||||
description: A dictionary with BGP instance information.
|
||||
returned: I(gather_subset) contains C(routing)
|
||||
returned: O(gather_subset) contains V(routing)
|
||||
type: dict
|
||||
ansible_net_route:
|
||||
description: A dictionary for routes in all routing tables.
|
||||
returned: I(gather_subset) contains C(routing)
|
||||
returned: O(gather_subset) contains V(routing)
|
||||
type: dict
|
||||
ansible_net_ospf_instance:
|
||||
description: A dictionary with OSPF instances.
|
||||
returned: I(gather_subset) contains C(routing)
|
||||
returned: O(gather_subset) contains V(routing)
|
||||
type: dict
|
||||
ansible_net_ospf_neighbor:
|
||||
description: A dictionary with OSPF neighbors.
|
||||
returned: I(gather_subset) contains C(routing)
|
||||
returned: O(gather_subset) contains V(routing)
|
||||
type: dict
|
||||
"""
|
||||
import re
|
||||
|
@ -302,7 +308,7 @@ class Config(FactsBase):
|
|||
'/export',
|
||||
]
|
||||
|
||||
RM_DATE_RE = re.compile(r'^# [a-z0-9/][a-z0-9/]* [0-9:]* by RouterOS')
|
||||
RM_DATE_RE = re.compile(r'^# [a-z0-9/-][a-z0-9/-]* [0-9:]* by RouterOS')
|
||||
|
||||
def populate(self):
|
||||
super(Config, self).populate()
|
||||
|
@ -382,7 +388,7 @@ class Interfaces(FactsBase):
|
|||
for line in data.split('\n'):
|
||||
if len(line) == 0 or line[:5] == 'Flags':
|
||||
continue
|
||||
elif not re.match(self.WRAPPED_LINE_RE, line):
|
||||
elif not preprocessed or not re.match(self.WRAPPED_LINE_RE, line):
|
||||
preprocessed.append(line)
|
||||
else:
|
||||
preprocessed[-1] += line
|
||||
|
@ -459,7 +465,7 @@ class Routing(FactsBase):
|
|||
for line in data.split('\n'):
|
||||
if len(line) == 0 or line[:5] == 'Flags':
|
||||
continue
|
||||
elif not re.match(self.WRAPPED_LINE_RE, line):
|
||||
elif not preprocessed or not re.match(self.WRAPPED_LINE_RE, line):
|
||||
preprocessed.append(line)
|
||||
else:
|
||||
preprocessed[-1] += line
|
||||
|
@ -583,8 +589,6 @@ FACT_SUBSETS = dict(
|
|||
|
||||
VALID_SUBSETS = frozenset(FACT_SUBSETS.keys())
|
||||
|
||||
warnings = list()
|
||||
|
||||
|
||||
def main():
|
||||
"""main entry point for module execution
|
||||
|
@ -647,7 +651,7 @@ def main():
|
|||
key = 'ansible_net_%s' % key
|
||||
ansible_facts[key] = value
|
||||
|
||||
module.exit_json(ansible_facts=ansible_facts, warnings=warnings)
|
||||
module.exit_json(ansible_facts=ansible_facts)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -5,11 +5,9 @@
|
|||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import json
|
||||
import re
|
||||
|
||||
from ansible.errors import AnsibleConnectionFailure
|
||||
from ansible.module_utils.common.text.converters import to_text, to_bytes
|
||||
from ansible.plugins.terminal import TerminalBase
|
||||
from ansible.utils.display import Display
|
||||
|
||||
|
@ -33,7 +31,9 @@ class TerminalModule(TerminalBase):
|
|||
|
||||
terminal_stdout_re = [
|
||||
re.compile(br"\x1b<"),
|
||||
re.compile(br"\[[\w\-\.]+\@[\w\s\-\.\/]+\] ?> ?$"),
|
||||
re.compile(
|
||||
br"((\[[\w\-\.]+\@)|(\r\<(([\w\-\.]*\@)|)))"
|
||||
br"[\w\s\-\.\/]+\] ?(<SAFE)?> ?$"),
|
||||
re.compile(br"Please press \"Enter\" to continue!"),
|
||||
re.compile(br"Do you want to see the software license\? \[Y\/n\]: ?"),
|
||||
]
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
assert:
|
||||
that:
|
||||
- >-
|
||||
result.msg == "Unexpected end of string during escaped parameter"
|
||||
"Unexpected end of string during escaped parameter" in result.msg
|
||||
|
||||
- name: "Test quote_argument filter"
|
||||
assert:
|
||||
|
|
|
@ -16,7 +16,11 @@
|
|||
assert:
|
||||
that:
|
||||
- result is failed
|
||||
- "'Error while connecting: [Errno 111] Connection refused' == result.msg"
|
||||
- result.msg in potential_errors
|
||||
vars:
|
||||
potential_errors:
|
||||
- "Error while connecting: [Errno 111] Connection refused"
|
||||
- "Error while connecting: [Errno 99] Cannot assign requested address"
|
||||
|
||||
- name: Run command module
|
||||
community.routeros.command:
|
||||
|
|
|
@ -3,7 +3,5 @@
|
|||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
integration_tests_dependencies:
|
||||
- ansible.netcommon
|
||||
unit_tests_dependencies:
|
||||
- ansible.netcommon
|
||||
collections:
|
||||
- ansible.netcommon
|
|
@ -22,7 +22,7 @@
|
|||
assert:
|
||||
that:
|
||||
- >-
|
||||
result.msg == "Unexpected end of string during escaped parameter"
|
||||
"Unexpected end of string during escaped parameter" in result.msg
|
||||
|
||||
- name: "Test quote_argument filter"
|
||||
assert:
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
{
|
||||
"include_symlinks": false,
|
||||
"prefixes": [
|
||||
"docs/docsite/"
|
||||
],
|
||||
"output": "path-line-column-message",
|
||||
"requirements": [
|
||||
"antsibull-docs"
|
||||
]
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
"""Check extra collection docs with antsibull-docs."""
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
|
||||
def main():
|
||||
"""Main entry point."""
|
||||
if not os.path.isdir(os.path.join('docs', 'docsite')):
|
||||
return
|
||||
p = subprocess.run(['antsibull-docs', 'lint-collection-docs', '.'], check=False)
|
||||
if p.returncode not in (0, 3):
|
||||
print('{0}:0:0: unexpected return code {1}'.format(sys.argv[0], p.returncode))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
|
@ -1,4 +0,0 @@
|
|||
{
|
||||
"include_symlinks": false,
|
||||
"output": "path-message"
|
||||
}
|
|
@ -1,114 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
# Copyright (c) 2022, Felix Fontein <felix@fontein.de>
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
"""Prevent files without a correct license identifier from being added to the source tree."""
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import glob
|
||||
import sys
|
||||
|
||||
|
||||
def format_license_list(licenses):
|
||||
if not licenses:
|
||||
return '(empty)'
|
||||
return ', '.join(['"%s"' % license for license in licenses])
|
||||
|
||||
|
||||
def find_licenses(filename, relax=False):
|
||||
spdx_license_identifiers = []
|
||||
other_license_identifiers = []
|
||||
has_copyright = False
|
||||
with open(filename, 'r', encoding='utf-8') as f:
|
||||
for line in f:
|
||||
line = line.rstrip()
|
||||
if 'Copyright ' in line:
|
||||
has_copyright = True
|
||||
if 'Copyright: ' in line:
|
||||
print('%s: found copyright line with "Copyright:". Please remove the colon.' % (filename, ))
|
||||
idx = line.find('SPDX-License-Identifier: ')
|
||||
if idx >= 0:
|
||||
spdx_license_identifiers.append(line[idx + len('SPDX-License-Identifier: '):])
|
||||
if 'GNU General Public License' in line:
|
||||
if 'v3.0+' in line:
|
||||
other_license_identifiers.append('GPL-3.0-or-later')
|
||||
if 'version 3 or later' in line:
|
||||
other_license_identifiers.append('GPL-3.0-or-later')
|
||||
if 'Simplified BSD License' in line:
|
||||
other_license_identifiers.append('BSD-2-Clause')
|
||||
if 'Apache License 2.0' in line:
|
||||
other_license_identifiers.append('Apache-2.0')
|
||||
if 'PSF License' in line or 'Python-2.0' in line:
|
||||
other_license_identifiers.append('PSF-2.0')
|
||||
if 'MIT License' in line:
|
||||
other_license_identifiers.append('MIT')
|
||||
if len(set(spdx_license_identifiers)) < len(spdx_license_identifiers):
|
||||
print('%s: found identical SPDX-License-Identifier values' % (filename, ))
|
||||
if other_license_identifiers and set(other_license_identifiers) != set(spdx_license_identifiers):
|
||||
print('%s: SPDX-License-Identifier yielded the license list %s, while manual guessing yielded the license list %s' % (
|
||||
filename, format_license_list(spdx_license_identifiers), format_license_list(other_license_identifiers)))
|
||||
if not has_copyright and not relax:
|
||||
print('%s: found no copyright notice' % (filename, ))
|
||||
return sorted(spdx_license_identifiers)
|
||||
|
||||
|
||||
def main():
|
||||
"""Main entry point."""
|
||||
paths = sys.argv[1:] or sys.stdin.read().splitlines()
|
||||
|
||||
# The following paths are allowed to have no license identifier
|
||||
no_comments_allowed = [
|
||||
'changelogs/fragments/*.yml',
|
||||
'tests/sanity/extra/*.json',
|
||||
'tests/sanity/ignore-2.*.txt',
|
||||
'tests/unit/plugins/modules/fixtures/*',
|
||||
'tests/unit/plugins/modules/fixtures/facts/*',
|
||||
'LICENSES/*.txt',
|
||||
'COPYING',
|
||||
]
|
||||
|
||||
# Files of this name are allowed to be empty
|
||||
empty_allowed = [
|
||||
'.keep',
|
||||
'__init__.py',
|
||||
]
|
||||
|
||||
# These files are completely ignored
|
||||
ignore_paths = [
|
||||
'CHANGELOG.rst',
|
||||
'changelogs/changelog.yaml',
|
||||
'tests/sanity/extra/licenses.py', # The strings in find_licenses() confuse this code :-)
|
||||
'.ansible-test-timeout.json',
|
||||
]
|
||||
|
||||
no_comments_allowed = [fn for pattern in no_comments_allowed for fn in glob.glob(pattern)]
|
||||
ignore_paths = [fn for pattern in ignore_paths for fn in glob.glob(pattern)]
|
||||
|
||||
valid_licenses = [license_file[len('LICENSES/'):-len('.txt')] for license_file in glob.glob('LICENSES/*.txt')]
|
||||
|
||||
for path in paths:
|
||||
if path.startswith('./'):
|
||||
path = path[2:]
|
||||
if path in ignore_paths or path.startswith('tests/output/'):
|
||||
continue
|
||||
if os.path.basename(path) in empty_allowed:
|
||||
if os.stat(path).st_size == 0:
|
||||
continue
|
||||
valid_licenses_for_path = valid_licenses
|
||||
if path.startswith('plugins/') and not path.startswith(('plugins/modules/', 'plugins/module_utils/')):
|
||||
valid_licenses_for_path = [license for license in valid_licenses if license == 'GPL-3.0-or-later']
|
||||
licenses = find_licenses(path, relax=path in no_comments_allowed)
|
||||
if not licenses:
|
||||
if path not in no_comments_allowed:
|
||||
print('%s: must have at least one license' % (path, ))
|
||||
else:
|
||||
for license in licenses:
|
||||
if license not in valid_licenses_for_path:
|
||||
print('%s: found not allowed license "%s", must be one of %s' % (
|
||||
path, license, format_license_list(valid_licenses_for_path)))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"include_symlinks": true,
|
||||
"prefixes": [
|
||||
"plugins/"
|
||||
],
|
||||
"output": "path-message"
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
"""Prevent unwanted files from being added to the source tree."""
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import os.path
|
||||
import sys
|
||||
|
||||
|
||||
def main():
|
||||
"""Main entry point."""
|
||||
paths = sys.argv[1:] or sys.stdin.read().splitlines()
|
||||
|
||||
allowed_extensions = (
|
||||
'.cs',
|
||||
'.ps1',
|
||||
'.psm1',
|
||||
'.py',
|
||||
)
|
||||
|
||||
skip_paths = set([
|
||||
])
|
||||
|
||||
skip_directories = (
|
||||
)
|
||||
|
||||
yaml_directories = (
|
||||
'plugins/test/',
|
||||
'plugins/filter/',
|
||||
)
|
||||
|
||||
for path in paths:
|
||||
if path in skip_paths:
|
||||
continue
|
||||
|
||||
if any(path.startswith(skip_directory) for skip_directory in skip_directories):
|
||||
continue
|
||||
|
||||
if os.path.islink(path):
|
||||
print('%s: is a symbolic link' % (path, ))
|
||||
elif not os.path.isfile(path):
|
||||
print('%s: is not a regular file' % (path, ))
|
||||
|
||||
ext = os.path.splitext(path)[1]
|
||||
|
||||
if ext in ('.yml', ) and any(path.startswith(yaml_directory) for yaml_directory in yaml_directories):
|
||||
continue
|
||||
|
||||
if ext not in allowed_extensions:
|
||||
print('%s: extension must be one of: %s' % (path, ', '.join(allowed_extensions)))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
|
@ -1,8 +0,0 @@
|
|||
{
|
||||
"include_symlinks": false,
|
||||
"prefixes": [
|
||||
"docs/docsite/rst/api-guide.rst",
|
||||
"plugins/modules/",
|
||||
],
|
||||
"output": "path-line-column-message",
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
"""Check whether update-docs.py modifies something."""
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
|
||||
def main():
|
||||
"""Main entry point."""
|
||||
p = subprocess.run(['./update-docs.py'], check=False)
|
||||
if p.returncode not in (0, 1):
|
||||
print('{0}:0:0: unexpected return code {1}'.format(sys.argv[0], p.returncode))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
|
@ -1,6 +1,9 @@
|
|||
update-docs.py compile-2.6
|
||||
update-docs.py compile-2.7
|
||||
update-docs.py compile-3.5
|
||||
update-docs.py future-import-boilerplate
|
||||
update-docs.py metaclass-boilerplate
|
||||
update-docs.py shebang
|
||||
docs/docsite/rst/api-guide.rst rstcheck
|
||||
docs/docsite/rst/quoting.rst rstcheck
|
||||
docs/docsite/rst/ssh-guide.rst rstcheck
|
||||
tests/update-docs.py compile-2.6
|
||||
tests/update-docs.py compile-2.7
|
||||
tests/update-docs.py compile-3.5
|
||||
tests/update-docs.py future-import-boilerplate
|
||||
tests/update-docs.py metaclass-boilerplate
|
||||
tests/update-docs.py shebang
|
||||
|
|
3
tests/sanity/ignore-2.10.txt.license
Normal file
3
tests/sanity/ignore-2.10.txt.license
Normal file
|
@ -0,0 +1,3 @@
|
|||
GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
|
@ -1,6 +1,6 @@
|
|||
update-docs.py compile-2.6
|
||||
update-docs.py compile-2.7
|
||||
update-docs.py compile-3.5
|
||||
update-docs.py future-import-boilerplate
|
||||
update-docs.py metaclass-boilerplate
|
||||
update-docs.py shebang
|
||||
tests/update-docs.py compile-2.6
|
||||
tests/update-docs.py compile-2.7
|
||||
tests/update-docs.py compile-3.5
|
||||
tests/update-docs.py future-import-boilerplate
|
||||
tests/update-docs.py metaclass-boilerplate
|
||||
tests/update-docs.py shebang
|
||||
|
|
3
tests/sanity/ignore-2.11.txt.license
Normal file
3
tests/sanity/ignore-2.11.txt.license
Normal file
|
@ -0,0 +1,3 @@
|
|||
GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
|
@ -1 +1 @@
|
|||
update-docs.py shebang
|
||||
tests/update-docs.py shebang
|
||||
|
|
3
tests/sanity/ignore-2.12.txt.license
Normal file
3
tests/sanity/ignore-2.12.txt.license
Normal file
|
@ -0,0 +1,3 @@
|
|||
GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
|
@ -1 +1 @@
|
|||
update-docs.py shebang
|
||||
tests/update-docs.py shebang
|
||||
|
|
3
tests/sanity/ignore-2.13.txt.license
Normal file
3
tests/sanity/ignore-2.13.txt.license
Normal file
|
@ -0,0 +1,3 @@
|
|||
GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
|
@ -1 +1 @@
|
|||
update-docs.py shebang
|
||||
tests/update-docs.py shebang
|
||||
|
|
3
tests/sanity/ignore-2.14.txt.license
Normal file
3
tests/sanity/ignore-2.14.txt.license
Normal file
|
@ -0,0 +1,3 @@
|
|||
GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
1
tests/sanity/ignore-2.15.txt
Normal file
1
tests/sanity/ignore-2.15.txt
Normal file
|
@ -0,0 +1 @@
|
|||
tests/update-docs.py shebang
|
3
tests/sanity/ignore-2.15.txt.license
Normal file
3
tests/sanity/ignore-2.15.txt.license
Normal file
|
@ -0,0 +1,3 @@
|
|||
GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
1
tests/sanity/ignore-2.16.txt
Normal file
1
tests/sanity/ignore-2.16.txt
Normal file
|
@ -0,0 +1 @@
|
|||
tests/update-docs.py shebang
|
3
tests/sanity/ignore-2.16.txt.license
Normal file
3
tests/sanity/ignore-2.16.txt.license
Normal file
|
@ -0,0 +1,3 @@
|
|||
GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
1
tests/sanity/ignore-2.17.txt
Normal file
1
tests/sanity/ignore-2.17.txt
Normal file
|
@ -0,0 +1 @@
|
|||
tests/update-docs.py shebang
|
3
tests/sanity/ignore-2.17.txt.license
Normal file
3
tests/sanity/ignore-2.17.txt.license
Normal file
|
@ -0,0 +1,3 @@
|
|||
GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
1
tests/sanity/ignore-2.18.txt
Normal file
1
tests/sanity/ignore-2.18.txt
Normal file
|
@ -0,0 +1 @@
|
|||
tests/update-docs.py shebang
|
3
tests/sanity/ignore-2.18.txt.license
Normal file
3
tests/sanity/ignore-2.18.txt.license
Normal file
|
@ -0,0 +1,3 @@
|
|||
GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
1
tests/sanity/ignore-2.19.txt
Normal file
1
tests/sanity/ignore-2.19.txt
Normal file
|
@ -0,0 +1 @@
|
|||
tests/update-docs.py shebang
|
3
tests/sanity/ignore-2.19.txt.license
Normal file
3
tests/sanity/ignore-2.19.txt.license
Normal file
|
@ -0,0 +1,3 @@
|
|||
GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
4
tests/sanity/ignore-2.20.txt
Normal file
4
tests/sanity/ignore-2.20.txt
Normal file
|
@ -0,0 +1,4 @@
|
|||
plugins/modules/api_facts.py pylint:ansible-bad-import-from
|
||||
plugins/modules/command.py pylint:ansible-bad-import-from
|
||||
plugins/modules/facts.py pylint:ansible-bad-import-from
|
||||
tests/update-docs.py shebang
|
3
tests/sanity/ignore-2.20.txt.license
Normal file
3
tests/sanity/ignore-2.20.txt.license
Normal file
|
@ -0,0 +1,3 @@
|
|||
GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
|
@ -1,6 +1,9 @@
|
|||
update-docs.py compile-2.6
|
||||
update-docs.py compile-2.7
|
||||
update-docs.py compile-3.5
|
||||
update-docs.py future-import-boilerplate
|
||||
update-docs.py metaclass-boilerplate
|
||||
update-docs.py shebang
|
||||
docs/docsite/rst/api-guide.rst rstcheck
|
||||
docs/docsite/rst/quoting.rst rstcheck
|
||||
docs/docsite/rst/ssh-guide.rst rstcheck
|
||||
tests/update-docs.py compile-2.6
|
||||
tests/update-docs.py compile-2.7
|
||||
tests/update-docs.py compile-3.5
|
||||
tests/update-docs.py future-import-boilerplate
|
||||
tests/update-docs.py metaclass-boilerplate
|
||||
tests/update-docs.py shebang
|
||||
|
|
3
tests/sanity/ignore-2.9.txt.license
Normal file
3
tests/sanity/ignore-2.9.txt.license
Normal file
|
@ -0,0 +1,3 @@
|
|||
GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
|
@ -1,20 +0,0 @@
|
|||
# Copyright (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com>
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
#
|
||||
# Compat for python2.7
|
||||
#
|
||||
|
||||
# One unittest needs to import builtins via __import__() so we need to have
|
||||
# the string that represents it
|
||||
try:
|
||||
import __builtin__
|
||||
except ImportError:
|
||||
BUILTINS = 'builtins'
|
||||
else:
|
||||
BUILTINS = '__builtin__'
|
|
@ -1,109 +0,0 @@
|
|||
# Copyright (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com>
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
'''
|
||||
Compat module for Python3.x's unittest.mock module
|
||||
'''
|
||||
import sys
|
||||
|
||||
# Python 2.7
|
||||
|
||||
# Note: Could use the pypi mock library on python3.x as well as python2.x. It
|
||||
# is the same as the python3 stdlib mock library
|
||||
|
||||
try:
|
||||
# Allow wildcard import because we really do want to import all of mock's
|
||||
# symbols into this compat shim
|
||||
# pylint: disable=wildcard-import,unused-wildcard-import
|
||||
from unittest.mock import *
|
||||
except ImportError:
|
||||
# Python 2
|
||||
# pylint: disable=wildcard-import,unused-wildcard-import
|
||||
try:
|
||||
from mock import *
|
||||
except ImportError:
|
||||
print('You need the mock library installed on python2.x to run tests')
|
||||
|
||||
|
||||
# Prior to 3.4.4, mock_open cannot handle binary read_data
|
||||
if sys.version_info >= (3,) and sys.version_info < (3, 4, 4):
|
||||
file_spec = None
|
||||
|
||||
def _iterate_read_data(read_data):
|
||||
# Helper for mock_open:
|
||||
# Retrieve lines from read_data via a generator so that separate calls to
|
||||
# readline, read, and readlines are properly interleaved
|
||||
sep = b'\n' if isinstance(read_data, bytes) else '\n'
|
||||
data_as_list = [l + sep for l in read_data.split(sep)]
|
||||
|
||||
if data_as_list[-1] == sep:
|
||||
# If the last line ended in a newline, the list comprehension will have an
|
||||
# extra entry that's just a newline. Remove this.
|
||||
data_as_list = data_as_list[:-1]
|
||||
else:
|
||||
# If there wasn't an extra newline by itself, then the file being
|
||||
# emulated doesn't have a newline to end the last line remove the
|
||||
# newline that our naive format() added
|
||||
data_as_list[-1] = data_as_list[-1][:-1]
|
||||
|
||||
for line in data_as_list:
|
||||
yield line
|
||||
|
||||
def mock_open(mock=None, read_data=''):
|
||||
"""
|
||||
A helper function to create a mock to replace the use of `open`. It works
|
||||
for `open` called directly or used as a context manager.
|
||||
|
||||
The `mock` argument is the mock object to configure. If `None` (the
|
||||
default) then a `MagicMock` will be created for you, with the API limited
|
||||
to methods or attributes available on standard file handles.
|
||||
|
||||
`read_data` is a string for the `read` methoddline`, and `readlines` of the
|
||||
file handle to return. This is an empty string by default.
|
||||
"""
|
||||
def _readlines_side_effect(*args, **kwargs):
|
||||
if handle.readlines.return_value is not None:
|
||||
return handle.readlines.return_value
|
||||
return list(_data)
|
||||
|
||||
def _read_side_effect(*args, **kwargs):
|
||||
if handle.read.return_value is not None:
|
||||
return handle.read.return_value
|
||||
return type(read_data)().join(_data)
|
||||
|
||||
def _readline_side_effect():
|
||||
if handle.readline.return_value is not None:
|
||||
while True:
|
||||
yield handle.readline.return_value
|
||||
for line in _data:
|
||||
yield line
|
||||
|
||||
global file_spec
|
||||
if file_spec is None:
|
||||
import _io
|
||||
file_spec = list(set(dir(_io.TextIOWrapper)).union(set(dir(_io.BytesIO))))
|
||||
|
||||
if mock is None:
|
||||
mock = MagicMock(name='open', spec=open)
|
||||
|
||||
handle = MagicMock(spec=file_spec)
|
||||
handle.__enter__.return_value = handle
|
||||
|
||||
_data = _iterate_read_data(read_data)
|
||||
|
||||
handle.write.return_value = None
|
||||
handle.read.return_value = None
|
||||
handle.readline.return_value = None
|
||||
handle.readlines.return_value = None
|
||||
|
||||
handle.read.side_effect = _read_side_effect
|
||||
handle.readline.side_effect = _readline_side_effect()
|
||||
handle.readlines.side_effect = _readlines_side_effect
|
||||
|
||||
mock.return_value = handle
|
||||
return mock
|
|
@ -1,25 +0,0 @@
|
|||
# Copyright (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com>
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
'''
|
||||
Compat module for Python2.7's unittest module
|
||||
'''
|
||||
|
||||
import sys
|
||||
|
||||
# Allow wildcard import because we really do want to import all of
|
||||
# unittests's symbols into this compat shim
|
||||
# pylint: disable=wildcard-import,unused-wildcard-import
|
||||
if sys.version_info < (2, 7):
|
||||
try:
|
||||
# Need unittest2 on python2.6
|
||||
from unittest2 import *
|
||||
except ImportError:
|
||||
print('You need unittest2 installed on python2.6.x to run tests')
|
||||
else:
|
||||
from unittest import *
|
|
@ -9,10 +9,8 @@ __metaclass__ = type
|
|||
|
||||
import pytest
|
||||
|
||||
from ansible.module_utils.common.text.converters import to_native
|
||||
|
||||
from ansible_collections.community.routeros.plugins.module_utils._api_data import (
|
||||
APIData,
|
||||
VersionedAPIData,
|
||||
KeyInfo,
|
||||
split_path,
|
||||
join_path,
|
||||
|
@ -21,7 +19,7 @@ from ansible_collections.community.routeros.plugins.module_utils._api_data impor
|
|||
|
||||
def test_api_data_errors():
|
||||
with pytest.raises(ValueError) as exc:
|
||||
APIData()
|
||||
VersionedAPIData()
|
||||
assert exc.value.args[0] == 'fields must be provided'
|
||||
|
||||
values = [
|
||||
|
@ -35,25 +33,41 @@ def test_api_data_errors():
|
|||
for index, (param, param_value) in enumerate(values):
|
||||
for param2, param2_value in values[index + 1:]:
|
||||
with pytest.raises(ValueError) as exc:
|
||||
APIData(**{param: param_value, param2: param2_value})
|
||||
VersionedAPIData(**{param: param_value, param2: param2_value})
|
||||
assert exc.value.args[0] == 'primary_keys, stratify_keys, has_identifier, single_value, and unknown_mechanism are mutually exclusive'
|
||||
|
||||
with pytest.raises(ValueError) as exc:
|
||||
APIData(unknown_mechanism=True, fully_understood=True)
|
||||
VersionedAPIData(unknown_mechanism=True, fully_understood=True)
|
||||
assert exc.value.args[0] == 'unknown_mechanism and fully_understood cannot be combined'
|
||||
|
||||
with pytest.raises(ValueError) as exc:
|
||||
APIData(unknown_mechanism=True, fixed_entries=True)
|
||||
VersionedAPIData(unknown_mechanism=True, fixed_entries=True)
|
||||
assert exc.value.args[0] == 'fixed_entries can only be used with primary_keys'
|
||||
|
||||
with pytest.raises(ValueError) as exc:
|
||||
APIData(primary_keys=['foo'], fields={})
|
||||
VersionedAPIData(primary_keys=['foo'], fields={})
|
||||
assert exc.value.args[0] == 'Primary key foo must be in fields!'
|
||||
|
||||
with pytest.raises(ValueError) as exc:
|
||||
APIData(stratify_keys=['foo'], fields={})
|
||||
VersionedAPIData(stratify_keys=['foo'], fields={})
|
||||
assert exc.value.args[0] == 'Stratify key foo must be in fields!'
|
||||
|
||||
with pytest.raises(ValueError) as exc:
|
||||
VersionedAPIData(required_one_of=['foo'], fields={})
|
||||
assert exc.value.args[0] == 'Require one of element at index #1 must be a list!'
|
||||
|
||||
with pytest.raises(ValueError) as exc:
|
||||
VersionedAPIData(required_one_of=[['foo']], fields={})
|
||||
assert exc.value.args[0] == 'Require one of key foo must be in fields!'
|
||||
|
||||
with pytest.raises(ValueError) as exc:
|
||||
VersionedAPIData(mutually_exclusive=['foo'], fields={})
|
||||
assert exc.value.args[0] == 'Mutually exclusive element at index #1 must be a list!'
|
||||
|
||||
with pytest.raises(ValueError) as exc:
|
||||
VersionedAPIData(mutually_exclusive=[['foo']], fields={})
|
||||
assert exc.value.args[0] == 'Mutually exclusive key foo must be in fields!'
|
||||
|
||||
|
||||
def test_key_info_errors():
|
||||
values = [
|
||||
|
@ -63,11 +77,19 @@ def test_key_info_errors():
|
|||
('can_disable', True),
|
||||
]
|
||||
|
||||
params_allowed_together = [
|
||||
'default',
|
||||
'can_disable',
|
||||
]
|
||||
|
||||
emsg = 'required, default, automatically_computed_from, and can_disable are mutually exclusive besides default and can_disable which can be set together'
|
||||
for index, (param, param_value) in enumerate(values):
|
||||
for param2, param2_value in values[index + 1:]:
|
||||
if param in params_allowed_together and param2 in params_allowed_together:
|
||||
continue
|
||||
with pytest.raises(ValueError) as exc:
|
||||
KeyInfo(**{param: param_value, param2: param2_value})
|
||||
assert exc.value.args[0] == 'required, default, automatically_computed_from, and can_disable are mutually exclusive'
|
||||
assert exc.value.args[0] == emsg
|
||||
|
||||
with pytest.raises(ValueError) as exc:
|
||||
KeyInfo('foo')
|
||||
|
@ -77,8 +99,16 @@ def test_key_info_errors():
|
|||
KeyInfo(remove_value='')
|
||||
assert exc.value.args[0] == 'remove_value can only be specified if can_disable=True'
|
||||
|
||||
with pytest.raises(ValueError) as exc:
|
||||
KeyInfo(read_only=True, write_only=True)
|
||||
assert exc.value.args[0] == 'read_only and write_only cannot be used at the same time'
|
||||
|
||||
SPLITTED_PATHS = [
|
||||
with pytest.raises(ValueError) as exc:
|
||||
KeyInfo(read_only=True, default=0)
|
||||
assert exc.value.args[0] == 'read_only can not be combined with can_disable, remove_value, absent_value, default, or required'
|
||||
|
||||
|
||||
SPLIT_PATHS = [
|
||||
('', [], ''),
|
||||
(' ip ', ['ip'], 'ip'),
|
||||
('ip', ['ip'], 'ip'),
|
||||
|
@ -86,7 +116,7 @@ SPLITTED_PATHS = [
|
|||
]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("joined_input, splitted, joined_output", SPLITTED_PATHS)
|
||||
def test_join_split_path(joined_input, splitted, joined_output):
|
||||
assert split_path(joined_input) == splitted
|
||||
assert join_path(splitted) == joined_output
|
||||
@pytest.mark.parametrize("joined_input, split, joined_output", SPLIT_PATHS)
|
||||
def test_join_split_path(joined_input, split, joined_output):
|
||||
assert split_path(joined_input) == split
|
||||
assert join_path(split) == joined_output
|
||||
|
|
377
tests/unit/plugins/module_utils/test__api_helper.py
Normal file
377
tests/unit/plugins/module_utils/test__api_helper.py
Normal file
|
@ -0,0 +1,377 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (c) 2021, Felix Fontein (@felixfontein) <felix@fontein.de>
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
import re
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
|
||||
from ansible_collections.community.routeros.plugins.module_utils._api_data import (
|
||||
PATHS,
|
||||
)
|
||||
|
||||
from ansible_collections.community.routeros.plugins.module_utils._api_helper import (
|
||||
_value_to_str,
|
||||
_test_rule_except_invert,
|
||||
validate_and_prepare_restrict,
|
||||
restrict_entry_accepted,
|
||||
)
|
||||
|
||||
|
||||
VALUE_TO_STR = [
|
||||
(None, None),
|
||||
('', u''),
|
||||
('foo', u'foo'),
|
||||
(True, u'true'),
|
||||
(False, u'false'),
|
||||
([], u'[]'),
|
||||
({}, u'{}'),
|
||||
(1, u'1'),
|
||||
(-42, u'-42'),
|
||||
(1.5, u'1.5'),
|
||||
(1.0, u'1.0'),
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("value, expected", VALUE_TO_STR)
|
||||
def test_value_to_str(value, expected):
|
||||
result = _value_to_str(value)
|
||||
print(repr(result))
|
||||
assert result == expected
|
||||
|
||||
|
||||
TEST_RULE_EXCEPT_INVERT = [
|
||||
(
|
||||
None,
|
||||
{
|
||||
'field': u'foo',
|
||||
'match_disabled': False,
|
||||
'invert': False,
|
||||
},
|
||||
False,
|
||||
),
|
||||
(
|
||||
None,
|
||||
{
|
||||
'field': u'foo',
|
||||
'match_disabled': True,
|
||||
'invert': False,
|
||||
},
|
||||
True,
|
||||
),
|
||||
(
|
||||
1,
|
||||
{
|
||||
'field': u'foo',
|
||||
'match_disabled': False,
|
||||
'invert': False,
|
||||
'values': [1],
|
||||
},
|
||||
True,
|
||||
),
|
||||
(
|
||||
1,
|
||||
{
|
||||
'field': u'foo',
|
||||
'match_disabled': False,
|
||||
'invert': False,
|
||||
'values': ['1'],
|
||||
},
|
||||
False,
|
||||
),
|
||||
(
|
||||
1,
|
||||
{
|
||||
'field': u'foo',
|
||||
'match_disabled': False,
|
||||
'invert': False,
|
||||
'regex': re.compile(u'^1$'),
|
||||
'regex_source': u'^1$',
|
||||
},
|
||||
True,
|
||||
),
|
||||
(
|
||||
1.10,
|
||||
{
|
||||
'field': u'foo',
|
||||
'match_disabled': False,
|
||||
'invert': False,
|
||||
'regex': re.compile(u'^1\\.1$'),
|
||||
'regex_source': u'^1\\.1$',
|
||||
},
|
||||
True,
|
||||
),
|
||||
(
|
||||
10,
|
||||
{
|
||||
'field': u'foo',
|
||||
'match_disabled': False,
|
||||
'invert': False,
|
||||
'regex': re.compile(u'^1$'),
|
||||
'regex_source': u'^1$',
|
||||
},
|
||||
False,
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("value, rule, expected", TEST_RULE_EXCEPT_INVERT)
|
||||
def test_rule_except_invert(value, rule, expected):
|
||||
result = _test_rule_except_invert(value, rule)
|
||||
print(repr(result))
|
||||
assert result == expected
|
||||
|
||||
|
||||
_test_path = PATHS[('ip', 'firewall', 'filter')]
|
||||
_test_path.provide_version('7.0')
|
||||
TEST_PATH = _test_path.get_data()
|
||||
|
||||
|
||||
class FailJsonExc(Exception):
|
||||
def __init__(self, msg, kwargs):
|
||||
self.msg = msg
|
||||
self.kwargs = kwargs
|
||||
|
||||
|
||||
class FakeModule(object):
|
||||
def __init__(self, restrict_value):
|
||||
self.params = {
|
||||
'restrict': restrict_value,
|
||||
}
|
||||
|
||||
def fail_json(self, msg, **kwargs):
|
||||
raise FailJsonExc(msg, kwargs)
|
||||
|
||||
|
||||
TEST_VALIDATE_AND_PREPARE_RESTRICT = [
|
||||
(
|
||||
[{
|
||||
'field': u'chain',
|
||||
'match_disabled': False,
|
||||
'values': None,
|
||||
'regex': None,
|
||||
'invert': False,
|
||||
}],
|
||||
[{
|
||||
'field': u'chain',
|
||||
'match_disabled': False,
|
||||
'invert': False,
|
||||
}],
|
||||
),
|
||||
(
|
||||
[{
|
||||
'field': u'comment',
|
||||
'match_disabled': True,
|
||||
'values': None,
|
||||
'regex': None,
|
||||
'invert': False,
|
||||
}],
|
||||
[{
|
||||
'field': u'comment',
|
||||
'match_disabled': True,
|
||||
'invert': False,
|
||||
}],
|
||||
),
|
||||
(
|
||||
[{
|
||||
'field': u'comment',
|
||||
'match_disabled': False,
|
||||
'values': None,
|
||||
'regex': None,
|
||||
'invert': True,
|
||||
}],
|
||||
[{
|
||||
'field': u'comment',
|
||||
'match_disabled': False,
|
||||
'invert': True,
|
||||
}],
|
||||
),
|
||||
]
|
||||
|
||||
if sys.version_info >= (2, 7, 17):
|
||||
# Somewhere between Python 2.7.15 (used by Ansible 3.9) and 2.7.17 (used by ansible-base 2.10)
|
||||
# something changed with ``==`` for ``re.Pattern``, at least for some patterns
|
||||
# (my guess is: for ``re.compile(u'')``)
|
||||
TEST_VALIDATE_AND_PREPARE_RESTRICT.extend([
|
||||
(
|
||||
[
|
||||
{
|
||||
'field': u'comment',
|
||||
'match_disabled': False,
|
||||
'values': [],
|
||||
'regex': None,
|
||||
'invert': False,
|
||||
},
|
||||
{
|
||||
'field': u'comment',
|
||||
'match_disabled': False,
|
||||
'values': [None, 1, 42.0, True, u'foo', [], {}],
|
||||
'regex': None,
|
||||
'invert': False,
|
||||
},
|
||||
{
|
||||
'field': u'chain',
|
||||
'match_disabled': False,
|
||||
'values': None,
|
||||
'regex': u'',
|
||||
'invert': True,
|
||||
},
|
||||
{
|
||||
'field': u'chain',
|
||||
'match_disabled': False,
|
||||
'values': None,
|
||||
'regex': u'foo',
|
||||
'invert': False,
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
'field': u'comment',
|
||||
'match_disabled': False,
|
||||
'invert': False,
|
||||
'values': [],
|
||||
},
|
||||
{
|
||||
'field': u'comment',
|
||||
'match_disabled': False,
|
||||
'invert': False,
|
||||
'values': [None, 1, 42.0, True, u'foo', [], {}],
|
||||
},
|
||||
{
|
||||
'field': u'chain',
|
||||
'match_disabled': False,
|
||||
'invert': True,
|
||||
'regex': re.compile(u''),
|
||||
'regex_source': u'',
|
||||
},
|
||||
{
|
||||
'field': u'chain',
|
||||
'match_disabled': False,
|
||||
'invert': False,
|
||||
'regex': re.compile(u'foo'),
|
||||
'regex_source': u'foo',
|
||||
},
|
||||
],
|
||||
),
|
||||
])
|
||||
|
||||
|
||||
@pytest.mark.parametrize("restrict_value, expected", TEST_VALIDATE_AND_PREPARE_RESTRICT)
|
||||
def test_validate_and_prepare_restrict(restrict_value, expected):
|
||||
fake_module = FakeModule(restrict_value)
|
||||
result = validate_and_prepare_restrict(fake_module, TEST_PATH)
|
||||
print(repr(result))
|
||||
assert result == expected
|
||||
|
||||
|
||||
TEST_VALIDATE_AND_PREPARE_RESTRICT_FAIL = [
|
||||
(
|
||||
[{
|
||||
'field': u'!foo',
|
||||
'match_disabled': False,
|
||||
'values': None,
|
||||
'regex': None,
|
||||
'invert': False,
|
||||
}],
|
||||
['restrict: the field name "!foo" must not start with "!"'],
|
||||
),
|
||||
(
|
||||
[{
|
||||
'field': u'foo',
|
||||
'match_disabled': False,
|
||||
'values': None,
|
||||
'regex': None,
|
||||
'invert': False,
|
||||
}],
|
||||
['restrict: the field "foo" does not exist for this path'],
|
||||
),
|
||||
(
|
||||
[{
|
||||
'field': u'chain',
|
||||
'match_disabled': False,
|
||||
'values': None,
|
||||
'regex': u'(',
|
||||
'invert': False,
|
||||
}],
|
||||
[
|
||||
'restrict: invalid regular expression "(": missing ), unterminated subpattern at position 0',
|
||||
'restrict: invalid regular expression "(": unbalanced parenthesis',
|
||||
]
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("restrict_value, expected", TEST_VALIDATE_AND_PREPARE_RESTRICT_FAIL)
|
||||
def test_validate_and_prepare_restrict_fail(restrict_value, expected):
|
||||
fake_module = FakeModule(restrict_value)
|
||||
with pytest.raises(FailJsonExc) as exc:
|
||||
validate_and_prepare_restrict(fake_module, TEST_PATH)
|
||||
print(repr(exc.value.msg))
|
||||
assert exc.value.msg in expected
|
||||
|
||||
|
||||
TEST_RESTRICT_ENTRY_ACCEPTED = [
|
||||
(
|
||||
{
|
||||
'chain': 'input',
|
||||
},
|
||||
[
|
||||
{
|
||||
'field': u'chain',
|
||||
'match_disabled': False,
|
||||
'invert': False,
|
||||
},
|
||||
],
|
||||
False,
|
||||
),
|
||||
(
|
||||
{
|
||||
'chain': 'input',
|
||||
},
|
||||
[
|
||||
{
|
||||
'field': u'chain',
|
||||
'match_disabled': False,
|
||||
'invert': True,
|
||||
},
|
||||
],
|
||||
True,
|
||||
),
|
||||
(
|
||||
{
|
||||
'comment': 'foo',
|
||||
},
|
||||
[
|
||||
{
|
||||
'field': u'comment',
|
||||
'match_disabled': True,
|
||||
'invert': False,
|
||||
},
|
||||
],
|
||||
False,
|
||||
),
|
||||
(
|
||||
{},
|
||||
[
|
||||
{
|
||||
'field': u'comment',
|
||||
'match_disabled': True,
|
||||
'invert': False,
|
||||
},
|
||||
],
|
||||
True,
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("entry, restrict_data, expected", TEST_RESTRICT_ENTRY_ACCEPTED)
|
||||
def test_restrict_entry_accepted(entry, restrict_data, expected):
|
||||
result = restrict_entry_accepted(entry, TEST_PATH, restrict_data)
|
||||
print(repr(result))
|
||||
assert result == expected
|
|
@ -9,6 +9,9 @@ __metaclass__ = type
|
|||
from ansible_collections.community.routeros.plugins.module_utils._api_data import PATHS
|
||||
|
||||
|
||||
FAKE_ROS_VERSION = '7.5.0'
|
||||
|
||||
|
||||
class FakeLibRouterosError(Exception):
|
||||
def __init__(self, message):
|
||||
self.message = message
|
||||
|
@ -16,7 +19,7 @@ class FakeLibRouterosError(Exception):
|
|||
|
||||
|
||||
class TrapError(FakeLibRouterosError):
|
||||
def __init__(self, message="failure: already have interface with such name"):
|
||||
def __init__(self, message='failure: already have interface with such name'):
|
||||
super(TrapError, self).__init__(message)
|
||||
|
||||
|
||||
|
@ -118,9 +121,9 @@ class Or(object):
|
|||
return repr(self.args)
|
||||
|
||||
|
||||
def _normalize_entry(entry, path_info):
|
||||
def _normalize_entry(entry, path_info, on_create=False):
|
||||
for key, data in path_info.fields.items():
|
||||
if key not in entry and data.default is not None:
|
||||
if key not in entry and data.default is not None and (not data.can_disable or on_create):
|
||||
entry[key] = data.default
|
||||
if data.can_disable:
|
||||
if key in entry and entry[key] in (None, data.remove_value):
|
||||
|
@ -128,12 +131,18 @@ def _normalize_entry(entry, path_info):
|
|||
if ('!%s' % key) in entry:
|
||||
entry.pop(key, None)
|
||||
del entry['!%s' % key]
|
||||
if data.absent_value is not None and key in entry and entry[key] == data.absent_value:
|
||||
del entry[key]
|
||||
|
||||
|
||||
def massage_expected_result_data(values, path, keep_all=False, remove_dynamic=False):
|
||||
path_info = PATHS[path]
|
||||
def massage_expected_result_data(values, path, keep_all=False, remove_dynamic=False, remove_builtin=False):
|
||||
versioned_path_info = PATHS[path]
|
||||
versioned_path_info.provide_version(FAKE_ROS_VERSION)
|
||||
path_info = versioned_path_info.get_data()
|
||||
if remove_dynamic:
|
||||
values = [entry for entry in values if not entry.get('dynamic', False)]
|
||||
if remove_builtin:
|
||||
values = [entry for entry in values if not entry.get('builtin', False)]
|
||||
values = [entry.copy() for entry in values]
|
||||
for entry in values:
|
||||
_normalize_entry(entry, path_info)
|
||||
|
@ -142,21 +151,34 @@ def massage_expected_result_data(values, path, keep_all=False, remove_dynamic=Fa
|
|||
if key == '.id' or key in path_info.fields:
|
||||
continue
|
||||
del entry[key]
|
||||
for key, data in path_info.fields.items():
|
||||
if data.absent_value is not None and key not in entry:
|
||||
entry[key] = data.absent_value
|
||||
return values
|
||||
|
||||
|
||||
class Path(object):
|
||||
def __init__(self, path, initial_values, read_only=False):
|
||||
self._path = path
|
||||
self._path_info = PATHS[path]
|
||||
versioned_path_info = PATHS[path]
|
||||
versioned_path_info.provide_version(FAKE_ROS_VERSION)
|
||||
self._path_info = versioned_path_info.get_data()
|
||||
self._values = [entry.copy() for entry in initial_values]
|
||||
for entry in self._values:
|
||||
_normalize_entry(entry, self._path_info)
|
||||
self._new_id_counter = 0
|
||||
self._read_only = read_only
|
||||
|
||||
def _sanitize(self, entry):
|
||||
entry = entry.copy()
|
||||
for field, field_info in self._path_info.fields.items():
|
||||
if field in entry:
|
||||
if field_info.write_only:
|
||||
del entry[field]
|
||||
return entry
|
||||
|
||||
def __iter__(self):
|
||||
return [entry.copy() for entry in self._values].__iter__()
|
||||
return [self._sanitize(entry) for entry in self._values].__iter__()
|
||||
|
||||
def _find_id(self, id, required=False):
|
||||
for index, entry in enumerate(self._values):
|
||||
|
@ -173,13 +195,23 @@ class Path(object):
|
|||
raise Exception('Modifying read-only path: add %s' % repr(kwargs))
|
||||
if '.id' in kwargs:
|
||||
raise Exception('Trying to create new entry with ".id" field: %s' % repr(kwargs))
|
||||
if 'dynamic' in kwargs or 'builtin' in kwargs:
|
||||
raise Exception('Trying to add a dynamic or builtin entry')
|
||||
self._new_id_counter += 1
|
||||
id = '*NEW%d' % self._new_id_counter
|
||||
entry = {
|
||||
'.id': id,
|
||||
}
|
||||
entry.update(kwargs)
|
||||
_normalize_entry(entry, self._path_info)
|
||||
for field, value in kwargs.items():
|
||||
if field.startswith('!'):
|
||||
field = field[1:]
|
||||
if field not in self._path_info.fields:
|
||||
raise ValueError('Trying to set unknown field "{field}"'.format(field=field))
|
||||
field_info = self._path_info.fields[field]
|
||||
if field_info.read_only:
|
||||
raise ValueError('Trying to set read-only field "{field}"'.format(field=field))
|
||||
entry[field] = value
|
||||
_normalize_entry(entry, self._path_info, on_create=True)
|
||||
self._values.append(entry)
|
||||
return id
|
||||
|
||||
|
@ -190,16 +222,33 @@ class Path(object):
|
|||
raise Exception('Modifying read-only path: remove %s' % repr(args))
|
||||
for id in args:
|
||||
index = self._find_id(id, required=True)
|
||||
entry = self._values[index]
|
||||
if entry.get('dynamic', False) or entry.get('builtin', False):
|
||||
raise Exception('Trying to remove a dynamic or builtin entry')
|
||||
del self._values[index]
|
||||
|
||||
def update(self, **kwargs):
|
||||
if self._read_only:
|
||||
raise Exception('Modifying read-only path: update %s' % repr(kwargs))
|
||||
if 'dynamic' in kwargs or 'builtin' in kwargs:
|
||||
raise Exception('Trying to update dynamic builtin fields')
|
||||
if self._path_info.single_value:
|
||||
index = 0
|
||||
else:
|
||||
index = self._find_id(kwargs['.id'], required=True)
|
||||
entry = self._values[index]
|
||||
if entry.get('dynamic', False) or entry.get('builtin', False):
|
||||
raise Exception('Trying to update a dynamic or builtin entry')
|
||||
for field in kwargs:
|
||||
if field == '.id':
|
||||
continue
|
||||
if field.startswith('!'):
|
||||
field = field[1:]
|
||||
if field not in self._path_info.fields:
|
||||
raise ValueError('Trying to update unknown field "{field}"'.format(field=field))
|
||||
field_info = self._path_info.fields[field]
|
||||
if field_info.read_only:
|
||||
raise ValueError('Trying to update read-only field "{field}"'.format(field=field))
|
||||
entry.update(kwargs)
|
||||
_normalize_entry(entry, self._path_info)
|
||||
|
||||
|
|
3
tests/unit/plugins/modules/fixtures/facts/export.license
Normal file
3
tests/unit/plugins/modules/fixtures/facts/export.license
Normal file
|
@ -0,0 +1,3 @@
|
|||
GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue