diff options
19 files changed, 337 insertions, 159 deletions
@@ -1,24 +1,21 @@ # VyOS Collection -[](https://codecov.io/gh/ansible-collections/vyos.vyos) -[](https://github.com/ansible-collections/vyos.vyos/actions/workflows/tests.yml) +[](https://codecov.io/gh/ansible-collections/vyos.vyos) +[](https://github.com/vyos/vyos.vyos/actions/workflows/tests.yml) The Ansible VyOS collection includes a variety of Ansible content to help automate the management of VyOS network appliances. -This collection has been tested against VyOS 1.1.8 (helium). +This collection has been tested against VyOS 1.3.8, 1.4.1 and the current rolling release for 1.5. Where possible, +compatibility with older versions of VyOS are maintained but not guaranteed. ## Communication -* Join the Ansible forum: - * [Get Help](https://forum.ansible.com/c/help/6): get help or help others. - * [Posts tagged with 'vyos'](https://forum.ansible.com/tag/vyos): subscribe to participate in collection-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. +* Join the VyOS forum: + * [FAQ](https://forum.vyos.io/faq): find answers to frequently asked questions. + * [Guides and How To](https://forum.vyos.io/c/howto-guies/27): find guides and how-to articles. + * [News & Announcements](https://forum.vyos.io/c/announcements/6): track project-wide announcements . -* 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). <!--start requires_ansible--> ## Ansible version compatibility @@ -141,14 +138,13 @@ The following example task replaces configuration changes in the existing config ## Contributing to this collection -We welcome community contributions to this collection. If you find problems, please open an issue or create a PR against the [VyOS collection repository](https://github.com/ansible-collections/vyos). See [Contributing to Ansible-maintained collections](https://docs.ansible.com/ansible/devel/community/contributing_maintained_collections.html#contributing-maintained-collections) for complete details. +We welcome community contributions to this collection. If you find problems, please open an issue or create a PR against the [VyOS collection repository](https://github.com/vyos/vyos.vyos). See [Contributing to VyOS](https://vyos.net/contribute/) for complete details. You can also join us on: -- IRC - the ``#ansible-network`` [irc.libera.chat](https://libera.chat/) channel -- Slack - https://ansiblenetwork.slack.com +- Forum - https://forum.vyos.io -See the [Ansible Community Guide](https://docs.ansible.com/ansible/latest/community/index.html) for details on contributing to Ansible. +See the [Contributing to VyOS](https://vyos.net/contribute/) for details on contributing to Ansible. ### Code of Conduct This collection follows the Ansible project's @@ -197,8 +193,6 @@ ansible-playbook -e rm_dest=`pwd` \ Unlike the `resource_module_builder`, the `cli_rm_builder` does not require the `model` parameter. Instead, it uses the `resource` parameter to specify the resource to build. - - ### Testing playbooks You can use `ANSIBLE_COLLECTIONS_PATH` to test the collection locally. For example: @@ -211,14 +205,35 @@ ANSIBLE_COLLECTIONS_PATHS=~/my_dev_path ansible-playbook -i inventory.network te ## Release notes -Release notes are available [here](https://github.com/ansible-collections/vyos.vyos/blob/main/CHANGELOG.rst). +Release notes are available [here](https://github.com/vyos/vyos.vyos/blob/main/CHANGELOG.rst). ## Roadmap <!-- Optional. Include the roadmap for this collection, and the proposed release/versioning strategy so users can anticipate the upgrade/update cycle. --> +Major Version | Ansible Support | VyOS Support | Details +--- | --- | --- | --- +4.1.0 | 2.15 | 1.1.2 | Final release for the 4.x series +5.0.0 | 2.16 | 1.1.2 | First relase under VyOS control as a separate collection +6.0.0 | 2.18 | 1.3.8 | *Planned* release for supporting VyOS 1.3.8+ +7.0.0 | x.xx | 1.4.x | *Prospective* release deprecating incompatible 1.3.x modules + +Note: +- Unreleased versions are not guaranteed to be released as described. +- Some modules may support a wider variety of versions depending upon the compatibility + with prior versions of VyOS. +- The roadmap is subject to change based on community feedback and contributions. + + ## More information +VyOS resources +- [Contributing to VyOS](https://vyos.net/contribute) +- [VyOS documentation](https://docs.vyos.io/en/latest/) +- [VyOS forum](https://forum.vyos.io) + + +Ansible Resources - [Ansible network resources](https://docs.ansible.com/ansible/latest/network/getting_started/network_resources.html) - [Ansible Collection overview](https://github.com/ansible-collections/overview) - [Ansible User guide](https://docs.ansible.com/ansible/latest/user_guide/index.html) diff --git a/changelogs/fragments/T6987-logging-changes.yml b/changelogs/fragments/T6987-logging-changes.yml new file mode 100644 index 00000000..c4b11da6 --- /dev/null +++ b/changelogs/fragments/T6987-logging-changes.yml @@ -0,0 +1,15 @@ +--- +minor_changes: + - deprecating items for 1.4+ that have moved locations + - For 1.4, `protocol` is an attribute of the syslog host, not the facility + - Fixed v1.3 and before when `protocol` and `level` were set for the same host + - Fixed integration test for `vyos_facts` which was brittle due to line dependencies in checks + - Fixed integration test for `vyos_config` due to bad commands. 1.3 frequently won't finish due + to timeouts or system failures during the tests, but 1.4 and 1.5 + +breaking_changes: + - none yet + +known_issues: + - existing code for 1.3 facility protocol and facility level are not compatible, + only one will be set and level is the priority. diff --git a/docs/vyos.vyos.vyos_logging_global_module.rst b/docs/vyos.vyos.vyos_logging_global_module.rst index 1111b6c1..6d8550a6 100644 --- a/docs/vyos.vyos.vyos_logging_global_module.rst +++ b/docs/vyos.vyos.vyos_logging_global_module.rst @@ -719,7 +719,7 @@ Parameters </ul> </td> <td> - <div>syslog communication protocol</div> + <div>syslog communication protocol. Version 1.3 and below.</div> </td> </tr> <tr> @@ -786,6 +786,27 @@ Parameters <div>Destination port (1-65535)</div> </td> </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>protocol</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>udp</li> + <li>tcp</li> + </ul> + </td> + <td> + <div>syslog communication protocol. Version 1.4+</div> + </td> + </tr> <tr> <td class="elbow-placeholder"></td> @@ -1003,7 +1024,7 @@ Notes ----- .. note:: - - Tested against vyos 1.2 + - Tested against vyos 1.3.8+ - This module works with connection ``network_cli``. - The Configuration defaults of the Vyos network devices are supposed to hinder idempotent behavior of plays @@ -1632,7 +1653,7 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late <div>The provided configuration in the task rendered in device-native format (offline).</div> <br/> <div style="font-size: smaller"><b>Sample:</b></div> - <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['set system syslog host 172.16.0.1 port 223', 'set system syslog user vyos facility local7 level debug', 'set system syslog global facility cron level debug']</div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['set system syslog host 172.16.0.1 port 223', 'set system syslog user vyos facility local7 level debug', 'set system syslog global facility cron level debu']</div> </td> </tr> </table> diff --git a/plugins/module_utils/network/vyos/argspec/logging_global/logging_global.py b/plugins/module_utils/network/vyos/argspec/logging_global/logging_global.py index 0be49e51..734d190e 100644 --- a/plugins/module_utils/network/vyos/argspec/logging_global/logging_global.py +++ b/plugins/module_utils/network/vyos/argspec/logging_global/logging_global.py @@ -175,6 +175,8 @@ class Logging_globalArgs(object): # pylint: disable=R0903 "file_num": {"type": "int"}, "size": {"type": "int"}, }, + "removed_in_version": "7.0.0", + "removed_from_collection": "vyos.vyos", }, "facilities": { "type": "list", @@ -282,10 +284,16 @@ class Logging_globalArgs(object): # pylint: disable=R0903 "protocol": { "type": "str", "choices": ["udp", "tcp"], + "removed_in_version": "7.0.0", + "removed_from_collection": "vyos.vyos", }, }, }, "hostname": {"type": "str"}, + "protocol": { + "type": "str", + "choices": ["udp", "tcp"], + }, }, }, "syslog": { diff --git a/plugins/module_utils/network/vyos/config/logging_global/logging_global.py b/plugins/module_utils/network/vyos/config/logging_global/logging_global.py index d8bfa182..f94c9195 100644 --- a/plugins/module_utils/network/vyos/config/logging_global/logging_global.py +++ b/plugins/module_utils/network/vyos/config/logging_global/logging_global.py @@ -59,6 +59,8 @@ class Logging_global(ResourceModule): "files.archive.file_num", "files", "hosts.port", + "hosts.facility.protocol", # 1.3 and below + "hosts.protocol", "hosts", "users", ] diff --git a/plugins/module_utils/network/vyos/rm_templates/logging_global.py b/plugins/module_utils/network/vyos/rm_templates/logging_global.py index 6c692cfd..516e270b 100644 --- a/plugins/module_utils/network/vyos/rm_templates/logging_global.py +++ b/plugins/module_utils/network/vyos/rm_templates/logging_global.py @@ -28,7 +28,7 @@ def tmplt_params(config_data): tmplt += " facility {facility}".format(facility=val["facility"]) if val.get("severity"): tmplt += " level {level}".format(level=val["severity"]) - if val.get("protocol"): + elif val.get("protocol"): tmplt += " protocol {protocol}".format(protocol=val["protocol"]) return tmplt @@ -50,7 +50,12 @@ def tmplt_params(config_data): tmplt = templt_common(val.get("facilities"), tmplt) elif config_data.get("hosts"): val = config_data.get("hosts") - if val.get("hostname") and not val.get("archive") and not val.get("port"): + if ( + val.get("hostname") + and not val.get("archive") + and not val.get("port") + and not val.get("protocol") + ): tmplt += "system syslog host {hostname}".format(hostname=val["hostname"]) if val.get("facilities"): tmplt = templt_common(val.get("facilities"), tmplt) @@ -352,6 +357,51 @@ class Logging_globalTemplate(NetworkTemplate): }, }, { + "name": "hosts.protocol", + "getval": re.compile( + r""" + ^set\ssystem\ssyslog\shost + (\s(?P<hostname>\S+)) + (\sprotocol\s(?P<protocol>'(udp|tcp)')) + $""", re.VERBOSE, + ), + "setval": "system syslog host {{ hosts.hostname }} protocol {{ hosts.protocol }}", + "result": { + "hosts": { + "{{ hostname }}": { + "hostname": "{{ hostname }}", + "protocol": "{{ protocol }}", + }, + }, + }, + }, + { + # Version 1.3 and below + "name": "hosts.facility.protocol", + "getval": re.compile( + r""" + ^set\ssystem\ssyslog\shost + (\s(?P<hostname>\S+)) + (\sfacility\s(?P<facility>all|auth|authpriv|cron|daemon|kern|lpr|mail|mark|news|protocols|security|syslog|user|uucp|local[0-7])) + (\sprotocol\s(?P<protocol>'(udp|tcp)')) + $""", re.VERBOSE, + ), + "setval": "system syslog host {{ hosts.hostname }} facility {{ hosts.facility }} protocol {{ hosts.protocol }}", + "remval": "system syslog host {{ hosts.hostname }} facility {{ hosts.facility }} protocol {{ hosts.protocol }}", + "result": { + "hosts": { + "{{ hostname }}": { + "hostname": "{{ hostname }}", + "facilities": [ + { + "facility": "{{ facility }}", + "protocol": "{{ protocol }}", + }, ], + }, + }, + }, + }, + { "name": "hosts", "getval": re.compile( r""" @@ -359,7 +409,6 @@ class Logging_globalTemplate(NetworkTemplate): (\s(?P<hostname>\S+)) (\sfacility\s(?P<facility>all|auth|authpriv|cron|daemon|kern|lpr|mail|mark|news|protocols|security|syslog|user|uucp|local[0-7])) (\slevel\s(?P<level>'(emerg|alert|crit|err|warning|notice|info|debug|all)'))? - (\sprotocol\s(?P<protocol>'(udp|tcp)'))? $""", re.VERBOSE, ), "setval": tmplt_params, @@ -372,7 +421,6 @@ class Logging_globalTemplate(NetworkTemplate): { "facility": "{{ facility }}", "severity": "{{ level }}", - "protocol": "{{ protocol }}", }, ], }, }, diff --git a/plugins/modules/vyos_logging_global.py b/plugins/modules/vyos_logging_global.py index 069d5080..9479e7b2 100644 --- a/plugins/modules/vyos_logging_global.py +++ b/plugins/modules/vyos_logging_global.py @@ -20,7 +20,7 @@ short_description: Logging resource module description: This module manages the logging attributes of Vyos network devices author: Sagar Paul (@KB-perByte) notes: - - Tested against vyos 1.2 + - Tested against vyos 1.3.8+ - This module works with connection C(network_cli). - The Configuration defaults of the Vyos network devices are supposed to hinder idempotent behavior of plays @@ -139,7 +139,7 @@ options: facility: *facility severity: *severity protocol: - description: syslog communication protocol + description: syslog communication protocol. Version 1.3 and below. type: str choices: - udp @@ -147,6 +147,12 @@ options: hostname: description: Remote host name or IP address type: str + protocol: + description: syslog communication protocol. Version 1.4+ + type: str + choices: + - udp + - tcp syslog: description: logging syslog type: dict @@ -715,17 +721,17 @@ commands: returned: when I(state) is C(merged), C(replaced), C(overridden), C(deleted) or C(purged) type: list sample: - - "set system syslog console facility local7 level err" - - "set system syslog host 172.16.0.1 port 223" - - "set system syslog global archive size 111" + - set system syslog console facility local7 level err + - set system syslog host 172.16.0.1 port 223 + - set system syslog global archive size 111 rendered: description: The provided configuration in the task rendered in device-native format (offline). returned: when I(state) is C(rendered) type: list sample: - - "set system syslog host 172.16.0.1 port 223" - - "set system syslog user vyos facility local7 level debug" - - "set system syslog global facility cron level debug" + - set system syslog host 172.16.0.1 port 223 + - set system syslog user vyos facility local7 level debug + - set system syslog global facility cron level debu gathered: description: Facts about the network resource gathered from the remote device as structured data. returned: when I(state) is C(gathered) diff --git a/tests/integration/targets/vyos_config/tests/cli/check_config.yaml b/tests/integration/targets/vyos_config/tests/cli/check_config.yaml index 5e028549..8e2e8372 100644 --- a/tests/integration/targets/vyos_config/tests/cli/check_config.yaml +++ b/tests/integration/targets/vyos_config/tests/cli/check_config.yaml @@ -45,9 +45,9 @@ register: result vyos.vyos.vyos_config: lines: - - set system login user esa level admin + - set system login user esa full-name 'ESA admin' - set system login user esa authentication encrypted-password '!abc!' - - set system login user vyos level admin + - set system login user vyos full-name 'VyOS admin' - set system login user vyos authentication encrypted-password 'abc' - assert: diff --git a/tests/integration/targets/vyos_config/tests/redirection/cli/shortname.yaml b/tests/integration/targets/vyos_config/tests/redirection/cli/shortname.yaml index 33fb3be5..0d88d0cb 100644 --- a/tests/integration/targets/vyos_config/tests/redirection/cli/shortname.yaml +++ b/tests/integration/targets/vyos_config/tests/redirection/cli/shortname.yaml @@ -45,9 +45,9 @@ register: result vyos.vyos.config: lines: - - set system login user esa level admin + - set system login user esa full-name 'ESA admin' - set system login user esa authentication encrypted-password '!abc!' - - set system login user vyos level admin + - set system login user vyos full-name 'VyOS admin' - set system login user vyos authentication encrypted-password 'abc' - assert: diff --git a/tests/integration/targets/vyos_facts/tests/cli/basic_facts.yaml b/tests/integration/targets/vyos_facts/tests/cli/basic_facts.yaml index 232132e1..50e95889 100644 --- a/tests/integration/targets/vyos_facts/tests/cli/basic_facts.yaml +++ b/tests/integration/targets/vyos_facts/tests/cli/basic_facts.yaml @@ -31,9 +31,9 @@ - name: check that version info is present assert: that: - - result.ansible_facts.ansible_net_version in vyos_version.stdout_lines[0][0] - - result.ansible_facts.ansible_net_model in vyos_version.stdout_lines[0][9] - - result.ansible_facts.ansible_net_serialnum in vyos_version.stdout_lines[0][10] + - result.ansible_facts.ansible_net_version in (vyos_version.stdout_lines[0] | select('search', 'Version:') | list | first) + - result.ansible_facts.ansible_net_model in (vyos_version.stdout_lines[0] | select('search', 'Hardware model:') | list | first) + - result.ansible_facts.ansible_net_serialnum in (vyos_version.stdout_lines[0] | select('search', 'Hardware S/N:') | list | first) - name: check that config info is present assert: diff --git a/tests/integration/targets/vyos_facts/tests/redirection/cli/shortname.yaml b/tests/integration/targets/vyos_facts/tests/redirection/cli/shortname.yaml index 05399f1d..35233728 100644 --- a/tests/integration/targets/vyos_facts/tests/redirection/cli/shortname.yaml +++ b/tests/integration/targets/vyos_facts/tests/redirection/cli/shortname.yaml @@ -31,9 +31,9 @@ - name: check that version info is present assert: that: - - result.ansible_facts.ansible_net_version in vyos_version.stdout_lines[0][0] - - result.ansible_facts.ansible_net_model in vyos_version.stdout_lines[0][9] - - result.ansible_facts.ansible_net_serialnum in vyos_version.stdout_lines[0][10] + - result.ansible_facts.ansible_net_version in (vyos_version.stdout_lines[0] | select('search', 'Version:') | list | first) + - result.ansible_facts.ansible_net_model in (vyos_version.stdout_lines[0] | select('search', 'Hardware model:') | list | first) + - result.ansible_facts.ansible_net_serialnum in (vyos_version.stdout_lines[0] | select('search', 'Hardware S/N:') | list | first) - name: check that config info is present assert: diff --git a/tests/integration/targets/vyos_logging_global/tests/cli/_get_version.yaml b/tests/integration/targets/vyos_logging_global/tests/cli/_get_version.yaml new file mode 100644 index 00000000..2588b194 --- /dev/null +++ b/tests/integration/targets/vyos_logging_global/tests/cli/_get_version.yaml @@ -0,0 +1,28 @@ +- name: make sure to get facts + vyos.vyos.vyos_facts: + vars: + ansible_connection: ansible.netcommon.network_cli + register: vyos_facts + when: vyos_version is not defined + +- name: debug vyos_facts + debug: + var: vyos_facts + +- name: pull version from facts + set_fact: + vyos_version: "{{ vyos_facts.ansible_facts.ansible_net_version.split('-')[0].split(' ')[-1] }}" + when: vyos_version is not defined + +- name: fix '.0' versions + set_fact: + vyos_version: "{{ vyos_version }}.0" + when: vyos_version.count('.') == 1 + +- name: include correct vars + include_vars: pre-v1_4.yaml + when: vyos_version is version('1.4.0', '<', version_type='semver') + +- name: include correct vars + include_vars: v1_4.yaml + when: vyos_version is version('1.4.0', '>=', version_type='semver') diff --git a/tests/integration/targets/vyos_logging_global/tests/cli/_populate.yaml b/tests/integration/targets/vyos_logging_global/tests/cli/_populate.yaml index 516df94a..89fb8e51 100644 --- a/tests/integration/targets/vyos_logging_global/tests/cli/_populate.yaml +++ b/tests/integration/targets/vyos_logging_global/tests/cli/_populate.yaml @@ -21,17 +21,7 @@ severity: emerg - facility: local7 severity: emerg - hosts: - - hostname: 172.16.2.15 - facilities: - - facility: all - severity: all - - facility: all - protocol: udp - - hostname: 172.16.2.12 - facilities: - - facility: all - protocol: udp + hosts: "{{ populate_logging_global_hosts }}" users: - username: vyos facilities: @@ -44,9 +34,6 @@ - facility: local7 severity: err global_params: - archive: - file_num: 2 - size: 111 facilities: - facility: cron severity: debug diff --git a/tests/integration/targets/vyos_logging_global/tests/cli/merged.yaml b/tests/integration/targets/vyos_logging_global/tests/cli/merged.yaml index b4d38565..02c4c618 100644 --- a/tests/integration/targets/vyos_logging_global/tests/cli/merged.yaml +++ b/tests/integration/targets/vyos_logging_global/tests/cli/merged.yaml @@ -2,47 +2,25 @@ - debug: msg: START vyos_logging_global merged integration tests on connection={{ ansible_connection }} +- include_tasks: _get_version.yaml - include_tasks: _remove_config.yaml - block: - # no after state match because 1.1.8 vyos does show all commands on show command - name: Merge the provided configuration with the existing running configuration register: result vyos.vyos.vyos_logging_global: &id001 - config: - console: - facilities: - - facility: all - files: - - path: def - archive: - file_num: 2 - facilities: - - facility: local6 - severity: emerg - hosts: - - hostname: 172.16.2.15 - facilities: - - facility: all - severity: all - users: - - username: vyos - facilities: - - facility: local7 - severity: debug - global_params: - archive: - file_num: 2 - size: 111 - facilities: - - facility: cron - severity: debug + config: "{{ merged.after }}" state: merged + - debug: + var: merged['commands'] | symmetric_difference(result['commands']) + - name: Assert that correct set of commands were generated assert: that: - "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}" + - result.changed == true + - result.after == merged.after - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) register: result diff --git a/tests/integration/targets/vyos_logging_global/tests/cli/overridden.yaml b/tests/integration/targets/vyos_logging_global/tests/cli/overridden.yaml index eacdca22..b0ca2ffd 100644 --- a/tests/integration/targets/vyos_logging_global/tests/cli/overridden.yaml +++ b/tests/integration/targets/vyos_logging_global/tests/cli/overridden.yaml @@ -5,7 +5,6 @@ - include_tasks: _populate.yaml - block: - # no after state match because 1.1.8 vyos does show all commands on show command - name: Overrides all device configuration with provided configuration register: result vyos.vyos.vyos_logging_global: &id001 @@ -17,15 +16,13 @@ severity: err - facility: news severity: debug - global_params: - archive: - file_num: 2 state: overridden - name: Assert that correct commands were generated assert: that: - "{{ overridden['commands'] | symmetric_difference(result['commands']) |length == 0 }}" + - "result.changed == true" - name: Overrides all device configuration with provided configurations (IDEMPOTENT) register: result diff --git a/tests/integration/targets/vyos_logging_global/tests/cli/rendered.yaml b/tests/integration/targets/vyos_logging_global/tests/cli/rendered.yaml index 3746dd71..27d5d6e3 100644 --- a/tests/integration/targets/vyos_logging_global/tests/cli/rendered.yaml +++ b/tests/integration/targets/vyos_logging_global/tests/cli/rendered.yaml @@ -27,9 +27,6 @@ - facility: local7 severity: debug global_params: - archive: - file_num: 2 - size: 111 facilities: - facility: cron severity: debug diff --git a/tests/integration/targets/vyos_logging_global/vars/main.yaml b/tests/integration/targets/vyos_logging_global/vars/main.yaml index 8d22af0b..13ca654f 100644 --- a/tests/integration/targets/vyos_logging_global/vars/main.yaml +++ b/tests/integration/targets/vyos_logging_global/vars/main.yaml @@ -1,68 +1,4 @@ --- -merged: - before: {} - commands: - - set system syslog host 172.16.2.15 facility all level all - - set system syslog console facility all - - set system syslog user vyos facility local7 level debug - - set system syslog global facility cron level debug - - set system syslog global archive file 2 - - set system syslog global archive size 111 - - set system syslog file def archive file 2 - - set system syslog file def facility local6 level emerg - after: - console: - facilities: - - facility: all - files: - - path: def - facilities: - - facility: local6 - severity: emerg - hosts: - - hostname: 172.16.2.15 - facilities: - - facility: all - severity: all - users: - - username: vyos - facilities: - - facility: local7 - severity: debug - global_params: - archive: - size: 111 - facilities: - - facility: cron - severity: debug - -overridden: - commands: - - delete system syslog file def - - delete system syslog global facility cron - - delete system syslog global facility local7 - - delete system syslog host 172.16.2.12 - - delete system syslog host 172.16.2.15 - - delete system syslog user paul - - delete system syslog user vyos - - set system syslog console facility all - - set system syslog global archive file 2 - - delete system syslog global archive size 111 - - after: - console: - facilities: - - facility: all - - facility: local7 - severity: err - - facility: news - severity: debug - files: - - path: Myfile - global_params: - archive: - file_num: 2 - rendered: commands: - set system syslog console facility all @@ -70,8 +6,6 @@ rendered: - set system syslog host 172.16.2.15 facility all level all - set system syslog user vyos facility local7 level debug - set system syslog global facility cron level debug - - set system syslog global archive file 2 - - set system syslog global archive size 111 deleted: commands: diff --git a/tests/integration/targets/vyos_logging_global/vars/pre-v1_4.yaml b/tests/integration/targets/vyos_logging_global/vars/pre-v1_4.yaml new file mode 100644 index 00000000..6af72488 --- /dev/null +++ b/tests/integration/targets/vyos_logging_global/vars/pre-v1_4.yaml @@ -0,0 +1,68 @@ +--- +host_172_16_2_15: &host_172_16_2_15 + - hostname: 172.16.2.15 + facilities: + - facility: all + severity: all + +merged: + before: {} + commands: + - set system syslog host 172.16.2.15 facility all level all + - set system syslog console facility all + - set system syslog user vyos facility local7 level debug + - set system syslog global facility cron level debug + - set system syslog file def archive file 2 + - set system syslog file def facility local6 level emerg + after: + console: + facilities: + - facility: all + files: + - path: def + facilities: + - facility: local6 + severity: emerg + archive: + file_num: 2 + hosts: *host_172_16_2_15 + users: + - username: vyos + facilities: + - facility: local7 + severity: debug + global_params: + facilities: + - facility: cron + severity: debug + +overridden: + commands: + - delete system syslog file def + - delete system syslog global facility cron + - delete system syslog global facility local7 + - delete system syslog host 172.16.2.12 + - delete system syslog host 172.16.2.15 + - delete system syslog user paul + - delete system syslog user vyos + + after: + console: + facilities: + - facility: all + - facility: local7 + severity: err + - facility: news + severity: debug + files: + - path: Myfile + +populate_logging_global_hosts: + - hostname: 172.16.2.15 + facilities: + - facility: all + protocol: udp + - hostname: 172.16.2.12 + facilities: + - facility: all + protocol: udp diff --git a/tests/integration/targets/vyos_logging_global/vars/v1_4.yaml b/tests/integration/targets/vyos_logging_global/vars/v1_4.yaml new file mode 100644 index 00000000..bfe5e12d --- /dev/null +++ b/tests/integration/targets/vyos_logging_global/vars/v1_4.yaml @@ -0,0 +1,74 @@ +--- +host_172_16_2_15: &host_172_16_2_15 + - hostname: 172.16.2.15 + facilities: + - facility: all + severity: all + protocol: tcp + +merged: + before: {} + commands: + - set system syslog host 172.16.2.15 facility all level all + - set system syslog host 172.16.2.15 protocol tcp + - set system syslog console facility all + - set system syslog user vyos facility local7 level debug + - set system syslog global facility cron level debug + - set system syslog file def archive file 2 + - set system syslog file def facility local6 level emerg + after: + console: + facilities: + - facility: all + files: + - path: def + facilities: + - facility: local6 + severity: emerg + archive: + file_num: 2 + hosts: *host_172_16_2_15 + users: + - username: vyos + facilities: + - facility: local7 + severity: debug + global_params: + facilities: + - facility: cron + severity: debug + +overridden: + commands: + - delete system syslog file def + - delete system syslog global facility cron + - delete system syslog global facility local7 + - delete system syslog host 172.16.2.12 protocol udp + - delete system syslog host 172.16.2.15 protocol udp + - delete system syslog host 172.16.2.12 + - delete system syslog host 172.16.2.15 + - delete system syslog user paul + - delete system syslog user vyos + + after: + console: + facilities: + - facility: all + - facility: local7 + severity: err + - facility: news + severity: debug + files: + - path: Myfile + +populate_logging_global_hosts: + - hostname: 172.16.2.15 + facilities: + - facility: all + severity: all + - facility: all + protocol: udp + - hostname: 172.16.2.12 + facilities: + - facility: all + protocol: udp |