1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. http://creativecommons.org/licenses/by/4.0
3 .. Copyright 2017 AT&T Intellectual Property. All rights reserved.
5 Ansible JSON Key Value Description
6 -------------------------------------------------------------
8 The following provides the key value pairs that must be contained in the
9 JSON file supporting Ansible action.
11 Table B1. Ansible JSON File key value description
12 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14 +---------------+----------------------+---------+----------------------------+
15 | **Field Name**| **Description** | **Type**| **Comment** |
16 +===============+======================+=========+============================+
17 | PlaybookName | VNF providor must |Mandatory|Currently following |
18 | | list name of the | |Ansible standard |
19 | | playbook relative | |naming, where main |
20 | | path used to | |playbook is always |
21 | | execute the VNF | |named site.yml, and |
22 | | action. | |directory name where |
23 | | | |this main playbook resides, |
24 | | | |is named after the |
25 | | | |command/action playbook |
26 | | | |performs, in lower case, |
27 | | | |example, configure. |
28 +---------------+----------------------+---------+----------------------------+
29 | Action | Name of VNF action. | Optional| |
30 +---------------+----------------------+---------+----------------------------+
31 | EnvParameters | A JSON dictionary | Optional|Depends on the VNF action. |
32 | | which should list key| | |
33 | | value pairs to be | |Attribute names (variable |
34 | | passed to the Ansible| |names) passed to Ansible |
35 | | playbook. These | |shall follow Ansible valid |
36 | | values would | |variable names: “Variable |
37 | | correspond to | |names should be letters, |
38 | | instance specific | |numbers, and underscores. |
39 | | parameters that a | |Variables should always |
40 | | playbook may need to | |start with a letter.” |
41 | | execute an action. | | |
42 +---------------+----------------------+---------+----------------------------+
43 | NodeList |Ansible inventory | Optional|If not provided, pre-loaded |
44 | |hosts file with | |(VNF) inventory hosts |
45 | |VNF groups and | |file must exist in the |
46 | |respective IP | |Ansible Server otherwise |
47 | |addresses or DNS | |request fails. |
48 | |supported FQDNs | | |
49 | |that the playbook must| | |
50 | |be executed against. | | |
51 +---------------+----------------------+---------+----------------------------+
52 | FileParameters| A JSON dictionary | Optional| Depends on the VNF action |
53 | | where keys are | | and playbook design. |
54 | | filenames and values | | |
55 | | are contents of | | |
56 | | files. The Ansible | | |
57 | | Server will utilize | | |
58 | | this feature to | | |
59 | | generate files with | | |
60 | | keys as filenames and| | |
61 | | values as content. | | |
62 | | This attribute can be| | |
63 | | used to generate | | |
64 | | files that a playbook| | |
65 | | may require as part | | |
66 | | of execution. | | |
67 +---------------+----------------------+---------+----------------------------+
68 | Timeout | Time (in seconds) | Optional| |
69 | | that a playbook is | | |
70 | | expected to take to | | |
71 | | finish execution for | | |
72 | | the VNF. If playbook | | |
73 | | execution time | | |
74 | | exceeds this value, | | |
75 | | Ansible Server will | | |
76 | | terminate the | | |
77 | | playbook process. | | |
78 +---------------+----------------------+---------+----------------------------+
80 Ansible JSON file example:
86 "PlaybookName": "<VNFCode>/<Version>/ansible/configure/site.yml",
88 "NodeList": ["test1.vnf\_b.onap.com", “test2.vnf\_b.onap.com”],
92 "EnvParameters": {"Retry": 3, "Wait": 5, “ConfigFile”:”config.txt”},
94 “FileParameters”:{“config.txt”:”db\_ip=10.1.1.1, sip\_timer=10000”}
98 In the above example, the Ansible Server will:
100 a. Process the “FileParameters” dictionary and generate a file named
101 ‘config.txt’ with contents set to the value of the ‘config.txt’ key.
103 b. Execute the playbook named ‘<VNFCode>/<Version>/ansible/configure/site.yml’
104 on nodes with FQDNs test1.vnf\_b.onap.com and test2.vnf\_b.onap.com
105 respectively while providing the following key value pairs to the playbook:
106 Retry=3, Wait=5, ConfigFile=config.txt
109 c. If execution time of the playbook exceeds 60 secs (across all hosts),
110 it will be terminated.