diff options
author | Rohit <rohitthakur2590@outlook.com> | 2020-06-01 13:05:52 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-01 07:35:52 +0000 |
commit | 06235439435396c852535c2569542939bf65ef43 (patch) | |
tree | ff9facb3636f13b205bea0d14c7b0c9b12e3f18a | |
parent | 24a6864db07e5f61cdd952a528d4fd6c147d8db4 (diff) | |
download | vyos.vyos-06235439435396c852535c2569542939bf65ef43.tar.gz vyos.vyos-06235439435396c852535c2569542939bf65ef43.zip |
[VyOS: ]all modules updated with FQCN and new doc changes (#33)
[VyOS: ]all modules updated with FQCN and new doc changes
Reviewed-by: https://github.com/apps/ansible-zuul
26 files changed, 1133 insertions, 1198 deletions
diff --git a/plugins/modules/vyos_banner.py b/plugins/modules/vyos_banner.py index b08fb73..aa0bd5c 100644 --- a/plugins/modules/vyos_banner.py +++ b/plugins/modules/vyos_banner.py @@ -19,18 +19,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -ANSIBLE_METADATA = { - "metadata_version": "1.1", - "status": ["preview"], - "supported_by": "network", -} -DOCUMENTATION = """module: vyos_banner +DOCUMENTATION = """ +module: vyos_banner author: Trishna Guha (@trishnaguha) short_description: Manage multiline banners on VyOS devices description: - This will configure both pre-login and post-login banners on remote devices running VyOS. It allows playbooks to add or remote banner text from the active running configuration. +version_added: 1.0.0 notes: - Tested against VyOS 1.1.8 (helium). - This module works with connection C(network_cli). See L(the VyOS OS Platform Options,../network/user_guide/platform_vyos.html). @@ -60,7 +57,7 @@ extends_documentation_fragment: EXAMPLES = """ - name: configure the pre-login banner - vyos_banner: + vyos.vyos.vyos_banner: banner: pre-login text: | this is my pre-login banner @@ -68,7 +65,7 @@ EXAMPLES = """ string state: present - name: remove the post-login banner - vyos_banner: + vyos.vyos.vyos_banner: banner: post-login state: absent """ diff --git a/plugins/modules/vyos_command.py b/plugins/modules/vyos_command.py index 1853849..58e98c9 100644 --- a/plugins/modules/vyos_command.py +++ b/plugins/modules/vyos_command.py @@ -16,14 +16,9 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -ANSIBLE_METADATA = { - "metadata_version": "1.1", - "status": ["preview"], - "supported_by": "network", -} - -DOCUMENTATION = """module: vyos_command +DOCUMENTATION = """ +module: vyos_command author: Nathaniel Case (@Qalthos) short_description: Run one or more commands on VyOS devices description: @@ -34,6 +29,7 @@ description: - Certain C(show) commands in VyOS produce many lines of output and use a custom pager that can cause this module to hang. If the value of the environment variable C(ANSIBLE_VYOS_TERMINAL_LENGTH) is not set, the default number of 10000 is used. +version_added: 1.0.0 extends_documentation_fragment: - vyos.vyos.vyos options: @@ -84,29 +80,29 @@ notes: """ EXAMPLES = """ -tasks: - - name: show configuration on ethernet devices eth0 and eth1 - vyos_command: - commands: - - show interfaces ethernet {{ item }} - with_items: - - eth0 - - eth1 - - - name: run multiple commands and check if version output contains specific version string - vyos_command: - commands: - - show version - - show hardware cpu - wait_for: - - "result[0] contains 'VyOS 1.1.7'" - - - name: run command that requires answering a prompt - vyos_command: - commands: - - command: 'rollback 1' - prompt: 'Proceed with reboot? [confirm][y]' - answer: y +- name: show configuration on ethernet devices eth0 and eth1 + vyos.vyos.vyos_command: + commands: + - show interfaces ethernet {{ item }} + with_items: + - eth0 + - eth1 + +- name: run multiple commands and check if version output contains specific version + string + vyos.vyos.vyos_command: + commands: + - show version + - show hardware cpu + wait_for: + - result[0] contains 'VyOS 1.1.7' + +- name: run command that requires answering a prompt + vyos.vyos.vyos_command: + commands: + - command: rollback 1 + prompt: Proceed with reboot? [confirm][y] + answer: y """ RETURN = """ diff --git a/plugins/modules/vyos_config.py b/plugins/modules/vyos_config.py index b899045..baa63f3 100644 --- a/plugins/modules/vyos_config.py +++ b/plugins/modules/vyos_config.py @@ -16,14 +16,9 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -ANSIBLE_METADATA = { - "metadata_version": "1.1", - "status": ["preview"], - "supported_by": "network", -} - -DOCUMENTATION = """module: vyos_config +DOCUMENTATION = """ +module: vyos_config author: Nathaniel Case (@Qalthos) short_description: Manage VyOS configuration on remote device description: @@ -31,6 +26,7 @@ description: arguments for managing both the configuration file and state of the active configuration. All configuration statements are based on `set` and `delete` commands in the device configuration. +version_added: 1.0.0 extends_documentation_fragment: - vyos.vyos.vyos notes: @@ -65,7 +61,7 @@ options: the playbook root directory or role root directory, if playbook is part of an ansible role. If the directory does not exist, it is created. type: bool - default: 'no' + default: no comment: description: - Allows a commit description to be specified to be included when the configuration @@ -83,7 +79,7 @@ options: are saved to disk. This is independent of committing the config. When set to True, the active configuration is saved. type: bool - default: 'no' + default: no backup_options: description: - This is a dict object containing configurable options related to backup file @@ -110,29 +106,29 @@ options: EXAMPLES = """ - name: configure the remote device - vyos_config: + vyos.vyos.vyos_config: lines: - - set system host-name {{ inventory_hostname }} - - set service lldp - - delete service dhcp-server + - set system host-name {{ inventory_hostname }} + - set service lldp + - delete service dhcp-server - name: backup and load from file - vyos_config: + vyos.vyos.vyos_config: src: vyos.cfg backup: yes - name: render a Jinja2 template onto the VyOS router - vyos_config: + vyos.vyos.vyos_config: src: vyos_template.j2 - name: for idempotency, use full-form commands - vyos_config: + vyos.vyos.vyos_config: lines: # - set int eth eth2 description 'OUTSIDE' - - set interface ethernet eth2 description 'OUTSIDE' + - set interface ethernet eth2 description 'OUTSIDE' - name: configurable backup path - vyos_config: + vyos.vyos.vyos_config: backup: yes backup_options: filename: backup.cfg diff --git a/plugins/modules/vyos_facts.py b/plugins/modules/vyos_facts.py index 72b191c..7521a3b 100644 --- a/plugins/modules/vyos_facts.py +++ b/plugins/modules/vyos_facts.py @@ -8,20 +8,15 @@ The module file for vyos_facts """ -ANSIBLE_METADATA = { - "metadata_version": "1.1", - "status": [u"preview"], - "supported_by": "network", -} - - -DOCUMENTATION = """module: vyos_facts +DOCUMENTATION = """ +module: vyos_facts short_description: Get facts about vyos devices. description: - Collects facts from network devices running the vyos operating system. This module places the facts gathered in the fact tree keyed by the respective resource name. The facts module will always collect a base set of facts from the device and can enable or disable collection of additional facts. +version_added: 1.0.0 author: - Nathaniel Case (@qalthos) - Nilashish Chakraborty (@Nilashishc) @@ -54,33 +49,33 @@ options: EXAMPLES = """ # Gather all facts -- vyos_facts: +- vyos.vyos.vyos_facts: gather_subset: all gather_network_resources: all # collect only the config and default facts -- vyos_facts: +- vyos.vyos.vyos_facts: gather_subset: config # collect everything exception the config -- vyos_facts: - gather_subset: "!config" +- vyos.vyos.vyos_facts: + gather_subset: '!config' # Collect only the interfaces facts -- vyos_facts: +- vyos.vyos.vyos_facts: gather_subset: - - '!all' - - '!min' + - '!all' + - '!min' gather_network_resources: - - interfaces + - interfaces # Do not collect interfaces facts -- vyos_facts: +- vyos.vyos.vyos_facts: gather_network_resources: - - "!interfaces" + - '!interfaces' # Collect interfaces and minimal default facts -- vyos_facts: +- vyos.vyos.vyos_facts: gather_subset: min gather_network_resources: interfaces """ diff --git a/plugins/modules/vyos_firewall_global.py b/plugins/modules/vyos_firewall_global.py index 519725a..0574aa8 100644 --- a/plugins/modules/vyos_firewall_global.py +++ b/plugins/modules/vyos_firewall_global.py @@ -30,16 +30,13 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = { - "metadata_version": "1.1", - "status": ["preview"], - "supported_by": "network", -} -DOCUMENTATION = """module: vyos_firewall_global -short_description: Manage global policies or configurations for firewall on VyOS devices. +DOCUMENTATION = """ +module: vyos_firewall_global +short_description: FIREWALL global resource module description: This module manage global policies or configurations for firewall on VyOS devices. +version_added: 1.0.0 notes: - Tested against VyOS 1.1.8 (helium). - This module works with connection C(network_cli). See L(the VyOS OS Platform Options,../network/user_guide/platform_vyos.html). @@ -112,7 +109,7 @@ options: - (strict) Enable Strict Reverse Path Forwarding as defined in RFC3704. type: str choices: - - strict + - stricu - loose - disable group: @@ -259,6 +256,7 @@ options: - rendered - parsed default: merged + """ EXAMPLES = """ # Using merged @@ -270,41 +268,41 @@ EXAMPLES = """ # # - name: Merge the provided configuration with the exisiting running configuration - vyos_firewall_global: + vyos.vyos.vyos_firewall_global: config: validation: strict - config_trap: True - log_martians: True - syn_cookies: True - twa_hazards_protection: True + config_trap: true + log_martians: true + syn_cookies: true + twa_hazards_protection: true ping: - all: True - broadcast: True + all: true + broadcast: true state_policy: - - connection_type: 'established' - action: 'accept' - log: True - - connection_type: 'invalid' - action: 'reject' + - connection_type: established + action: accept + log: true + - connection_type: invalid + action: reject route_redirects: - - afi: 'ipv4' - ip_src_route: True - icmp_redirects: - send: True - receive: False + - afi: ipv4 + ip_src_route: true + icmp_redirects: + send: true + receive: false group: address_group: - - name: 'MGMT-HOSTS' - description: 'This group has the Management hosts address list' - members: - - address: 192.0.1.1 - - address: 192.0.1.3 - - address: 192.0.1.5 + - name: MGMT-HOSTS + description: This group has the Management hosts address list + members: + - address: 192.0.1.1 + - address: 192.0.1.3 + - address: 192.0.1.5 network_group: - - name: 'MGMT' - description: 'This group has the Management network addresses' - members: - - address: 192.0.1.0/24 + - name: MGMT + description: This group has the Management network addresses + members: + - address: 192.0.1.0/24 state: merged # # @@ -430,30 +428,30 @@ EXAMPLES = """ # # - name: Render the commands for provided configuration - vyos_firewall_global: + vyos.vyos.vyos_firewall_global: running_config: "set firewall all-ping 'enable' - set firewall broadcast-ping 'enable' - set firewall config-trap 'enable' - set firewall group address-group ENG-HOSTS address '192.0.3.1' - set firewall group address-group ENG-HOSTS address '192.0.3.2' - set firewall group address-group ENG-HOSTS description 'Sales office hosts address list' - set firewall group address-group SALES-HOSTS address '192.0.2.1' - set firewall group address-group SALES-HOSTS address '192.0.2.2' - set firewall group address-group SALES-HOSTS address '192.0.2.3' - set firewall group address-group SALES-HOSTS description 'Sales office hosts address list' - set firewall group network-group MGMT description 'This group has the Management network addresses' - set firewall group network-group MGMT network '192.0.1.0/24' - set firewall ip-src-route 'enable' - set firewall log-martians 'enable' - set firewall receive-redirects 'disable' - set firewall send-redirects 'enable' - set firewall source-validation 'strict' - set firewall state-policy established action 'accept' - set firewall state-policy established log 'enable' - set firewall state-policy invalid action 'reject' - set firewall syn-cookies 'enable' - set firewall twa-hazards-protection 'enable'" + set firewall broadcast-ping 'enable' + set firewall config-trap 'enable' + set firewall group address-group ENG-HOSTS address '192.0.3.1' + set firewall group address-group ENG-HOSTS address '192.0.3.2' + set firewall group address-group ENG-HOSTS description 'Sales office hosts address list' + set firewall group address-group SALES-HOSTS address '192.0.2.1' + set firewall group address-group SALES-HOSTS address '192.0.2.2' + set firewall group address-group SALES-HOSTS address '192.0.2.3' + set firewall group address-group SALES-HOSTS description 'Sales office hosts address list' + set firewall group network-group MGMT description 'This group has the Management network addresses' + set firewall group network-group MGMT network '192.0.1.0/24' + set firewall ip-src-route 'enable' + set firewall log-martians 'enable' + set firewall receive-redirects 'disable' + set firewall send-redirects 'enable' + set firewall source-validation 'strict' + set firewall state-policy established action 'accept' + set firewall state-policy established log 'enable' + set firewall state-policy invalid action 'reject' + set firewall syn-cookies 'enable' + set firewall twa-hazards-protection 'enable'" state: parsed # # @@ -565,7 +563,7 @@ EXAMPLES = """ # set firewall syn-cookies 'enable' # set firewall twa-hazards-protection 'enable' - name: Delete attributes of firewall. - vyos_firewall_global: + vyos.vyos.vyos_firewall_global: config: state_policy: config_trap: @@ -693,46 +691,46 @@ EXAMPLES = """ # set firewall twa-hazards-protection 'enable' # - name: Replace firewall global attributes configuration. - vyos_firewall_global: + vyos.vyos.vyos_firewall_global: config: validation: strict - config_trap: True - log_martians: True - syn_cookies: True - twa_hazards_protection: True + config_trap: true + log_martians: true + syn_cookies: true + twa_hazards_protection: true ping: - all: True - broadcast: True + all: true + broadcast: true state_policy: - - connection_type: 'established' - action: 'accept' - log: True - - connection_type: 'invalid' - action: 'reject' + - connection_type: established + action: accept + log: true + - connection_type: invalid + action: reject route_redirects: - - afi: 'ipv4' - ip_src_route: True - icmp_redirects: - send: True - receive: False + - afi: ipv4 + ip_src_route: true + icmp_redirects: + send: true + receive: false group: address_group: - - name: 'SALES-HOSTS' - description: 'Sales office hosts address list' - members: - - address: 192.0.2.1 - - address: 192.0.2.2 - - address: 192.0.2.3 - - name: 'ENG-HOSTS' - description: 'Sales office hosts address list' - members: - - address: 192.0.3.1 - - address: 192.0.3.2 + - name: SALES-HOSTS + description: Sales office hosts address list + members: + - address: 192.0.2.1 + - address: 192.0.2.2 + - address: 192.0.2.3 + - name: ENG-HOSTS + description: Sales office hosts address list + members: + - address: 192.0.3.1 + - address: 192.0.3.2 network_group: - - name: 'MGMT' - description: 'This group has the Management network addresses' - members: - - address: 192.0.1.0/24 + - name: MGMT + description: This group has the Management network addresses + members: + - address: 192.0.1.0/24 state: replaced # # @@ -949,7 +947,7 @@ EXAMPLES = """ # set firewall twa-hazards-protection 'enable' # - name: Gather firewall global config with provided configurations - vyos_firewall_global: + vyos.vyos.vyos_firewall_global: config: state: gathered # @@ -1066,46 +1064,46 @@ EXAMPLES = """ # # - name: Render the commands for provided configuration - vyos_firewall_global: + vyos.vyos.vyos_firewall_global: config: validation: strict - config_trap: True - log_martians: True - syn_cookies: True - twa_hazards_protection: True + config_trap: true + log_martians: true + syn_cookies: true + twa_hazards_protection: true ping: - all: True - broadcast: True + all: true + broadcast: true state_policy: - - connection_type: 'established' - action: 'accept' - log: True - - connection_type: 'invalid' - action: 'reject' + - connection_type: established + action: accept + log: true + - connection_type: invalid + action: reject route_redirects: - - afi: 'ipv4' - ip_src_route: True - icmp_redirects: - send: True - receive: False + - afi: ipv4 + ip_src_route: true + icmp_redirects: + send: true + receive: false group: address_group: - - name: 'SALES-HOSTS' - description: 'Sales office hosts address list' - members: - - address: 192.0.2.1 - - address: 192.0.2.2 - - address: 192.0.2.3 - - name: 'ENG-HOSTS' - description: 'Sales office hosts address list' - members: - - address: 192.0.3.1 - - address: 192.0.3.2 + - name: SALES-HOSTS + description: Sales office hosts address list + members: + - address: 192.0.2.1 + - address: 192.0.2.2 + - address: 192.0.2.3 + - name: ENG-HOSTS + description: Sales office hosts address list + members: + - address: 192.0.3.1 + - address: 192.0.3.2 network_group: - - name: 'MGMT' - description: 'This group has the Management network addresses' - members: - - address: 192.0.1.0/24 + - name: MGMT + description: This group has the Management network addresses + members: + - address: 192.0.1.0/24 state: rendered # # diff --git a/plugins/modules/vyos_firewall_interfaces.py b/plugins/modules/vyos_firewall_interfaces.py index 1c2ce98..7ca936d 100644 --- a/plugins/modules/vyos_firewall_interfaces.py +++ b/plugins/modules/vyos_firewall_interfaces.py @@ -30,15 +30,12 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = { - "metadata_version": "1.1", - "status": ["preview"], - "supported_by": "network", -} -DOCUMENTATION = """module: vyos_firewall_interfaces -short_description: Manage firewall rules attributes of interfaces on VyOS devices +DOCUMENTATION = """ +module: vyos_firewall_interfaces +short_description: FIREWALL interfaces resource module description: Manage firewall rules of interfaces on VyOS network devices. +version_added: 1.0.0 author: - Rohit Thakur (@rohitthakur2590) options: @@ -109,6 +106,7 @@ options: - rendered - gathered default: merged + """ EXAMPLES = """ # Using merged @@ -123,36 +121,36 @@ EXAMPLES = """ # set firewall name 'OUTBOUND' # - name: Merge the provided configuration with the existing running configuration - vyos_firewall_interfaces: + vyos.vyos.vyos_firewall_interfaces: config: - - access_rules: - - afi: 'ipv4' - rules: - - name: 'INBOUND' - direction: 'in' - - name: 'OUTBOUND' - direction: 'out' - - name: 'LOCAL' - direction: 'local' - - afi: 'ipv6' - rules: - - name: 'V6-LOCAL' - direction: 'local' - name: 'eth1' - - access_rules: - - afi: 'ipv4' - rules: - - name: 'INBOUND' - direction: 'in' - - name: 'OUTBOUND' - direction: 'out' - - name: 'LOCAL' - direction: 'local' - - afi: 'ipv6' - rules: - - name: 'V6-LOCAL' - direction: 'local' - name: 'eth3' + - access_rules: + - afi: ipv4 + rules: + - name: INBOUND + direction: in + - name: OUTBOUND + direction: out + - name: LOCAL + direction: local + - afi: ipv6 + rules: + - name: V6-LOCAL + direction: local + name: eth1 + - access_rules: + - afi: ipv4 + rules: + - name: INBOUND + direction: in + - name: OUTBOUND + direction: out + - name: LOCAL + direction: local + - afi: ipv6 + rules: + - name: V6-LOCAL + direction: local + name: eth3 state: merged # # @@ -295,16 +293,16 @@ EXAMPLES = """ # set interfaces ethernet eth3 firewall out name 'OUTBOUND' # - name: Merge the provided configuration with the existing running configuration - vyos_firewall_interfaces: + vyos.vyos.vyos_firewall_interfaces: config: - - access_rules: - - afi: 'ipv4' - rules: - - name: 'OUTBOUND' - direction: 'in' - - name: 'INBOUND' - direction: 'out' - name: 'eth1' + - access_rules: + - afi: ipv4 + rules: + - name: OUTBOUND + direction: in + - name: INBOUND + direction: out + name: eth1 state: merged # # @@ -496,25 +494,26 @@ EXAMPLES = """ # set interfaces ethernet eth3 firewall local name 'LOCAL' # set interfaces ethernet eth3 firewall out name 'OUTBOUND' # -- name: Replace device configurations of listed firewall interfaces with provided configurations - vyos_firewall_interfaces: +- name: Replace device configurations of listed firewall interfaces with provided + configurations + vyos.vyos.vyos_firewall_interfaces: config: - - name: 'eth1' - access_rules: - - afi: 'ipv4' - rules: - - name: 'OUTBOUND' - direction: 'out' - - afi: 'ipv6' - rules: - - name: 'V6-LOCAL' - direction: 'local' - - name: 'eth3' - access_rules: - - afi: 'ipv4' - rules: - - name: 'INBOUND' - direction: 'in' + - name: eth1 + access_rules: + - afi: ipv4 + rules: + - name: OUTBOUND + direction: out + - afi: ipv6 + rules: + - name: V6-LOCAL + direction: local + - name: eth3 + access_rules: + - afi: ipv4 + rules: + - name: INBOUND + direction: in state: replaced # # @@ -681,14 +680,14 @@ EXAMPLES = """ # set interfaces ethernet eth3 firewall 'out' # - name: Overrides all device configuration with provided configuration - vyos_firewall_interfaces: + vyos.vyos.vyos_firewall_interfaces: config: - - name: 'eth3' - access_rules: - - afi: 'ipv4' - rules: - - name: 'INBOUND' - direction: 'out' + - name: eth3 + access_rules: + - afi: ipv4 + rules: + - name: INBOUND + direction: out state: overridden # # @@ -808,10 +807,10 @@ EXAMPLES = """ # set interfaces ethernet eth3 firewall out name 'OUTBOUND' # - name: Delete firewall interfaces based on interface name. - vyos_firewall_interfaces: + vyos.vyos.vyos_firewall_interfaces: config: - - name: 'eth1' - - name: 'eth3' + - name: eth1 + - name: eth3 state: deleted # # @@ -937,12 +936,12 @@ EXAMPLES = """ # set interfaces ethernet eth3 firewall out name 'OUTBOUND' # - name: Delete firewall interfaces config per afi. - vyos_firewall_interfaces: + vyos.vyos.vyos_firewall_interfaces: config: - - name: 'eth1' - access_rules: - - afi: 'ipv4' - - afi: 'ipv6' + - name: eth1 + access_rules: + - afi: ipv4 + - afi: ipv6 state: deleted # # @@ -986,7 +985,7 @@ EXAMPLES = """ # set interfaces ethernet eth3 firewall out name 'OUTBOUND' # - name: Delete firewall interfaces config when empty config provided. - vyos_firewall_interfaces: + vyos.vyos.vyos_firewall_interfaces: config: state: deleted # @@ -1013,16 +1012,16 @@ EXAMPLES = """ # # - name: Parse the provided configuration - vyos_firewall_interfaces: + vyos.vyos.vyos_firewall_interfaces: running_config: "set interfaces ethernet eth1 firewall in name 'INBOUND' - set interfaces ethernet eth1 firewall out name 'OUTBOUND' - set interfaces ethernet eth1 firewall local name 'LOCAL' - set interfaces ethernet eth1 firewall local ipv6-name 'V6-LOCAL' - set interfaces ethernet eth2 firewall in name 'INBOUND' - set interfaces ethernet eth2 firewall out name 'OUTBOUND' - set interfaces ethernet eth2 firewall local name 'LOCAL' - set interfaces ethernet eth2 firewall local ipv6-name 'V6-LOCAL'" + set interfaces ethernet eth1 firewall out name 'OUTBOUND' + set interfaces ethernet eth1 firewall local name 'LOCAL' + set interfaces ethernet eth1 firewall local ipv6-name 'V6-LOCAL' + set interfaces ethernet eth2 firewall in name 'INBOUND' + set interfaces ethernet eth2 firewall out name 'OUTBOUND' + set interfaces ethernet eth2 firewall local name 'LOCAL' + set interfaces ethernet eth2 firewall local ipv6-name 'V6-LOCAL'" state: parsed # # @@ -1121,7 +1120,7 @@ EXAMPLES = """ # set interfaces ethernet eth3 firewall 'out' # - name: Gather listed firewall interfaces. - vyos_firewall_interfaces: + vyos.vyos.vyos_firewall_interfaces: config: state: gathered # @@ -1197,18 +1196,18 @@ EXAMPLES = """ # # - name: Render the commands for provided configuration - vyos_firewall_interfaces: + vyos.vyos.vyos_firewall_interfaces: config: - - name: 'eth2' - access_rules: - - afi: 'ipv4' - rules: - - direction: 'in' - name: 'INGRESS' - - direction: 'out' - name: 'OUTGRESS' - - direction: 'local' - name: 'DROP' + - name: eth2 + access_rules: + - afi: ipv4 + rules: + - direction: in + name: INGRESS + - direction: out + name: OUTGRESS + - direction: local + name: DROP state: rendered # # diff --git a/plugins/modules/vyos_firewall_rules.py b/plugins/modules/vyos_firewall_rules.py index 9c2e832..3bd6451 100644 --- a/plugins/modules/vyos_firewall_rules.py +++ b/plugins/modules/vyos_firewall_rules.py @@ -30,16 +30,12 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = { - "metadata_version": "1.1", - "status": ["preview"], - "supported_by": "network", -} -DOCUMENTATION = """module: vyos_firewall_rules -short_description: Firewall rules resource module +DOCUMENTATION = """ +module: vyos_firewall_rules +short_description: FIREWALL rules resource module description: This module manages firewall rule-set attributes on VyOS devices -version_added: "1.0.0" +version_added: 1.0.0 notes: - Tested against VyOS 1.1.8 (helium). - This module works with connection C(network_cli). See L(the VyOS OS Platform Options,../network/user_guide/platform_vyos.html). @@ -398,12 +394,12 @@ options: type: str running_config: description: - - This option is used only with state I(parsed). - - The value of this option should be the output received from the VyOS device by executing - the command B(show configuration commands | grep firewall). - - The state I(parsed) reads the configuration from C(running_config) option and transforms - it into Ansible structured data as per the resource module's argspec and the value is then - returned in the I(parsed) key within the result. + - This option is used only with state I(parsed). + - The value of this option should be the output received from the VyOS device + by executing the command B(show configuration commands | grep firewall). + - The state I(parsed) reads the configuration from C(running_config) option and + transforms it into Ansible structured data as per the resource module's argspec + and the value is then returned in the I(parsed) key within the result. type: str state: description: @@ -418,6 +414,7 @@ options: - rendered - parsed default: merged + """ EXAMPLES = """ # Using deleted to delete firewall rules based on rule-set name @@ -439,9 +436,9 @@ EXAMPLES = """ - name: Delete attributes of given firewall rules. vyos.vyos.vyos_firewall_rules: config: - - afi: ipv4 - rule_sets: - - name: 'Downlink' + - afi: ipv4 + rule_sets: + - name: Downlink state: deleted # # @@ -516,7 +513,7 @@ EXAMPLES = """ - name: Delete attributes of given firewall rules. vyos.vyos.vyos_firewall_rules: config: - - afi: ipv4 + - afi: ipv4 state: deleted # # @@ -668,48 +665,48 @@ EXAMPLES = """ - name: Merge the provided configuration with the exisiting running configuration vyos.vyos.vyos_firewall_rules: config: - - afi: 'ipv6' - rule_sets: - - name: 'UPLINK' - description: 'This is ipv6 specific rule-set' - default_action: 'accept' - rules: - - number: 1 - action: 'accept' - description: 'Fwipv6-Rule 1 is configured by Ansible' - ipsec: 'match-ipsec' - - number: 2 - action: 'accept' - description: 'Fwipv6-Rule 2 is configured by Ansible' - ipsec: 'match-ipsec' + - afi: ipv6 + rule_sets: + - name: UPLINK + description: This is ipv6 specific rule-set + default_action: accept + rules: + - number: 1 + action: accept + description: Fwipv6-Rule 1 is configured by Ansible + ipsec: match-ipsec + - number: 2 + action: accept + description: Fwipv6-Rule 2 is configured by Ansible + ipsec: match-ipsec - - afi: 'ipv4' - rule_sets: - - name: 'INBOUND' - description: 'IPv4 INBOUND rule set' - default_action: 'accept' - rules: - - number: 101 - action: 'accept' - description: 'Rule 101 is configured by Ansible' - ipsec: 'match-ipsec' - - number: 102 - action: 'reject' - description: 'Rule 102 is configured by Ansible' - ipsec: 'match-ipsec' - - number: 103 - action: 'accept' - description: 'Rule 103 is configured by Ansible' - destination: - group: - address_group: 'inbound' - source: - address: '192.0.2.0' - state: - established: true - new: false - invalid: false - related: true + - afi: ipv4 + rule_sets: + - name: INBOUND + description: IPv4 INBOUND rule set + default_action: accept + rules: + - number: 101 + action: accept + description: Rule 101 is configured by Ansible + ipsec: match-ipsec + - number: 102 + action: reject + description: Rule 102 is configured by Ansible + ipsec: match-ipsec + - number: 103 + action: accept + description: Rule 103 is configured by Ansible + destination: + group: + address_group: inbound + source: + address: 192.0.2.0 + state: + established: true + new: false + invalid: false + related: true state: merged # # @@ -887,25 +884,25 @@ EXAMPLES = """ - name: Replace device configurations of listed firewall rules with provided configurations vyos.vyos.vyos_firewall_rules: config: - - afi: 'ipv6' - rule_sets: - - name: 'UPLINK' - description: 'This is ipv6 specific rule-set' - default_action: 'accept' - - afi: 'ipv4' - rule_sets: - - name: 'INBOUND' - description: 'IPv4 INBOUND rule set' - default_action: 'accept' - rules: - - number: 101 - action: 'accept' - description: 'Rule 101 is configured by Ansible' - ipsec: 'match-ipsec' - - number: 104 - action: 'reject' - description: 'Rule 104 is configured by Ansible' - ipsec: 'match-none' + - afi: ipv6 + rule_sets: + - name: UPLINK + description: This is ipv6 specific rule-set + default_action: accept + - afi: ipv4 + rule_sets: + - name: INBOUND + description: IPv4 INBOUND rule set + default_action: accept + rules: + - number: 101 + action: accept + description: Rule 101 is configured by Ansible + ipsec: match-ipsec + - number: 104 + action: reject + description: Rule 104 is configured by Ansible + ipsec: match-none state: replaced # # @@ -1069,20 +1066,20 @@ EXAMPLES = """ - name: Overrides all device configuration with provided configuration vyos.vyos.vyos_firewall_rules: config: - - afi: 'ipv4' - rule_sets: - - name: 'Downlink' - description: 'IPv4 INBOUND rule set' - default_action: 'accept' - rules: - - number: 501 - action: 'accept' - description: 'Rule 501 is configured by Ansible' - ipsec: 'match-ipsec' - - number: 502 - action: 'reject' - description: 'Rule 502 is configured by Ansible' - ipsec: 'match-ipsec' + - afi: ipv4 + rule_sets: + - name: Downlink + description: IPv4 INBOUND rule set + default_action: accept + rules: + - number: 501 + action: accept + description: Rule 501 is configured by Ansible + ipsec: match-ipsec + - number: 502 + action: reject + description: Rule 502 is configured by Ansible + ipsec: match-ipsec state: overridden # # @@ -1335,38 +1332,38 @@ EXAMPLES = """ - name: Render the commands for provided configuration vyos.vyos.vyos_firewall_rules: config: - - afi: 'ipv6' - rule_sets: - - name: 'UPLINK' - description: 'This is ipv6 specific rule-set' - default_action: 'accept' - - afi: 'ipv4' - rule_sets: - - name: 'INBOUND' - description: 'IPv4 INBOUND rule set' - default_action: 'accept' - rules: - - number: 101 - action: 'accept' - description: 'Rule 101 is configured by Ansible' - ipsec: 'match-ipsec' - - number: 102 - action: 'reject' - description: 'Rule 102 is configured by Ansible' - ipsec: 'match-ipsec' - - number: 103 - action: 'accept' - description: 'Rule 103 is configured by Ansible' - destination: - group: - address_group: 'inbound' - source: - address: '192.0.2.0' - state: - established: true - new: false - invalid: false - related: true + - afi: ipv6 + rule_sets: + - name: UPLINK + description: This is ipv6 specific rule-set + default_action: accept + - afi: ipv4 + rule_sets: + - name: INBOUND + description: IPv4 INBOUND rule set + default_action: accept + rules: + - number: 101 + action: accept + description: Rule 101 is configured by Ansible + ipsec: match-ipsec + - number: 102 + action: reject + description: Rule 102 is configured by Ansible + ipsec: match-ipsec + - number: 103 + action: accept + description: Rule 103 is configured by Ansible + destination: + group: + address_group: inbound + source: + address: 192.0.2.0 + state: + established: true + new: false + invalid: false + related: true state: rendered # # @@ -1407,14 +1404,14 @@ EXAMPLES = """ vyos.vyos.vyos_firewall_rules: running_config: "set firewall group address-group 'inbound' - set firewall name Downlink default-action 'accept' - set firewall name Downlink description 'IPv4 INBOUND rule set' - set firewall name Downlink rule 501 action 'accept' - set firewall name Downlink rule 501 description 'Rule 501 is configured by Ansible' - set firewall name Downlink rule 501 ipsec 'match-ipsec' - set firewall name Downlink rule 502 action 'reject' - set firewall name Downlink rule 502 description 'Rule 502 is configured by Ansible' - set firewall name Downlink rule 502 ipsec 'match-ipsec'" + set firewall name Downlink default-action 'accept' + set firewall name Downlink description 'IPv4 INBOUND rule set' + set firewall name Downlink rule 501 action 'accept' + set firewall name Downlink rule 501 description 'Rule 501 is configured by Ansible' + set firewall name Downlink rule 501 ipsec 'match-ipsec' + set firewall name Downlink rule 502 action 'reject' + set firewall name Downlink rule 502 description 'Rule 502 is configured by Ansible' + set firewall name Downlink rule 502 ipsec 'match-ipsec'" state: parsed # # diff --git a/plugins/modules/vyos_interface.py b/plugins/modules/vyos_interface.py index 175cf3b..11a1d49 100644 --- a/plugins/modules/vyos_interface.py +++ b/plugins/modules/vyos_interface.py @@ -19,18 +19,14 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -ANSIBLE_METADATA = { - "metadata_version": "1.1", - "status": ["deprecated"], - "supported_by": "network", -} - -DOCUMENTATION = """module: vyos_interface +DOCUMENTATION = """ +module: vyos_interface author: Ganesh Nalawade (@ganeshrn) -short_description: Manage Interface on VyOS network devices +short_description: (deprecated) Manage Interface on VyOS network devices description: - This module provides declarative management of Interfaces on VyOS network devices. +version_added: 1.0.0 deprecated: removed_in: '2.13' alternative: vyos_interfaces @@ -94,31 +90,32 @@ options: - down extends_documentation_fragment: - vyos.vyos.vyos + """ EXAMPLES = """ - name: configure interface - vyos_interface: + vyos.vyos.vyos_interface: name: eth0 description: test-interface - name: remove interface - vyos_interface: + vyos.vyos.vyos_interface: name: eth0 state: absent - name: make interface down - vyos_interface: + vyos.vyos.vyos_interface: name: eth0 - enabled: False + enabled: false - name: make interface up - vyos_interface: + vyos.vyos.vyos_interface: name: eth0 - enabled: True + enabled: true - name: Configure interface speed, mtu, duplex - vyos_interface: + vyos.vyos.vyos_interface: name: eth5 state: present speed: 100 @@ -126,36 +123,36 @@ EXAMPLES = """ duplex: full - name: Set interface using aggregate - vyos_interface: + vyos.vyos.vyos_interface: aggregate: - - { name: eth1, description: test-interface-1, speed: 100, duplex: half, mtu: 512} - - { name: eth2, description: test-interface-2, speed: 1000, duplex: full, mtu: 256} + - {name: eth1, description: test-interface-1, speed: 100, duplex: half, mtu: 512} + - {name: eth2, description: test-interface-2, speed: 1000, duplex: full, mtu: 256} - name: Disable interface on aggregate net_interface: aggregate: - - name: eth1 - - name: eth2 - enabled: False + - name: eth1 + - name: eth2 + enabled: false - name: Delete interface using aggregate net_interface: aggregate: - - name: eth1 - - name: eth2 + - name: eth1 + - name: eth2 state: absent - name: Check lldp neighbors intent arguments - vyos_interface: + vyos.vyos.vyos_interface: name: eth0 neighbors: - port: eth0 host: netdev - name: Config + intent - vyos_interface: + vyos.vyos.vyos_interface: name: eth1 - enabled: False + enabled: false state: down """ diff --git a/plugins/modules/vyos_interfaces.py b/plugins/modules/vyos_interfaces.py index 6730e30..47f9777 100644 --- a/plugins/modules/vyos_interfaces.py +++ b/plugins/modules/vyos_interfaces.py @@ -30,18 +30,18 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {"metadata_version": "1.1", "supported_by": "Ansible"} -DOCUMENTATION = """module: vyos_interfaces +DOCUMENTATION = """ +module: vyos_interfaces short_description: Interfaces resource module description: - This module manages the interface attributes on VyOS network devices. - This module supports managing base attributes of Ethernet, Bonding, VXLAN, Loopback and Virtual Tunnel Interfaces. +version_added: 1.0.0 notes: - Tested against VyOS 1.1.8 (helium). - This module works with connection C(network_cli). See L(the VyOS OS Platform Options,../network/user_guide/platform_vyos.html). -version_added: "1.0.0" author: - Nilashish Chakraborty (@nilashishc) - Rohit Thakur (@rohitthakur2590) @@ -120,12 +120,12 @@ options: type: int running_config: description: - - This option is used only with state I(parsed). - - The value of this option should be the output received from the VyOS device by executing - the command B(show configuration commands | grep interfaces). - - The state I(parsed) reads the configuration from C(running_config) option and transforms - it into Ansible structured data as per the resource module's argspec and the value is then - returned in the I(parsed) key within the result. + - This option is used only with state I(parsed). + - The value of this option should be the output received from the VyOS device + by executing the command B(show configuration commands | grep interfaces). + - The state I(parsed) reads the configuration from C(running_config) option and + transforms it into Ansible structured data as per the resource module's argspec + and the value is then returned in the I(parsed) key within the result. type: str state: description: @@ -165,24 +165,24 @@ EXAMPLES = """ - name: Merge provided configuration with device configuration vyos.vyos.vyos_interfaces: config: - - name: eth2 - description: 'Configured by Ansible' - enabled: True - vifs: - - vlan_id: 200 - description: "VIF 200 - ETH2" + - name: eth2 + description: Configured by Ansible + enabled: true + vifs: + - vlan_id: 200 + description: VIF 200 - ETH2 - - name: eth3 - description: 'Configured by Ansible' - mtu: 1500 + - name: eth3 + description: Configured by Ansible + mtu: 1500 - - name: bond1 - description: 'Bond - 1' - mtu: 1200 + - name: bond1 + description: Bond - 1 + mtu: 1200 - - name: vti2 - description: 'VTI - 2' - enabled: false + - name: vti2 + description: VTI - 2 + enabled: false state: merged # # @@ -343,14 +343,14 @@ EXAMPLES = """ - name: Replace device configurations of listed interfaces with provided configurations vyos.vyos.vyos_interfaces: config: - - name: eth2 - description: "Replaced by Ansible" + - name: eth2 + description: Replaced by Ansible - - name: eth3 - description: "Replaced by Ansible" + - name: eth3 + description: Replaced by Ansible - - name: eth1 - description: "Replaced by Ansible" + - name: eth1 + description: Replaced by Ansible state: replaced # # @@ -528,17 +528,17 @@ EXAMPLES = """ - name: Overrides all device configuration with provided configuration vyos.vyos.vyos_interfaces: config: - - name: eth0 - description: Outbound Interface For The Appliance - speed: auto - duplex: auto + - name: eth0 + description: Outbound Interface For The Appliance + speed: auto + duplex: auto - - name: eth2 - speed: auto - duplex: auto + - name: eth2 + speed: auto + duplex: auto - - name: eth3 - mtu: 1200 + - name: eth3 + mtu: 1200 state: overridden # # @@ -710,16 +710,17 @@ EXAMPLES = """ # set interfaces loopback lo # # -- name: Delete attributes of given interfaces (Note - This won't delete the interfaces themselves) +- name: Delete attributes of given interfaces (Note - This won't delete the interfaces + themselves) vyos.vyos.vyos_interfaces: config: - - name: bond1 + - name: bond1 - - name: eth1 + - name: eth1 - - name: eth2 + - name: eth2 - - name: eth3 + - name: eth3 state: deleted # # @@ -950,28 +951,28 @@ EXAMPLES = """ - name: Render the commands for provided configuration vyos.vyos.vyos_interfaces: config: - - name: eth0 + - name: eth0 + enabled: true + duplex: auto + speed: auto + - name: eth1 + description: Configured by Ansible - Interface 1 + mtu: 1500 + speed: auto + duplex: auto + enabled: true + vifs: + - vlan_id: 100 + description: Eth1 - VIF 100 + mtu: 400 enabled: true - duplex: auto - speed: auto - - name: eth1 - description: Configured by Ansible - Interface 1 - mtu: 1500 - speed: auto - duplex: auto + - vlan_id: 101 + description: Eth1 - VIF 101 enabled: true - vifs: - - vlan_id: 100 - description: Eth1 - VIF 100 - mtu: 400 - enabled: true - - vlan_id: 101 - description: Eth1 - VIF 101 - enabled: true - - name: eth2 - description: Configured by Ansible - Interface 2 (ADMIN DOWN) - mtu: 600 - enabled: false + - name: eth2 + description: Configured by Ansible - Interface 2 (ADMIN DOWN) + mtu: 600 + enabled: false state: rendered # # @@ -1005,20 +1006,20 @@ EXAMPLES = """ vyos.vyos.vyos_interfaces: running_config: "set interfaces ethernet eth0 address 'dhcp' - set interfaces ethernet eth0 duplex 'auto' - set interfaces ethernet eth0 hw-id '08:00:27:50:5e:19' - set interfaces ethernet eth0 smp_affinity 'auto' - set interfaces ethernet eth0 speed 'auto' - set interfaces ethernet eth1 description 'Configured by Ansible' - set interfaces ethernet eth1 duplex 'auto' - set interfaces ethernet eth1 mtu '1500' - set interfaces ethernet eth1 speed 'auto' - set interfaces ethernet eth1 vif 200 description 'VIF - 200' - set interfaces ethernet eth2 description 'Configured by Ansible' - set interfaces ethernet eth2 duplex 'auto' - set interfaces ethernet eth2 mtu '1500' - set interfaces ethernet eth2 speed 'auto' - set interfaces ethernet eth2 vif 200 description 'VIF - 200'" + set interfaces ethernet eth0 duplex 'auto' + set interfaces ethernet eth0 hw-id '08:00:27:50:5e:19' + set interfaces ethernet eth0 smp_affinity 'auto' + set interfaces ethernet eth0 speed 'auto' + set interfaces ethernet eth1 description 'Configured by Ansible' + set interfaces ethernet eth1 duplex 'auto' + set interfaces ethernet eth1 mtu '1500' + set interfaces ethernet eth1 speed 'auto' + set interfaces ethernet eth1 vif 200 description 'VIF - 200' + set interfaces ethernet eth2 description 'Configured by Ansible' + set interfaces ethernet eth2 duplex 'auto' + set interfaces ethernet eth2 mtu '1500' + set interfaces ethernet eth2 speed 'auto' + set interfaces ethernet eth2 vif 200 description 'VIF - 200'" state: parsed # # diff --git a/plugins/modules/vyos_l3_interface.py b/plugins/modules/vyos_l3_interface.py index faa9629..3e43f7c 100644 --- a/plugins/modules/vyos_l3_interface.py +++ b/plugins/modules/vyos_l3_interface.py @@ -19,18 +19,14 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -ANSIBLE_METADATA = { - "metadata_version": "1.1", - "status": ["deprecated"], - "supported_by": "network", -} - -DOCUMENTATION = """module: vyos_l3_interface +DOCUMENTATION = """ +module: vyos_l3_interface author: Ricardo Carrillo Cruz (@rcarrillocruz) -short_description: Manage L3 interfaces on VyOS network devices +short_description: (deprecated) Manage L3 interfaces on VyOS network devices description: - This module provides declarative management of L3 interfaces on VyOS network devices. +version_added: 1.0.0 deprecated: removed_in: '2.13' alternative: vyos_l3_interfaces @@ -58,30 +54,31 @@ options: - absent extends_documentation_fragment: - vyos.vyos.vyos + """ EXAMPLES = """ - name: Set eth0 IPv4 address - vyos_l3_interface: + vyos.vyos.vyos_l3_interface: name: eth0 ipv4: 192.168.0.1/24 - name: Remove eth0 IPv4 address - vyos_l3_interface: + vyos.vyos.vyos_l3_interface: name: eth0 state: absent - name: Set IP addresses on aggregate - vyos_l3_interface: + vyos.vyos.vyos_l3_interface: aggregate: - - { name: eth1, ipv4: 192.168.2.10/24 } - - { name: eth2, ipv4: 192.168.3.10/24, ipv6: "fd5d:12c9:2201:1::1/64" } + - {name: eth1, ipv4: 192.168.2.10/24} + - {name: eth2, ipv4: 192.168.3.10/24, ipv6: fd5d:12c9:2201:1::1/64} - name: Remove IP addresses on aggregate - vyos_l3_interface: + vyos.vyos.vyos_l3_interface: aggregate: - - { name: eth1, ipv4: 192.168.2.10/24 } - - { name: eth2, ipv4: 192.168.3.10/24, ipv6: "fd5d:12c9:2201:1::1/64" } + - {name: eth1, ipv4: 192.168.2.10/24} + - {name: eth2, ipv4: 192.168.3.10/24, ipv6: fd5d:12c9:2201:1::1/64} state: absent """ diff --git a/plugins/modules/vyos_l3_interfaces.py b/plugins/modules/vyos_l3_interfaces.py index 4724240..39dd23c 100644 --- a/plugins/modules/vyos_l3_interfaces.py +++ b/plugins/modules/vyos_l3_interfaces.py @@ -30,15 +30,12 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = { - "metadata_version": "1.1", - "status": ["preview"], - "supported_by": "network", -} -DOCUMENTATION = """module: vyos_l3_interfaces +DOCUMENTATION = """ +module: vyos_l3_interfaces short_description: L3 interfaces resource module description: This module manages the L3 interface attributes on VyOS network devices. +version_added: 1.0.0 notes: - Tested against VyOS 1.1.8 (helium). - This module works with connection C(network_cli). See L(the VyOS OS Platform Options,../network/user_guide/platform_vyos.html). @@ -108,14 +105,13 @@ options: type: str running_config: description: - - This option is used only with state I(parsed). - - The value of this option should be the output received from the VyOS device by executing - the command B(show configuration commands | grep -e eth[2,3]). - - The state I(parsed) reads the configuration from C(running_config) option and transforms - it into Ansible structured data as per the resource module's argspec and the value is then - returned in the I(parsed) key within the result. + - This option is used only with state I(parsed). + - The value of this option should be the output received from the VyOS device + by executing the command B(show configuration commands | grep -e eth[2,3]). + - The state I(parsed) reads the configuration from C(running_config) option and + transforms it into Ansible structured data as per the resource module's argspec + and the value is then returned in the I(parsed) key within the result. type: str - version_added: "1.0.0" state: description: - The state of the configuration after module completion. @@ -145,26 +141,26 @@ EXAMPLES = """ - name: Merge provided configuration with device configuration vyos.vyos.vyos_l3_interfaces: config: - - name: eth2 - ipv4: - - address: 192.0.2.10/28 - - address: 198.51.100.40/27 - ipv6: - - address: 2001:db8:100::2/32 - - address: 2001:db8:400::10/32 + - name: eth2 + ipv4: + - address: 192.0.2.10/28 + - address: 198.51.100.40/27 + ipv6: + - address: 2001:db8:100::2/32 + - address: 2001:db8:400::10/32 - - name: eth3 + - name: eth3 + ipv4: + - address: 203.0.113.65/26 + vifs: + - vlan_id: 101 ipv4: - - address: 203.0.113.65/26 - vifs: - - vlan_id: 101 - ipv4: - - address: 192.0.2.71/28 - - address: 198.51.100.131/25 - - vlan_id: 102 - ipv6: - - address: 2001:db8:1000::5/38 - - address: 2001:db8:1400::3/38 + - address: 192.0.2.71/28 + - address: 198.51.100.131/25 + - vlan_id: 102 + ipv6: + - address: 2001:db8:1000::5/38 + - address: 2001:db8:1400::3/38 state: merged # After state: @@ -213,13 +209,13 @@ EXAMPLES = """ - name: Replace device configurations of listed interfaces with provided configurations vyos.vyos.vyos_l3_interfaces: config: - - name: eth2 - ipv4: - - address: 192.0.2.10/24 + - name: eth2 + ipv4: + - address: 192.0.2.10/24 - - name: eth3 - ipv6: - - address: 2001:db8::11/32 + - name: eth3 + ipv6: + - address: 2001:db8::11/32 state: replaced # After state: @@ -269,11 +265,11 @@ EXAMPLES = """ - name: Overrides all device configuration with provided configuration vyos.vyos.vyos_l3_interfaces: config: - - name: eth0 - ipv4: - - address: dhcp - ipv6: - - address: dhcpv6 + - name: eth0 + ipv4: + - address: dhcp + ipv6: + - address: dhcpv6 state: overridden # After state @@ -317,12 +313,13 @@ EXAMPLES = """ # set interfaces ethernet eth3 vif 102 address '2001:db8:4000::3/34' # set interfaces ethernet eth3 vif 102 address '2001:db8:4000::2/34' -- name: Delete L3 attributes of given interfaces (Note - This won't delete the interface itself) +- name: Delete L3 attributes of given interfaces (Note - This won't delete the interface + itself) vyos.vyos.vyos_l3_interfaces: config: - - name: eth1 - - name: eth2 - - name: eth3 + - name: eth1 + - name: eth2 + - name: eth3 state: deleted # After state @@ -429,16 +426,16 @@ EXAMPLES = """ - name: Render the commands for provided configuration vyos.vyos.vyos_l3_interfaces: config: - - name: eth1 - ipv4: - - address: 192.0.2.14/24 - - name: eth2 - ipv4: - - address: 192.0.2.10/24 - - address: 192.0.2.11/24 - ipv6: - - address: 2001:db8::10/32 - - address: 2001:db8::12/32 + - name: eth1 + ipv4: + - address: 192.0.2.14/24 + - name: eth2 + ipv4: + - address: 192.0.2.10/24 + - address: 192.0.2.11/24 + ipv6: + - address: 2001:db8::10/32 + - address: 2001:db8::12/32 state: rendered # # @@ -463,11 +460,11 @@ EXAMPLES = """ vyos.vyos.vyos_l3_interfaces: running_config: "set interfaces ethernet eth0 address 'dhcp' - set interfaces ethernet eth1 address '192.0.2.14/24' - set interfaces ethernet eth2 address '192.0.2.10/24' - set interfaces ethernet eth2 address '192.0.2.11/24' - set interfaces ethernet eth2 address '2001:db8::10/32' - set interfaces ethernet eth2 address '2001:db8::12/32'" + set interfaces ethernet eth1 address '192.0.2.14/24' + set interfaces ethernet eth2 address '192.0.2.10/24' + set interfaces ethernet eth2 address '192.0.2.11/24' + set interfaces ethernet eth2 address '2001:db8::10/32' + set interfaces ethernet eth2 address '2001:db8::12/32'" state: parsed # # diff --git a/plugins/modules/vyos_lag_interfaces.py b/plugins/modules/vyos_lag_interfaces.py index 1ba511c..c2868a8 100644 --- a/plugins/modules/vyos_lag_interfaces.py +++ b/plugins/modules/vyos_lag_interfaces.py @@ -30,13 +30,13 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {"metadata_version": "1.1", "supported_by": "Ansible"} -DOCUMENTATION = """module: vyos_lag_interfaces +DOCUMENTATION = """ +module: vyos_lag_interfaces short_description: LAG interfaces resource module description: This module manages attributes of link aggregation groups on VyOS network devices. -version_added: "1.0.0" +version_added: 1.0.0 notes: - Tested against VyOS 1.1.8 (helium). - This module works with connection C(network_cli). See L(the VyOS OS Platform Options,../network/user_guide/platform_vyos.html). @@ -99,12 +99,12 @@ options: type: list running_config: description: - - This option is used only with state I(parsed). - - The value of this option should be the output received from the VyOS device by executing - the command B(show configuration commands | grep bond). - - The state I(parsed) reads the configuration from C(running_config) option and transforms - it into Ansible structured data as per the resource module's argspec and the value is then - returned in the I(parsed) key within the result. + - This option is used only with state I(parsed). + - The value of this option should be the output received from the VyOS device + by executing the command B(show configuration commands | grep bond). + - The state I(parsed) reads the configuration from C(running_config) option and + transforms it into Ansible structured data as per the resource module's argspec + and the value is then returned in the I(parsed) key within the result. type: str state: description: @@ -133,20 +133,20 @@ EXAMPLES = """ - name: Merge provided configuration with device configuration vyos.vyos.vyos_lag_interfaces: config: - - name: bond2 - mode: active-backup - members: - - member: eth2 - - member: eth1 - hash_policy: layer2 - primary: eth2 + - name: bond2 + mode: active-backup + members: + - member: eth2 + - member: eth1 + hash_policy: layer2 + primary: eth2 - - name: 'bond3' - mode: 'active-backup' - hash_policy: 'layer2+3' - members: - - member: eth3 - primary: 'eth3' + - name: bond3 + mode: active-backup + hash_policy: layer2+3 + members: + - member: eth3 + primary: eth3 state: merged # # @@ -237,11 +237,11 @@ EXAMPLES = """ - name: Replace device configurations of listed LAGs with provided configurations vyos.vyos.vyos_lag_interfaces: config: - - name: bond3 - mode: '802.3ad' - hash_policy: 'layer2' - members: - - member: eth3 + - name: bond3 + mode: 802.3ad + hash_policy: layer2 + members: + - member: eth3 state: replaced # # @@ -342,14 +342,14 @@ EXAMPLES = """ - name: Overrides all device configuration with provided configuration vyos.vyos.vyos_lag_interfaces: config: - - name: bond3 - mode: active-backup - members: - - member: eth1 - - member: eth2 - - member: eth3 - primary: eth3 - hash_policy: layer2 + - name: bond3 + mode: active-backup + members: + - member: eth1 + - member: eth2 + - member: eth3 + primary: eth3 + hash_policy: layer2 state: overridden # # @@ -449,11 +449,12 @@ EXAMPLES = """ # set interfaces ethernet eth2 bond-group 'bond2' # set interfaces ethernet eth3 bond-group 'bond3' # -- name: Delete LAG attributes of given interfaces (Note This won't delete the interface itself) +- name: Delete LAG attributes of given interfaces (Note This won't delete the interface + itself) vyos.vyos.vyos_lag_interfaces: config: - - name: bond2 - - name: bond3 + - name: bond2 + - name: bond3 state: deleted # # @@ -632,18 +633,18 @@ EXAMPLES = """ - name: Render the commands for provided configuration vyos.vyos.vyos_lag_interfaces: config: - - name: bond0 - hash_policy: layer2 - members: - - member: eth1 - mode: active-backup - primary: eth1 - - name: bond1 - hash_policy: layer2+3 - members: - - member: eth2 - mode: active-backup - primary: eth2 + - name: bond0 + hash_policy: layer2 + members: + - member: eth1 + mode: active-backup + primary: eth1 + - name: bond1 + hash_policy: layer2+3 + members: + - member: eth2 + mode: active-backup + primary: eth2 state: rendered # # @@ -671,13 +672,13 @@ EXAMPLES = """ vyos.vyos.vyos_l3_interfaces: running_config: "set interfaces bonding bond0 hash-policy 'layer2' - set interfaces bonding bond0 mode 'active-backup' - set interfaces bonding bond0 primary 'eth1' - set interfaces bonding bond1 hash-policy 'layer2+3' - set interfaces bonding bond1 mode 'active-backup' - set interfaces bonding bond1 primary 'eth2' - set interfaces ethernet eth1 bond-group 'bond0' - set interfaces ethernet eth2 bond-group 'bond1'" + set interfaces bonding bond0 mode 'active-backup' + set interfaces bonding bond0 primary 'eth1' + set interfaces bonding bond1 hash-policy 'layer2+3' + set interfaces bonding bond1 mode 'active-backup' + set interfaces bonding bond1 primary 'eth2' + set interfaces ethernet eth1 bond-group 'bond0' + set interfaces ethernet eth2 bond-group 'bond1'" state: parsed # # diff --git a/plugins/modules/vyos_linkagg.py b/plugins/modules/vyos_linkagg.py index 6810a54..0d939b2 100644 --- a/plugins/modules/vyos_linkagg.py +++ b/plugins/modules/vyos_linkagg.py @@ -19,19 +19,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -ANSIBLE_METADATA = { - "metadata_version": "1.1", - "status": ["deprecated"], - "supported_by": "network", -} - -DOCUMENTATION = """module: vyos_linkagg +DOCUMENTATION = """ +module: vyos_linkagg author: Ricardo Carrillo Cruz (@rcarrillocruz) -short_description: Manage link aggregation groups on VyOS network devices +short_description: (deprecated) Manage link aggregation groups on VyOS network devices description: - This module provides declarative management of link aggregation groups on VyOS network devices. +version_added: 1.0.0 deprecated: removed_in: '2.13' alternative: vyos_lag_interfaces @@ -55,7 +51,7 @@ options: - transmit-load-balance - adaptive-load-balance - xor-hash - - 'on' + - on type: str members: description: @@ -76,32 +72,33 @@ options: type: str extends_documentation_fragment: - vyos.vyos.vyos + """ EXAMPLES = """ - name: configure link aggregation group - vyos_linkagg: + vyos.vyos.vyos_linkagg: name: bond0 members: - - eth0 - - eth1 + - eth0 + - eth1 - name: remove configuration - vyos_linkagg: + vyos.vyos.vyos_linkagg: name: bond0 state: absent - name: Create aggregate of linkagg definitions - vyos_linkagg: + vyos.vyos.vyos_linkagg: aggregate: - - { name: bond0, members: [eth1] } - - { name: bond1, members: [eth2] } + - {name: bond0, members: [eth1]} + - {name: bond1, members: [eth2]} - name: Remove aggregate of linkagg definitions - vyos_linkagg: + vyos.vyos.vyos_linkagg: aggregate: - - name: bond0 - - name: bond1 + - name: bond0 + - name: bond1 state: absent """ diff --git a/plugins/modules/vyos_lldp.py b/plugins/modules/vyos_lldp.py index aa7a316..5b697c2 100644 --- a/plugins/modules/vyos_lldp.py +++ b/plugins/modules/vyos_lldp.py @@ -24,18 +24,13 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = { - "metadata_version": "1.1", - "status": ["deprecated"], - "supported_by": "network", -} - - -DOCUMENTATION = """module: vyos_lldp +DOCUMENTATION = """ +module: vyos_lldp author: Ricardo Carrillo Cruz (@rcarrillocruz) -short_description: Manage LLDP configuration on VyOS network devices +short_description: (deprecated) Manage LLDP configuration on VyOS network devices description: - This module provides declarative management of LLDP service on VyOS network devices. +version_added: 1.0.0 deprecated: removed_in: '2.13' alternative: vyos_lldp_global @@ -59,15 +54,16 @@ options: type: str extends_documentation_fragment: - vyos.vyos.vyos + """ EXAMPLES = """ - name: Enable LLDP service - vyos_lldp: + vyos.vyos.vyos_lldp: state: present - name: Disable LLDP service - vyos_lldp: + vyos.vyos.vyos_lldp: state: absent """ diff --git a/plugins/modules/vyos_lldp_global.py b/plugins/modules/vyos_lldp_global.py index 3a93c95..017133e 100644 --- a/plugins/modules/vyos_lldp_global.py +++ b/plugins/modules/vyos_lldp_global.py @@ -30,13 +30,13 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {"metadata_version": "1.1", "supported_by": "Ansible"} -DOCUMENTATION = """module: vyos_lldp_global +DOCUMENTATION = """ +module: vyos_lldp_global short_description: LLDP global resource module description: This module manages link layer discovery protocol (LLDP) attributes on VyOS devices. -version_added: "1.0.0" +version_added: 1.0.0 notes: - Tested against VyOS 1.1.8 (helium). - This module works with connection C(network_cli). See L(the VyOS OS Platform Options,../network/user_guide/platform_vyos.html). @@ -70,12 +70,12 @@ options: - sonmp running_config: description: - - This option is used only with state I(parsed). - - The value of this option should be the output received from the VyOS device by executing - the command B(show configuration commands | grep lldp). - - The state I(parsed) reads the configuration from C(running_config) option and transforms - it into Ansible structured data as per the resource module's argspec and the value is then - returned in the I(parsed) key within the result. + - This option is used only with state I(parsed). + - The value of this option should be the output received from the VyOS device + by executing the command B(show configuration commands | grep lldp). + - The state I(parsed) reads the configuration from C(running_config) option and + transforms it into Ansible structured data as per the resource module's argspec + and the value is then returned in the I(parsed) key within the result. type: str state: description: @@ -89,6 +89,7 @@ options: - rendered - parsed default: merged + """ EXAMPLES = """ # Using merged @@ -102,9 +103,9 @@ EXAMPLES = """ vyos.vyos.vyos_lldp_global: config: legacy_protocols: - - 'fdp' - - 'cdp' - snmp: 'enable' + - fdp + - cdp + snmp: enable address: 192.0.2.11 state: merged # @@ -164,9 +165,9 @@ EXAMPLES = """ vyos.vyos.vyos_lldp_global: config: legacy_protocols: - - 'edp' - - 'sonmp' - - 'cdp' + - edp + - sonmp + - cdp address: 192.0.2.14 state: replaced # @@ -237,7 +238,8 @@ EXAMPLES = """ # set service lldp legacy-protocols sonmp # set service lldp management-address '192.0.2.14' # -- name: Delete attributes of given lldp service (This won't delete the LLDP service itself) +- name: Delete attributes of given lldp service (This won't delete the LLDP service + itself) vyos.vyos.vyos_lldp_global: config: state: deleted @@ -392,7 +394,7 @@ EXAMPLES = """ address: 192.0.2.17 enable: true legacy_protocols: - - cdp + - cdp state: rendered # # @@ -416,8 +418,8 @@ EXAMPLES = """ vyos.vyos.vyos_lldp_global: running_config: "set service lldp legacy-protocols 'cdp' - set service lldp legacy-protocols 'fdp' - set service lldp management-address '192.0.2.11'" + set service lldp legacy-protocols 'fdp' + set service lldp management-address '192.0.2.11'" state: parsed # # diff --git a/plugins/modules/vyos_lldp_interface.py b/plugins/modules/vyos_lldp_interface.py index 402facf..80d4dbf 100644 --- a/plugins/modules/vyos_lldp_interface.py +++ b/plugins/modules/vyos_lldp_interface.py @@ -20,19 +20,15 @@ # -ANSIBLE_METADATA = { - "metadata_version": "1.1", - "status": ["deprecated"], - "supported_by": "network", -} - - -DOCUMENTATION = """module: vyos_lldp_interface +DOCUMENTATION = """ +module: vyos_lldp_interface author: Ricardo Carrillo Cruz (@rcarrillocruz) -short_description: Manage LLDP interfaces configuration on VyOS network devices +short_description: (deprecated) Manage LLDP interfaces configuration on VyOS network + devices description: - This module provides declarative management of LLDP interfaces configuration on VyOS network devices. +version_added: 1.0.0 deprecated: removed_in: '2.13' alternative: vyos_lldp_interfaces @@ -59,6 +55,7 @@ options: type: str extends_documentation_fragment: - vyos.vyos.vyos + """ EXAMPLES = """ @@ -69,8 +66,8 @@ EXAMPLES = """ - name: Enable LLDP on specific interfaces net_lldp_interface: interfaces: - - eth1 - - eth2 + - eth1 + - eth2 state: present - name: Disable LLDP globally @@ -78,14 +75,14 @@ EXAMPLES = """ state: disabled - name: Create aggregate of LLDP interface configurations - vyos_lldp_interface: + vyos.vyos.vyos_lldp_interface: aggregate: - name: eth1 - name: eth2 state: present - name: Delete aggregate of LLDP interface configurations - vyos_lldp_interface: + vyos.vyos.vyos_lldp_interface: aggregate: - name: eth1 - name: eth2 diff --git a/plugins/modules/vyos_lldp_interfaces.py b/plugins/modules/vyos_lldp_interfaces.py index b26da49..4db7cb0 100644 --- a/plugins/modules/vyos_lldp_interfaces.py +++ b/plugins/modules/vyos_lldp_interfaces.py @@ -30,15 +30,15 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {"metadata_version": "1.1", "supported_by": "Ansible"} -DOCUMENTATION = """module: vyos_lldp_interfaces +DOCUMENTATION = """ +module: vyos_lldp_interfaces short_description: LLDP interfaces resource module description: This module manages attributes of lldp interfaces on VyOS network devices. +version_added: 1.0.0 notes: - Tested against VyOS 1.1.8 (helium). - This module works with connection C(network_cli). See L(the VyOS OS Platform Options,../network/user_guide/platform_vyos.html). -version_added: "1.0.0" author: - Rohit Thakur (@rohitthakur2590) options: @@ -110,12 +110,12 @@ options: type: str running_config: description: - - This option is used only with state I(parsed). - - The value of this option should be the output received from the VyOS device by executing - the command B(show configuration commands | grep lldp). - - The state I(parsed) reads the configuration from C(running_config) option and transforms - it into Ansible structured data as per the resource module's argspec and the value is then - returned in the I(parsed) key within the result. + - This option is used only with state I(parsed). + - The value of this option should be the output received from the VyOS device + by executing the command B(show configuration commands | grep lldp). + - The state I(parsed) reads the configuration from C(running_config) option and + transforms it into Ansible structured data as per the resource module's argspec + and the value is then returned in the I(parsed) key within the result. type: str state: description: @@ -142,21 +142,21 @@ EXAMPLES = """ - name: Merge provided configuration with device configuration vyos.vyos.vyos_lldp_interfaces: config: - - name: 'eth1' - location: - civic_based: - country_code: 'US' - ca_info: - - ca_type: 0 - ca_value: 'ENGLISH' + - name: eth1 + location: + civic_based: + country_code: US + ca_info: + - ca_type: 0 + ca_value: ENGLISH - - name: 'eth2' - location: - coordinate_based: - altitude: 2200 - datum: 'WGS84' - longitude: '222.267255W' - latitude: '33.524449N' + - name: eth2 + location: + coordinate_based: + altitude: 2200 + datum: WGS84 + longitude: 222.267255W + latitude: 33.524449N state: merged # # @@ -236,21 +236,21 @@ EXAMPLES = """ - name: Replace device configurations of listed LLDP interfaces with provided configurations vyos.vyos.vyos_lldp_interfaces: config: - - name: 'eth2' - location: - civic_based: - country_code: 'US' - ca_info: - - ca_type: 0 - ca_value: 'ENGLISH' + - name: eth2 + location: + civic_based: + country_code: US + ca_info: + - ca_type: 0 + ca_value: ENGLISH - - name: 'eth1' - location: - coordinate_based: - altitude: 2200 - datum: 'WGS84' - longitude: '222.267255W' - latitude: '33.524449N' + - name: eth1 + location: + coordinate_based: + altitude: 2200 + datum: WGS84 + longitude: 222.267255W + latitude: 33.524449N state: replaced # # @@ -359,9 +359,9 @@ EXAMPLES = """ - name: Overrides all device configuration with provided configuration vyos.vyos.vyos_lldp_interfaces: config: - - name: 'eth2' - location: - elin: 0000000911 + - name: eth2 + location: + elin: 0000000911 state: overridden # @@ -434,7 +434,7 @@ EXAMPLES = """ - name: Delete lldp interface attributes of given interfaces. vyos.vyos.vyos_lldp_interfaces: config: - - name: 'eth2' + - name: eth2 state: deleted # # @@ -442,14 +442,7 @@ EXAMPLES = """ # Module Execution Results # ------------------------ # - "before": [ - { - "location": { - "elin": 0000000911 - }, - "name": "eth2" - } - ] + before: [{location: {elin: 0000000911}, name: eth2}] # "commands": [ # "commands": [ # "delete service lldp interface eth2" @@ -532,20 +525,20 @@ EXAMPLES = """ - name: Render the commands for provided configuration vyos.vyos.vyos_lldp_interfaces: config: - - name: eth1 - location: - civic_based: - country_code: US - ca_info: - - ca_type: 0 - ca_value: ENGLISH - - name: eth2 - location: - coordinate_based: - altitude: 2200 - datum: WGS84 - longitude: 222.267255W - latitude: 33.524449N + - name: eth1 + location: + civic_based: + country_code: US + ca_info: + - ca_type: 0 + ca_value: ENGLISH + - name: eth2 + location: + coordinate_based: + altitude: 2200 + datum: WGS84 + longitude: 222.267255W + latitude: 33.524449N state: rendered # # @@ -573,11 +566,11 @@ EXAMPLES = """ vyos.vyos.vyos_lldp_interfaces: running_config: "set service lldp interface eth1 location civic-based ca-type 0 ca-value 'ENGLISH' - set service lldp interface eth1 location civic-based country-code 'US' - set service lldp interface eth2 location coordinate-based altitude '2200' - set service lldp interface eth2 location coordinate-based datum 'WGS84' - set service lldp interface eth2 location coordinate-based latitude '33.524449N' - set service lldp interface eth2 location coordinate-based longitude '222.267255W'" + set service lldp interface eth1 location civic-based country-code 'US' + set service lldp interface eth2 location coordinate-based altitude '2200' + set service lldp interface eth2 location coordinate-based datum 'WGS84' + set service lldp interface eth2 location coordinate-based latitude '33.524449N' + set service lldp interface eth2 location coordinate-based longitude '222.267255W'" state: parsed # # diff --git a/plugins/modules/vyos_logging.py b/plugins/modules/vyos_logging.py index 9f81eb9..8732647 100644 --- a/plugins/modules/vyos_logging.py +++ b/plugins/modules/vyos_logging.py @@ -19,17 +19,14 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -ANSIBLE_METADATA = { - "metadata_version": "1.1", - "status": ["preview"], - "supported_by": "network", -} -DOCUMENTATION = """module: vyos_logging +DOCUMENTATION = """ +module: vyos_logging author: Trishna Guha (@trishnaguha) short_description: Manage logging on network devices description: - This module provides declarative management of logging on Vyatta Vyos devices. +version_added: 1.0.0 notes: - Tested against VyOS 1.1.8 (helium). - This module works with connection C(network_cli). See L(the VyOS OS Platform Options,../network/user_guide/platform_vyos.html). @@ -68,36 +65,36 @@ extends_documentation_fragment: EXAMPLES = """ - name: configure console logging - vyos_logging: + vyos.vyos.vyos_logging: dest: console facility: all level: crit - name: remove console logging configuration - vyos_logging: + vyos.vyos.vyos_logging: dest: console state: absent - name: configure file logging - vyos_logging: + vyos.vyos.vyos_logging: dest: file name: test facility: local3 level: err - name: Add logging aggregate - vyos_logging: + vyos.vyos.vyos_logging: aggregate: - - { dest: file, name: test1, facility: all, level: info } - - { dest: file, name: test2, facility: news, level: debug } + - {dest: file, name: test1, facility: all, level: info} + - {dest: file, name: test2, facility: news, level: debug} state: present - name: Remove logging aggregate - vyos_logging: + vyos.vyos.vyos_logging: aggregate: - - { dest: console, facility: all, level: info } - - { dest: console, facility: daemon, level: warning } - - { dest: file, name: test2, facility: news, level: debug } + - {dest: console, facility: all, level: info} + - {dest: console, facility: daemon, level: warning} + - {dest: file, name: test2, facility: news, level: debug} state: absent """ diff --git a/plugins/modules/vyos_ospfv2.py b/plugins/modules/vyos_ospfv2.py index b320200..f890413 100644 --- a/plugins/modules/vyos_ospfv2.py +++ b/plugins/modules/vyos_ospfv2.py @@ -30,19 +30,18 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {"metadata_version": "1.1", "supported_by": "Ansible"} DOCUMENTATION = """ ---- module: vyos_ospfv2 -short_description: OSPFV2 resource module -description: This resource module configures and manages attributes of OSPFv2 routes on VyOS network devices. -version_added: "1.0.0" +short_description: OSPFv2 resource module +description: This resource module configures and manages attributes of OSPFv2 routes + on VyOS network devices. +version_added: 1.0.0 notes: - - Tested against VyOS 1.1.8 (helium). - - This module works with connection C(network_cli). See L(the VyOS OS Platform Options,../network/user_guide/platform_vyos.html). +- Tested against VyOS 1.1.8 (helium). +- This module works with connection C(network_cli). See L(the VyOS OS Platform Options,../network/user_guide/platform_vyos.html). author: - - Rohit Thakur (@rohitthakur2590) +- Rohit Thakur (@rohitthakur2590) options: config: description: A provided OSPFv2 route configuration. @@ -79,7 +78,7 @@ options: translate: description: NSSA-ABR. type: str - choices: ['always', 'candidate', 'never'] + choices: [always, candidate, never] stub: description: Stub OSPFv2 area. type: dict @@ -96,14 +95,14 @@ options: authentication: description: OSPFv2 area authentication type. type: str - choices: ['plaintext-password', 'md5'] + choices: [plaintext-password, md5] network: description: OSPFv2 network. type: list elements: dict suboptions: address: - required: True + required: true description: OSPFv2 IPv4 network address. type: str range: @@ -126,7 +125,7 @@ options: shortcut: description: Area's shortcut mode. type: str - choices: ['default', 'disable', 'enable'] + choices: [default, disable, enable] virtual_link: description: Virtual link address. type: list @@ -166,9 +165,9 @@ options: description: Link state transmit delay. type: int log_adjacency_changes: - description: Log changes in adjacency state. - type: str - choices: ['detail'] + description: Log changes in adjacency state. + type: str + choices: [detail] max_metric: description: OSPFv2 maximum/infinite-distance metric. type: dict @@ -265,19 +264,19 @@ options: descriptions: OSPFv2 specific parameters. type: dict suboptions: - abr_type: - description: OSPFv2 ABR Type. - type: str - choices: ['cisco', 'ibm', 'shortcut', 'standard'] - opaque_lsa: - description: Enable the Opaque-LSA capability (rfc2370). - type: bool - rfc1583_compatibility: - description: Enable rfc1583 criteria for handling AS external routes. - type: bool - router_id: - description: Override the default router identifier. - type: str + abr_type: + description: OSPFv2 ABR Type. + type: str + choices: [cisco, ibm, shortcut, standard] + opaque_lsa: + description: Enable the Opaque-LSA capability (rfc2370). + type: bool + rfc1583_compatibility: + description: Enable rfc1583 criteria for handling AS external routes. + type: bool + router_id: + description: Override the default router identifier. + type: str passive_interface: description: Suppress routing updates on an interface. type: list @@ -292,7 +291,7 @@ options: route_type: description: Route type to redistribute. type: str - choices: ['bgp', 'connected', 'kernel', 'rip', 'static'] + choices: [bgp, connected, kernel, rip, static] metric: description: Metric for redistribution routes. type: int @@ -325,7 +324,8 @@ options: type: dict suboptions: delay: - description: Delay (msec) from first change received till SPF calculation. + description: Delay (msec) from first change received till SPF + calculation. type: int initial_holdtime: description: Initial hold time(msec) between consecutive SPF calculations. @@ -335,16 +335,16 @@ options: type: int running_config: description: - - This option is used only with state I(parsed). - - The value of this option should be the output received from the VyOS device by executing - the command B(show configuration commands | grep ospf). - - The state I(parsed) reads the configuration from C(running_config) option and transforms - it into Ansible structured data as per the resource module's argspec and the value is then - returned in the I(parsed) key within the result. + - This option is used only with state I(parsed). + - The value of this option should be the output received from the VyOS device + by executing the command B(show configuration commands | grep ospf). + - The state I(parsed) reads the configuration from C(running_config) option and + transforms it into Ansible structured data as per the resource module's argspec + and the value is then returned in the I(parsed) key within the result. type: str state: description: - - The state the configuration should be left in. + - The state the configuration should be left in. type: str choices: - merged @@ -354,6 +354,7 @@ options: - gathered - rendered default: merged + """ EXAMPLES = """ # Using merged @@ -367,7 +368,7 @@ EXAMPLES = """ - name: Merge the provided configuration with the existing running configuration vyos.vyos.vyos_ospfv2: config: - log_adjacency_changes: 'detail' + log_adjacency_changes: detail max_metric: router_lsa: administrative: true @@ -378,49 +379,49 @@ EXAMPLES = """ always: true metric: 10 metric_type: 2 - route_map: 'ingress' + route_map: ingress mpls_te: enabled: true - router_address: '192.0.11.11' + router_address: 192.0.11.11 auto_cost: - reference_bandwidth: 2 + reference_bandwidth: 2 neighbor: - - neighbor_id: '192.0.11.12' - poll_interval: 10 - priority: 2 + - neighbor_id: 192.0.11.12 + poll_interval: 10 + priority: 2 redistribute: - - route_type: 'bgp' - metric: 10 - metric_type: 2 + - route_type: bgp + metric: 10 + metric_type: 2 passive_interface: - - 'eth1' - - 'eth2' + - eth1 + - eth2 parameters: - router_id: '192.0.1.1' + router_id: 192.0.1.1 opaque_lsa: true rfc1583_compatibility: true - abr_type: 'cisco' + abr_type: cisco areas: - - area_id: '2' - area_type: - normal: true - authentication: "plaintext-password" - shortcut: 'enable' - - area_id: '3' - area_type: - nssa: - set: true - - area_id: '4' - area_type: - stub: - default_cost: 20 - network: - - address: '192.0.2.0/24' - range: - - address: '192.0.3.0/24' - cost: 10 - - address: '192.0.4.0/24' - cost: 12 + - area_id: '2' + area_type: + normal: true + authentication: plaintext-password + shortcut: enable + - area_id: '3' + area_type: + nssa: + set: true + - area_id: '4' + area_type: + stub: + default_cost: 20 + network: + - address: 192.0.2.0/24 + range: + - address: 192.0.3.0/24 + cost: 10 + - address: 192.0.4.0/24 + cost: 12 state: merged # # @@ -608,23 +609,23 @@ EXAMPLES = """ vyos.vyos.vyos_ospfv2: config: areas: - - area_id: '2' - area_type: - normal: true - authentication: "plaintext-password" - shortcut: 'enable' - - area_id: '3' - area_type: - nssa: - set: false - - area_id: '4' - area_type: - stub: - default_cost: 20 - network: - - address: '192.0.2.0/24' - - address: '192.0.22.0/24' - - address: '192.0.32.0/24' + - area_id: '2' + area_type: + normal: true + authentication: plaintext-password + shortcut: enable + - area_id: '3' + area_type: + nssa: + set: false + - area_id: '4' + area_type: + stub: + default_cost: 20 + network: + - address: 192.0.2.0/24 + - address: 192.0.22.0/24 + - address: 192.0.32.0/24 state: merged # # @@ -898,7 +899,7 @@ EXAMPLES = """ - name: Replace ospfv2 routes attributes configuration. vyos.vyos.vyos_ospfv2: config: - log_adjacency_changes: 'detail' + log_adjacency_changes: detail max_metric: router_lsa: administrative: true @@ -909,45 +910,45 @@ EXAMPLES = """ always: true metric: 10 metric_type: 2 - route_map: 'ingress' + route_map: ingress mpls_te: enabled: true - router_address: '192.0.22.22' + router_address: 192.0.22.22 auto_cost: reference_bandwidth: 2 neighbor: - - neighbor_id: '192.0.11.12' - poll_interval: 10 - priority: 2 + - neighbor_id: 192.0.11.12 + poll_interval: 10 + priority: 2 redistribute: - - route_type: 'bgp' - metric: 10 - metric_type: 2 + - route_type: bgp + metric: 10 + metric_type: 2 passive_interface: - - 'eth1' + - eth1 parameters: - router_id: '192.0.1.1' + router_id: 192.0.1.1 opaque_lsa: true rfc1583_compatibility: true - abr_type: 'cisco' + abr_type: cisco areas: - - area_id: '2' - area_type: - normal: true - authentication: "plaintext-password" - shortcut: 'enable' - - area_id: '4' - area_type: - stub: - default_cost: 20 - network: - - address: '192.0.2.0/24' - - address: '192.0.12.0/24' - - address: '192.0.22.0/24' - - address: '192.0.32.0/24' - range: - - address: '192.0.42.0/24' - cost: 10 + - area_id: '2' + area_type: + normal: true + authentication: plaintext-password + shortcut: enable + - area_id: '4' + area_type: + stub: + default_cost: 20 + network: + - address: 192.0.2.0/24 + - address: 192.0.12.0/24 + - address: 192.0.22.0/24 + - address: 192.0.32.0/24 + range: + - address: 192.0.42.0/24 + cost: 10 state: replaced # # @@ -1191,7 +1192,7 @@ EXAMPLES = """ - name: Render the commands for provided configuration vyos.vyos.vyos_ospfv2: config: - log_adjacency_changes: 'detail' + log_adjacency_changes: detail max_metric: router_lsa: administrative: true @@ -1202,49 +1203,49 @@ EXAMPLES = """ always: true metric: 10 metric_type: 2 - route_map: 'ingress' + route_map: ingress mpls_te: enabled: true - router_address: '192.0.11.11' + router_address: 192.0.11.11 auto_cost: reference_bandwidth: 2 neighbor: - - neighbor_id: '192.0.11.12' - poll_interval: 10 - priority: 2 + - neighbor_id: 192.0.11.12 + poll_interval: 10 + priority: 2 redistribute: - - route_type: 'bgp' - metric: 10 - metric_type: 2 + - route_type: bgp + metric: 10 + metric_type: 2 passive_interface: - - 'eth1' - - 'eth2' + - eth1 + - eth2 parameters: - router_id: '192.0.1.1' + router_id: 192.0.1.1 opaque_lsa: true rfc1583_compatibility: true - abr_type: 'cisco' + abr_type: cisco areas: - - area_id: '2' - area_type: - normal: true - authentication: "plaintext-password" - shortcut: 'enable' - - area_id: '3' - area_type: - nssa: - set: true - - area_id: '4' - area_type: - stub: - default_cost: 20 - network: - - address: '192.0.2.0/24' - range: - - address: '192.0.3.0/24' - cost: 10 - - address: '192.0.4.0/24' - cost: 12 + - area_id: '2' + area_type: + normal: true + authentication: plaintext-password + shortcut: enable + - area_id: '3' + area_type: + nssa: + set: true + - area_id: '4' + area_type: + stub: + default_cost: 20 + network: + - address: 192.0.2.0/24 + range: + - address: 192.0.3.0/24 + cost: 10 + - address: 192.0.4.0/24 + cost: 12 state: rendered # # @@ -1301,34 +1302,34 @@ EXAMPLES = """ vyos.vyos.vyos_ospfv2: running_config: "set protocols ospf area 2 area-type 'normal' - set protocols ospf area 2 authentication 'plaintext-password' - set protocols ospf area 2 shortcut 'enable' - set protocols ospf area 3 area-type 'nssa' - set protocols ospf area 4 area-type stub default-cost '20' - set protocols ospf area 4 network '192.0.2.0/24' - set protocols ospf area 4 range 192.0.3.0/24 cost '10' - set protocols ospf area 4 range 192.0.4.0/24 cost '12' - set protocols ospf auto-cost reference-bandwidth '2' - set protocols ospf default-information originate 'always' - set protocols ospf default-information originate metric '10' - set protocols ospf default-information originate metric-type '2' - set protocols ospf default-information originate route-map 'ingress' - set protocols ospf log-adjacency-changes 'detail' - set protocols ospf max-metric router-lsa 'administrative' - set protocols ospf max-metric router-lsa on-shutdown '10' - set protocols ospf max-metric router-lsa on-startup '10' - set protocols ospf mpls-te 'enable' - set protocols ospf mpls-te router-address '192.0.11.11' - set protocols ospf neighbor 192.0.11.12 poll-interval '10' - set protocols ospf neighbor 192.0.11.12 priority '2' - set protocols ospf parameters abr-type 'cisco' - set protocols ospf parameters 'opaque-lsa' - set protocols ospf parameters 'rfc1583-compatibility' - set protocols ospf parameters router-id '192.0.1.1' - set protocols ospf passive-interface 'eth1' - set protocols ospf passive-interface 'eth2' - set protocols ospf redistribute bgp metric '10' - set protocols ospf redistribute bgp metric-type '2'" + set protocols ospf area 2 authentication 'plaintext-password' + set protocols ospf area 2 shortcut 'enable' + set protocols ospf area 3 area-type 'nssa' + set protocols ospf area 4 area-type stub default-cost '20' + set protocols ospf area 4 network '192.0.2.0/24' + set protocols ospf area 4 range 192.0.3.0/24 cost '10' + set protocols ospf area 4 range 192.0.4.0/24 cost '12' + set protocols ospf auto-cost reference-bandwidth '2' + set protocols ospf default-information originate 'always' + set protocols ospf default-information originate metric '10' + set protocols ospf default-information originate metric-type '2' + set protocols ospf default-information originate route-map 'ingress' + set protocols ospf log-adjacency-changes 'detail' + set protocols ospf max-metric router-lsa 'administrative' + set protocols ospf max-metric router-lsa on-shutdown '10' + set protocols ospf max-metric router-lsa on-startup '10' + set protocols ospf mpls-te 'enable' + set protocols ospf mpls-te router-address '192.0.11.11' + set protocols ospf neighbor 192.0.11.12 poll-interval '10' + set protocols ospf neighbor 192.0.11.12 priority '2' + set protocols ospf parameters abr-type 'cisco' + set protocols ospf parameters 'opaque-lsa' + set protocols ospf parameters 'rfc1583-compatibility' + set protocols ospf parameters router-id '192.0.1.1' + set protocols ospf passive-interface 'eth1' + set protocols ospf passive-interface 'eth2' + set protocols ospf redistribute bgp metric '10' + set protocols ospf redistribute bgp metric-type '2'" state: parsed # # @@ -1771,8 +1772,9 @@ commands: description: The set of commands pushed to the remote device. returned: always type: list - sample: ['set protocols ospf parameters router-id 192.0.1.1', - 'set protocols ospf passive-interface 'eth1'] + sample: + - "set protocols ospf parameters router-id 192.0.1.1" + - "set protocols ospf passive-interface 'eth1'" """ diff --git a/plugins/modules/vyos_ospfv3.py b/plugins/modules/vyos_ospfv3.py index 8248c8d..20296a0 100644 --- a/plugins/modules/vyos_ospfv3.py +++ b/plugins/modules/vyos_ospfv3.py @@ -30,17 +30,16 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {"metadata_version": "1.1", "supported_by": "Ansible"} DOCUMENTATION = """ ---- module: vyos_ospfv3 -short_description: OSPFV3 resource module. -description: This resource module configures and manages attributes of OSPFv3 routes on VyOS network devices. -version_added: "1.0.0" +short_description: OSPFV3 resource module +description: This resource module configures and manages attributes of OSPFv3 routes + on VyOS network devices. +version_added: 1.0.0 notes: - - Tested against VyOS 1.1.8 (helium). - - This module works with connection C(network_cli). See L(the VyOS OS Platform Options,../network/user_guide/platform_vyos.html). +- Tested against VyOS 1.1.8 (helium). +- This module works with connection C(network_cli). See L(the VyOS OS Platform Options,../network/user_guide/platform_vyos.html). author: - Rohit Thakur (@rohitthakur2590) options: @@ -80,9 +79,9 @@ options: descriptions: OSPFv3 specific parameters. type: dict suboptions: - router_id: - description: Override the default router identifier. - type: str + router_id: + description: Override the default router identifier. + type: str redistribute: description: Redistribute information from another routing protocol. type: list @@ -91,22 +90,22 @@ options: route_type: description: Route type to redistribute. type: str - choices: ['bgp', 'connected', 'kernel', 'ripng', 'static'] + choices: [bgp, connected, kernel, ripng, static] route_map: description: Route map references. type: str running_config: description: - - This option is used only with state I(parsed). - - The value of this option should be the output received from the VyOS device by executing - the command B(show configuration commands | grep ospfv3). - - The state I(parsed) reads the configuration from C(running_config) option and transforms - it into Ansible structured data as per the resource module's argspec and the value is then - returned in the I(parsed) key within the result. + - This option is used only with state I(parsed). + - The value of this option should be the output received from the VyOS device + by executing the command B(show configuration commands | grep ospfv3). + - The state I(parsed) reads the configuration from C(running_config) option and + transforms it into Ansible structured data as per the resource module's argspec + and the value is then returned in the I(parsed) key within the result. type: str state: description: - - The state the configuration should be left in. + - The state the configuration should be left in. type: str choices: - merged @@ -116,6 +115,7 @@ options: - gathered - rendered default: merged + """ EXAMPLES = """ # Using merged @@ -130,20 +130,20 @@ EXAMPLES = """ vyos.vyos.vyos_ospfv3: config: redistribute: - - route_type: 'bgp' + - route_type: bgp parameters: - router_id: '192.0.2.10' + router_id: 192.0.2.10 areas: - - area_id: '2' - export_list: 'export1' - import_list: 'import1' - range: - - address: '2001:db10::/32' - - address: '2001:db20::/32' - - address: '2001:db30::/32' - - area_id: '3' - range: - - address: '2001:db40::/32' + - area_id: '2' + export_list: export1 + import_list: import1 + range: + - address: 2001:db10::/32 + - address: 2001:db20::/32 + - address: 2001:db30::/32 + - area_id: '3' + range: + - address: 2001:db40::/32 state: merged # # @@ -236,20 +236,20 @@ EXAMPLES = """ vyos.vyos.vyos_ospfv3: config: redistribute: - - route_type: 'bgp' + - route_type: bgp parameters: - router_id: '192.0.2.10' + router_id: 192.0.2.10 areas: - - area_id: '2' - export_list: 'export1' - import_list: 'import1' - range: - - address: '2001:db10::/32' - - address: '2001:db30::/32' - - address: '2001:db50::/32' - - area_id: '4' - range: - - address: '2001:db60::/32' + - area_id: '2' + export_list: export1 + import_list: import1 + range: + - address: 2001:db10::/32 + - address: 2001:db30::/32 + - address: 2001:db50::/32 + - area_id: '4' + range: + - address: 2001:db60::/32 state: replaced # # @@ -360,20 +360,20 @@ EXAMPLES = """ vyos.vyos.vyos_ospfv3: config: redistribute: - - route_type: 'bgp' + - route_type: bgp parameters: - router_id: '192.0.2.10' + router_id: 192.0.2.10 areas: - - area_id: '2' - export_list: 'export1' - import_list: 'import1' - range: - - address: '2001:db10::/32' - - address: '2001:db20::/32' - - address: '2001:db30::/32' - - area_id: '3' - range: - - address: '2001:db40::/32' + - area_id: '2' + export_list: export1 + import_list: import1 + range: + - address: 2001:db10::/32 + - address: 2001:db20::/32 + - address: 2001:db30::/32 + - area_id: '3' + range: + - address: 2001:db40::/32 state: rendered # # @@ -404,13 +404,13 @@ EXAMPLES = """ vyos.vyos.vyos_ospfv3: running_config: "set protocols ospfv3 area 2 export-list 'export1' -set protocols ospfv3 area 2 import-list 'import1' -set protocols ospfv3 area 2 range '2001:db10::/32' -set protocols ospfv3 area 2 range '2001:db20::/32' -set protocols ospfv3 area 2 range '2001:db30::/32' -set protocols ospfv3 area 3 range '2001:db40::/32' -set protocols ospfv3 parameters router-id '192.0.2.10' -set protocols ospfv3 redistribute 'bgp'" + set protocols ospfv3 area 2 import-list 'import1' + set protocols ospfv3 area 2 range '2001:db10::/32' + set protocols ospfv3 area 2 range '2001:db20::/32' + set protocols ospfv3 area 2 range '2001:db30::/32' + set protocols ospfv3 area 3 range '2001:db40::/32' + set protocols ospfv3 parameters router-id '192.0.2.10' + set protocols ospfv3 redistribute 'bgp'" state: parsed # # @@ -624,8 +624,9 @@ commands: description: The set of commands pushed to the remote device. returned: always type: list - sample: ['set protocols ospf parameters router-id 192.0.1.1', - 'set protocols ospfv3 area 2 range '2001:db10::/32'] + sample: + - "set protocols ospf parameters router-id 192.0.1.1" + - "set protocols ospfv3 area 2 range '2001:db10::/32'" """ diff --git a/plugins/modules/vyos_ping.py b/plugins/modules/vyos_ping.py index 3d5a903..9131917 100644 --- a/plugins/modules/vyos_ping.py +++ b/plugins/modules/vyos_ping.py @@ -23,13 +23,9 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = { - "metadata_version": "1.1", - "status": ["preview"], - "supported_by": "community", -} -DOCUMENTATION = """module: vyos_ping +DOCUMENTATION = """ +module: vyos_ping short_description: Tests reachability using ping from VyOS network devices description: - Tests reachability using ping from a VyOS device to a remote destination. @@ -37,6 +33,7 @@ description: - For a general purpose network module, see the M(net_ping) module. - For Windows targets, use the M(win_ping) module instead. - For targets running Python, use the M(ping) module instead. +version_added: 1.0.0 author: - Nilashish Chakraborty (@NilashishC) options: @@ -83,23 +80,23 @@ extends_documentation_fragment: EXAMPLES = """ - name: Test reachability to 10.10.10.10 - vyos_ping: + vyos.vyos.vyos_ping: dest: 10.10.10.10 - name: Test reachability to 10.20.20.20 using source and ttl set - vyos_ping: + vyos.vyos.vyos_ping: dest: 10.20.20.20 source: eth0 ttl: 128 - name: Test unreachability to 10.30.30.30 using interval - vyos_ping: + vyos.vyos.vyos_ping: dest: 10.30.30.30 interval: 3 state: absent - name: Test reachability to 10.40.40.40 setting count and source - vyos_ping: + vyos.vyos.vyos_ping: dest: 10.40.40.40 source: eth1 count: 20 diff --git a/plugins/modules/vyos_static_route.py b/plugins/modules/vyos_static_route.py index af9a1e3..7859467 100644 --- a/plugins/modules/vyos_static_route.py +++ b/plugins/modules/vyos_static_route.py @@ -19,19 +19,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -ANSIBLE_METADATA = { - "metadata_version": "1.1", - "status": ["deprecated"], - "supported_by": "network", -} - -DOCUMENTATION = """module: vyos_static_route +DOCUMENTATION = """ +module: vyos_static_route author: Trishna Guha (@trishnaguha) -short_description: Manage static IP routes on Vyatta VyOS network devices +short_description: (deprecated) Manage static IP routes on Vyatta VyOS network devices description: - This module provides declarative management of static IP routes on Vyatta VyOS network devices. +version_added: 1.0.0 deprecated: removed_in: '2.13' alternative: vyos_static_routes @@ -70,39 +66,40 @@ options: type: str extends_documentation_fragment: - vyos.vyos.vyos + """ EXAMPLES = """ - name: configure static route - vyos_static_route: + vyos.vyos.vyos_static_route: prefix: 192.168.2.0 mask: 24 next_hop: 10.0.0.1 - name: configure static route prefix/mask - vyos_static_route: + vyos.vyos.vyos_static_route: prefix: 192.168.2.0/16 next_hop: 10.0.0.1 - name: remove configuration - vyos_static_route: + vyos.vyos.vyos_static_route: prefix: 192.168.2.0 mask: 16 next_hop: 10.0.0.1 state: absent - name: configure aggregates of static routes - vyos_static_route: + vyos.vyos.vyos_static_route: aggregate: - - { prefix: 192.168.2.0, mask: 24, next_hop: 10.0.0.1 } - - { prefix: 192.168.3.0, mask: 16, next_hop: 10.0.2.1 } - - { prefix: 192.168.3.0/16, next_hop: 10.0.2.1 } + - {prefix: 192.168.2.0, mask: 24, next_hop: 10.0.0.1} + - {prefix: 192.168.3.0, mask: 16, next_hop: 10.0.2.1} + - {prefix: 192.168.3.0/16, next_hop: 10.0.2.1} - name: Remove static route collections - vyos_static_route: + vyos.vyos.vyos_static_route: aggregate: - - { prefix: 172.24.1.0/24, next_hop: 192.168.42.64 } - - { prefix: 172.24.3.0/24, next_hop: 192.168.42.64 } + - {prefix: 172.24.1.0/24, next_hop: 192.168.42.64} + - {prefix: 172.24.3.0/24, next_hop: 192.168.42.64} state: absent """ diff --git a/plugins/modules/vyos_static_routes.py b/plugins/modules/vyos_static_routes.py index 082b4f4..fa29b72 100644 --- a/plugins/modules/vyos_static_routes.py +++ b/plugins/modules/vyos_static_routes.py @@ -30,12 +30,12 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = {"metadata_version": "1.1", "supported_by": "Ansible"} -DOCUMENTATION = """module: vyos_static_routes +DOCUMENTATION = """ +module: vyos_static_routes short_description: Static routes resource module description: This module manages attributes of static routes on VyOS network devices. -version_added: "1.0.0" +version_added: 1.0.0 notes: - Tested against VyOS 1.1.8 (helium). - This module works with connection C(network_cli). See L(the VyOS OS Platform Options,../network/user_guide/platform_vyos.html). @@ -111,12 +111,12 @@ options: type: str running_config: description: - - This option is used only with state I(parsed). - - The value of this option should be the output received from the VyOS device by executing - the command B(show configuration commands | grep static route). - - The state I(parsed) reads the configuration from C(running_config) option and transforms - it into Ansible structured data as per the resource module's argspec and the value is then - returned in the I(parsed) key within the result. + - This option is used only with state I(parsed). + - The value of this option should be the output received from the VyOS device + by executing the command B(show configuration commands | grep static route). + - The state I(parsed) reads the configuration from C(running_config) option and + transforms it into Ansible structured data as per the resource module's argspec + and the value is then returned in the I(parsed) key within the result. type: str state: description: @@ -143,24 +143,24 @@ EXAMPLES = """ - name: Merge the provided configuration with the exisiting running configuration vyos.vyos.vyos_static_routes: config: - - address_families: - - afi: 'ipv4' - routes: - - dest: 192.0.2.32/28 - blackhole_config: - type: 'blackhole' - next_hops: - - forward_router_address: 192.0.2.6 - - forward_router_address: 192.0.2.7 - - address_families: - - afi: 'ipv6' - routes: - - dest: 2001:db8:1000::/36 - blackhole_config: - distance: 2 - next_hops: - - forward_router_address: 2001:db8:2000:2::1 - - forward_router_address: 2001:db8:2000:2::2 + - address_families: + - afi: ipv4 + routes: + - dest: 192.0.2.32/28 + blackhole_config: + type: blackhole + next_hops: + - forward_router_address: 192.0.2.6 + - forward_router_address: 192.0.2.7 + - address_families: + - afi: ipv6 + routes: + - dest: 2001:db8:1000::/36 + blackhole_config: + distance: 2 + next_hops: + - forward_router_address: 2001:db8:2000:2::1 + - forward_router_address: 2001:db8:2000:2::2 state: merged # # @@ -257,16 +257,16 @@ EXAMPLES = """ - name: Replace device configurations of listed static routes with provided configurations vyos.vyos.vyos_static_routes: config: - - address_families: - - afi: 'ipv4' - routes: - - dest: 192.0.2.32/28 - blackhole_config: - distance: 2 - next_hops: - - forward_router_address: 192.0.2.7 - enabled: false - - forward_router_address: 192.0.2.9 + - address_families: + - afi: ipv4 + routes: + - dest: 192.0.2.32/28 + blackhole_config: + distance: 2 + next_hops: + - forward_router_address: 192.0.2.7 + enabled: false + - forward_router_address: 192.0.2.9 state: replaced # # @@ -433,12 +433,12 @@ EXAMPLES = """ - name: Overrides all device configuration with provided configuration vyos.vyos.vyos_static_routes: config: - - address_families: - - afi: 'ipv4' - routes: - - dest: 198.0.2.48/28 - next_hops: - - forward_router_address: 192.0.2.18 + - address_families: + - afi: ipv4 + routes: + - dest: 198.0.2.48/28 + next_hops: + - forward_router_address: 192.0.2.18 state: overridden # # @@ -543,9 +543,9 @@ EXAMPLES = """ - name: Delete static route based on afi. vyos.vyos.vyos_static_routes: config: - - address_families: - - afi: 'ipv4' - - afi: 'ipv6' + - address_families: + - afi: ipv4 + - afi: ipv6 state: deleted # # @@ -694,24 +694,24 @@ EXAMPLES = """ - name: Render the commands for provided configuration vyos.vyos.vyos_static_routes: config: - - address_families: - - afi: 'ipv4' - routes: - - dest: 192.0.2.32/28 - blackhole_config: - type: 'blackhole' - next_hops: - - forward_router_address: 192.0.2.6 - - forward_router_address: 192.0.2.7 - - address_families: - - afi: 'ipv6' - routes: - - dest: 2001:db8:1000::/36 - blackhole_config: - distance: 2 - next_hops: - - forward_router_address: 2001:db8:2000:2::1 - - forward_router_address: 2001:db8:2000:2::2 + - address_families: + - afi: ipv4 + routes: + - dest: 192.0.2.32/28 + blackhole_config: + type: blackhole + next_hops: + - forward_router_address: 192.0.2.6 + - forward_router_address: 192.0.2.7 + - address_families: + - afi: ipv6 + routes: + - dest: 2001:db8:1000::/36 + blackhole_config: + distance: 2 + next_hops: + - forward_router_address: 2001:db8:2000:2::1 + - forward_router_address: 2001:db8:2000:2::2 state: rendered # # @@ -739,11 +739,11 @@ EXAMPLES = """ vyos.vyos.vyos_static_routes: running_config: "set protocols static route 192.0.2.32/28 'blackhole' - set protocols static route 192.0.2.32/28 next-hop '192.0.2.6' - set protocols static route 192.0.2.32/28 next-hop '192.0.2.7' - set protocols static route6 2001:db8:1000::/36 blackhole distance '2' - set protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::1' - set protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::2'" + set protocols static route 192.0.2.32/28 next-hop '192.0.2.6' + set protocols static route 192.0.2.32/28 next-hop '192.0.2.7' + set protocols static route6 2001:db8:1000::/36 blackhole distance '2' + set protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::1' + set protocols static route6 2001:db8:1000::/36 next-hop '2001:db8:2000:2::2'" state: parsed # # diff --git a/plugins/modules/vyos_system.py b/plugins/modules/vyos_system.py index b49462b..53b04c8 100644 --- a/plugins/modules/vyos_system.py +++ b/plugins/modules/vyos_system.py @@ -17,19 +17,15 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -ANSIBLE_METADATA = { - "metadata_version": "1.1", - "status": ["preview"], - "supported_by": "network", -} - -DOCUMENTATION = """module: vyos_system +DOCUMENTATION = """ +module: vyos_system author: Nathaniel Case (@Qalthos) short_description: Run `set system` commands on VyOS devices description: - Runs one or more commands on remote devices running VyOS. This module can also be introspected to validate key parameters before returning successfully. +version_added: 1.0.0 extends_documentation_fragment: - vyos.vyos.vyos notes: @@ -71,25 +67,21 @@ commands: EXAMPLES = """ - name: configure hostname and domain-name - vyos_system: + vyos.vyos.vyos_system: host_name: vyos01 domain_name: test.example.com - name: remove all configuration - vyos_system: + vyos.vyos.vyos_system: state: absent - name: configure name servers - vyos_system: - name_servers - - 8.8.8.8 - - 8.8.4.4 - + vyos.vyos.vyos_system: name_servers - 8.8.8.8 - 8.8.4.4 - name: configure domain search suffixes - vyos_system: + vyos.vyos.vyos_system: domain_search: - - sub1.example.com - - sub2.example.com + - sub1.example.com + - sub2.example.com """ from ansible.module_utils.basic import AnsibleModule diff --git a/plugins/modules/vyos_user.py b/plugins/modules/vyos_user.py index d619524..d788a99 100644 --- a/plugins/modules/vyos_user.py +++ b/plugins/modules/vyos_user.py @@ -19,13 +19,9 @@ # along with Ansible. If not, see <http://www.gnu.org/licenses/>. # -ANSIBLE_METADATA = { - "metadata_version": "1.1", - "status": ["preview"], - "supported_by": "network", -} -DOCUMENTATION = """module: vyos_user +DOCUMENTATION = """ +module: vyos_user author: Trishna Guha (@trishnaguha) short_description: Manage the collection of local users on VyOS device description: @@ -33,6 +29,7 @@ description: network devices. It allows playbooks to manage either individual usernames or the collection of usernames in the current running config. It also supports purging usernames from the configuration that are not explicitly defined. +version_added: 1.0.0 notes: - Tested against VyOS 1.1.8 (helium). - This module works with connection C(network_cli). See L(the VyOS OS Platform Options,../network/user_guide/platform_vyos.html). @@ -98,24 +95,24 @@ extends_documentation_fragment: EXAMPLES = """ - name: create a new user - vyos_user: + vyos.vyos.vyos_user: name: ansible configured_password: password state: present - name: remove all users except admin - vyos_user: + vyos.vyos.vyos_user: purge: yes - name: set multiple users to level operator - vyos_user: + vyos.vyos.vyos_user: aggregate: - - name: netop - - name: netend + - name: netop + - name: netend level: operator state: present - name: Change Password for User netop - vyos_user: + vyos.vyos.vyos_user: name: netop - configured_password: "{{ new_password }}" + configured_password: '{{ new_password }}' update_password: always state: present """ diff --git a/plugins/modules/vyos_vlan.py b/plugins/modules/vyos_vlan.py index 04f5856..a271dd4 100644 --- a/plugins/modules/vyos_vlan.py +++ b/plugins/modules/vyos_vlan.py @@ -9,17 +9,13 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -ANSIBLE_METADATA = { - "metadata_version": "1.1", - "status": ["preview"], - "supported_by": "network", -} - -DOCUMENTATION = """module: vyos_vlan +DOCUMENTATION = """ +module: vyos_vlan author: Trishna Guha (@trishnaguha) short_description: Manage VLANs on VyOS network devices description: - This module provides declarative management of VLANs on VyOS network devices. +version_added: 1.0.0 notes: - Tested against VyOS 1.1.8 (helium). - This module works with connection C(network_cli). See L(the VyOS OS Platform Options,../network/user_guide/platform_vyos.html). @@ -68,41 +64,41 @@ extends_documentation_fragment: EXAMPLES = """ - name: Create vlan - vyos_vlan: + vyos.vyos.vyos_vlan: vlan_id: 100 name: vlan-100 interfaces: eth1 state: present - name: Add interfaces to VLAN - vyos_vlan: + vyos.vyos.vyos_vlan: vlan_id: 100 interfaces: - - eth1 - - eth2 + - eth1 + - eth2 - name: Configure virtual interface address - vyos_vlan: + vyos.vyos.vyos_vlan: vlan_id: 100 interfaces: eth1 address: 172.26.100.37/24 - name: vlan interface config + intent - vyos_vlan: + vyos.vyos.vyos_vlan: vlan_id: 100 interfaces: eth0 associated_interfaces: - eth0 - name: vlan intent check - vyos_vlan: + vyos.vyos.vyos_vlan: vlan_id: 100 associated_interfaces: - eth3 - eth4 - name: Delete vlan - vyos_vlan: + vyos.vyos.vyos_vlan: vlan_id: 100 interfaces: eth1 state: absent |