Skip to content

Commit 83d51d1

Browse files
author
Bradley A. Thornton
authored
Merge pull request #4 from ansible-network/bt_example_n_return_to_doc
Bt example n return to doc
2 parents d85ff42 + 4ab7a82 commit 83d51d1

File tree

7 files changed

+84
-25
lines changed

7 files changed

+84
-25
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
# Using deleted
3+
4+
<placeholder for the configuration example prior to module invocation>
5+
6+
- name: Configure interfaces
7+
myos_interfaces:
8+
operation: deleted
9+
10+
<placeholder for the configuration example after module invocation>

models/myos/interfaces/merge_example_01.yml

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
# Using merged
3+
4+
<placeholder for the configuration example prior to module invocation>
5+
6+
- name: Configure interfaces
7+
nxos_interfaces:
8+
config:
9+
- name: Ethernet1/1
10+
description: 'Configured by Ansible'
11+
enable: True
12+
- name: Ethernet1/2
13+
description: 'Configured by Ansible'
14+
enable: False
15+
operation: merged
16+
17+
<placeholder for the configuration example after module invocation>

models/myos/interfaces/myos_interfaces.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ info:
1717
extends_documentation_fragment: myos
1818
notes:
1919
- Tested against <network_os> <version>
20-
2120
schema:
2221
type: object
2322
description: The schema used for the argspec and docstring
@@ -83,10 +82,11 @@ definitions:
8382
enum:
8483
- merged
8584
- replaced
86-
- overriden
85+
- overridden
8786
- deleted
8887
default: merged
89-
90-
91-
examples:
92-
- merge_example_01.yml
88+
examples:
89+
- merged_example_01.txt
90+
- replaced_example_01.txt
91+
- overridden_example_01.txt
92+
- deleted_example_01.txt
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
# Using overridden
3+
4+
<placeholder for the configuration example prior to module invocation>
5+
6+
- name: Configure interfaces
7+
myos_interfaces:
8+
config:
9+
- name: Ethernet1/1
10+
description: 'Configured by Ansible'
11+
enable: True
12+
- name: Ethernet1/2
13+
description: 'Configured by Ansible'
14+
enable: False
15+
operation: overridden
16+
17+
<placeholder for the configuration example after module invocation>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
# Using replaced
3+
4+
<placeholder for the configuration example prior to module invocation>
5+
6+
- name: Configure interfaces
7+
nxos_interfaces:
8+
config:
9+
- name: Ethernet1/1
10+
description: 'Configured by Ansible'
11+
enable: True
12+
- name: Ethernet1/2
13+
description: 'Configured by Ansible'
14+
enable: False
15+
operation: replaced
16+
17+
<placeholder for the configuration example after module invocation>

roles/resource_module/templates/module_directory/network_os/network_os_resource.py.j2

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,26 @@ author: {{ rm['info']['authors'] }}
2727
"""
2828

2929
EXAMPLES = """
30-
- name: Configure interfaces
31-
nxos_interfaces:
32-
config:
33-
- name: Ethernet1/1
34-
description: 'Configured by Ansible'
35-
enable: True
36-
- name: Ethernet1/2
37-
description: 'Configured by Ansible'
38-
enable: False
39-
operation: merge
40-
30+
---
31+
{% for example in rm['examples'] %}
32+
{{ lookup('file', model|dirname + '/' +example) }}
33+
{% endfor %}
4134
"""
4235

4336
RETURN = """
37+
before:
38+
description: The configuration prior to the model invocation
39+
returned: always
40+
sample: The configuration returned will alwys be in the same format of the paramters above.
41+
after:
42+
description: The resulting configuration model invocation
43+
returned: when changed
44+
sample: The configuration returned will alwys be in the same format of the paramters above.
45+
commands:
46+
description: The set of commands pushed to the remote device
47+
returned: always
48+
type: list
49+
sample: ['command 1', 'command 2', 'command 3']
4450
"""
4551

4652

0 commit comments

Comments
 (0)