generated from ansible-collections/collection_template
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add filter documentation. * Update no-unwanted-files sanity check.
- Loading branch information
1 parent
d56410b
commit 02ecc0c
Showing
6 changed files
with
152 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
DOCUMENTATION: | ||
name: join | ||
short_description: Join a list of arguments to a command | ||
version_added: 2.0.0 | ||
description: | ||
- Join and quotes a list of arguments to a command. | ||
options: | ||
_input: | ||
description: | ||
- A list of arguments to quote and join. | ||
type: list | ||
elements: string | ||
required: true | ||
author: | ||
- Felix Fontein (@felixfontein) | ||
|
||
EXAMPLES: | | ||
- name: Join arguments for a RouterOS CLI command | ||
ansible.builtin.set_fact: | ||
arguments: "{{ ['foo=bar', 'comment=foo is bar'] | community.routeros.join }}" | ||
# Should result in 'foo=bar comment="foo is bar"' | ||
RETURN: | ||
_value: | ||
description: The joined and quoted result. | ||
type: string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
DOCUMENTATION: | ||
name: list_to_dict | ||
short_description: Convert a list of arguments to a dictionary | ||
version_added: 2.0.0 | ||
description: | ||
- Convert a list of arguments to a dictionary. | ||
options: | ||
_input: | ||
description: | ||
- A list of assignments. Can be the result of the C(community.routeros.split) filter. | ||
type: list | ||
elements: string | ||
required: true | ||
require_assignment: | ||
description: | ||
- Allows to accept arguments without values when set to C(false). | ||
type: boolean | ||
default: true | ||
skip_empty_values: | ||
description: | ||
- Allows to skip arguments whose value is empty when set to C(true). | ||
type: boolean | ||
default: false | ||
author: | ||
- Felix Fontein (@felixfontein) | ||
|
||
EXAMPLES: | | ||
- name: Convert a list to a dictionary | ||
ansible.builtin.set_fact: | ||
dictionary: "{{ ['foo=bar', 'comment=foo is bar'] | community.routeros.list_to_dict }}" | ||
# dictionary == {'foo': 'bar', 'comment': 'foo is bar'} | ||
RETURN: | ||
_value: | ||
description: A dictionary representation of the input data. | ||
type: dictionary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
DOCUMENTATION: | ||
name: quote_argument | ||
short_description: Quote an argument | ||
version_added: 2.0.0 | ||
description: | ||
- Quote an argument. | ||
options: | ||
_input: | ||
description: | ||
- An argument to quote. | ||
type: string | ||
required: true | ||
author: | ||
- Felix Fontein (@felixfontein) | ||
|
||
EXAMPLES: | | ||
- name: Quote a RouterOS CLI command argument | ||
ansible.builtin.set_fact: | ||
quoted: "{{ 'comment=this is a "comment"' | community.routeros.quote_argument }}" | ||
# Should result in 'comment="this is a \"comment\""' | ||
RETURN: | ||
_value: | ||
description: The quoted argument. | ||
type: string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
DOCUMENTATION: | ||
name: quote_argument_value | ||
short_description: Quote an argument value | ||
version_added: 2.0.0 | ||
description: | ||
- Quote an argument value. | ||
options: | ||
_input: | ||
description: | ||
- An argument value to quote. | ||
type: string | ||
required: true | ||
author: | ||
- Felix Fontein (@felixfontein) | ||
|
||
EXAMPLES: | | ||
- name: Quote a RouterOS CLI command argument's value | ||
ansible.builtin.set_fact: | ||
quoted: "{{ 'this is a "comment"' | community.routeros.quote_argument_value }}" | ||
# Should result in '"this is a \"comment\""' | ||
RETURN: | ||
_value: | ||
description: The quoted argument value. | ||
type: string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
DOCUMENTATION: | ||
name: split | ||
short_description: Split a command into arguments | ||
version_added: 2.0.0 | ||
description: | ||
- Split a command into arguments. | ||
options: | ||
_input: | ||
description: | ||
- A command. | ||
type: string | ||
required: true | ||
author: | ||
- Felix Fontein (@felixfontein) | ||
|
||
EXAMPLES: | | ||
- name: Split command into list of arguments | ||
ansible.builtin.set_fact: | ||
argument_list: "{{ 'foo=bar comment="foo is bar" baz' | community.routeros.split }}" | ||
# Should result in ['foo=bar', 'comment=foo is bar', 'baz'] | ||
RETURN: | ||
_value: | ||
description: The list of arguments. | ||
type: list | ||
elements: string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters