Adding Netbox
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
---
|
||||
template_path: "{{ role_path }}/templates"
|
||||
@@ -0,0 +1,14 @@
|
||||
---
|
||||
- name: generate config
|
||||
debug:
|
||||
msg: "{{ lookup('json_template', '{{ template_path }}/config.json') }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "'GigabitEthernet0/0' in result.msg"
|
||||
- "'config' in result['msg']['GigabitEthernet0/0']"
|
||||
- "'Configured by Ansible' in result['msg']['GigabitEthernet0/0']['config']['description']"
|
||||
- "result['msg']['GigabitEthernet0/0']['config']['mtu'] == '1500'"
|
||||
- "'iGbE' in result['msg']['GigabitEthernet0/0']['config']['type']"
|
||||
- "'GigabitEthernet0/0' in result['msg']['GigabitEthernet0/0']['config']['name']"
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
- name: import dependency role for test
|
||||
import_role:
|
||||
name: "{{ role_path.split('/tests/json_template/json_template')[0] }}"
|
||||
|
||||
- name: json_template lookup plugin test
|
||||
import_tasks: json_lookup.yaml
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"object": [
|
||||
{
|
||||
"object": [
|
||||
{
|
||||
"value": "GigabitEthernet0/0",
|
||||
"key": "name"
|
||||
},
|
||||
{
|
||||
"value": "iGbE",
|
||||
"key": "type"
|
||||
},
|
||||
{
|
||||
"value": "1500",
|
||||
"key": "mtu"
|
||||
},
|
||||
{
|
||||
"value": "Configured by Ansible",
|
||||
"key": "description"
|
||||
}
|
||||
],
|
||||
"key": "config"
|
||||
}
|
||||
],
|
||||
"key": "GigabitEthernet0/0"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
connection: local
|
||||
roles:
|
||||
- json_template
|
||||
Reference in New Issue
Block a user