Skip to content

Commit 3c67f66

Browse files
committed
added support for ansible list variables
1 parent a94ba86 commit 3c67f66

12 files changed

Lines changed: 352 additions & 105 deletions

File tree

2G-Service/ansible-config-2g/shell-definition.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ tosca_definitions_version: tosca_simple_yaml_1_0
33
metadata:
44
template_name: Ansible Config 2G
55
template_author: Quali
6-
template_version: 1.0.0
6+
template_version: 1.0.1
77
template_icon: shell-icon.png
88

99
description: >
@@ -49,7 +49,7 @@ node_types:
4949
constraints:
5050
- valid_values: [ ssh, winrm, network_cli ]
5151
Script Parameters:
52-
description: (Optional) key pair values passed playbook VARS file to be accesible in script. Pass in following format - key1,val1;key2,val2.
52+
description: (Optional) key pair values passed to HOST_VARS. Can pass simple arguments in this format (ansible_var1,val1;ansible_var2,val2) or JSON format for nested data structures (a dictionary or list of dictionaries accepted).
5353
type: string
5454
tags: [ user_input ]
5555
Inventory Groups:
@@ -69,6 +69,10 @@ node_types:
6969
description: (Optional) Defaults to master branch. This attribute relevant for downloading from non-master branches in Gitlab repos.
7070
type: string
7171
tags: [ user_input ]
72+
Ansible Config Selector:
73+
description: (Optional) An alternative to connectors. Create and match this attribute value on target resources. Both matching selector and connected resources will run together.
74+
type: string
75+
tags: [ user_input ]
7276
Service Categories:
7377
type: list
7478
default: [Configuration Management]

2G-Service/ansible-config-2g/src/data_model.py

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def address(self):
164164
@address.setter
165165
def address(self, value):
166166
"""
167-
(Optional) Address of Script Repo Server
167+
(Optional) Address of Script Repo Server.
168168
:type value: str
169169
"""
170170
self.attributes['Ansible Config 2G.Address'] = value
@@ -224,7 +224,7 @@ def playbook_script_path(self):
224224
@playbook_script_path.setter
225225
def playbook_script_path(self, value):
226226
"""
227-
Base URL to script. This path will join with script path passed to execute playbook command. (Github - https://raw.githubusercontent.com/QualiSystemsLab/App-Configuration-Demo-Scripts/master/, Gitlab - http://<SERVER_IP>/api/v4/projects/<PROJECT_ID>/repository/files)
227+
Path to script from root of repo. This will join with base path to create full URL.
228228
:type value: str
229229
"""
230230
self.attributes['Ansible Config 2G.Playbook Script Path'] = value
@@ -239,7 +239,7 @@ def playbook_url_full(self):
239239
@playbook_url_full.setter
240240
def playbook_url_full(self, value):
241241
"""
242-
Base URL to script. This path will join with script path passed to execute playbook command. (Github - https://raw.githubusercontent.com/QualiSystemsLab/App-Configuration-Demo-Scripts/master/, Gitlab - http://<SERVER_IP>/api/v4/projects/<PROJECT_ID>/repository/files)
242+
Full path URL of script. For Github can be "raw" url. For gitlab, pass Rest API formatted url (Github - https://raw.githubusercontent.com/QualiSystemsLab/App-Configuration-Demo-Scripts/master/<FILE_PATH>, Gitlab - http://<SERVER_IP>/api/v4/projects/<PROJECT_ID>/repository/files/<FILE_PATH>/raw?ref=<BRANCH>)
243243
:type value: str
244244
"""
245245
self.attributes['Ansible Config 2G.Playbook URL Full'] = value
@@ -252,9 +252,9 @@ def connection_method(self):
252252
return self.attributes['Ansible Config 2G.Connection Method'] if 'Ansible Config 2G.Connection Method' in self.attributes else None
253253

254254
@connection_method.setter
255-
def connection_method(self, value='SSH'):
255+
def connection_method(self, value='ssh'):
256256
"""
257-
For Linux / Windows connections
257+
Specifies the "ansible_connection" host variable
258258
:type value: str
259259
"""
260260
self.attributes['Ansible Config 2G.Connection Method'] = value
@@ -284,7 +284,7 @@ def inventory_groups(self):
284284
@inventory_groups.setter
285285
def inventory_groups(self, value):
286286
"""
287-
(Optional) Designating groups in playbook to be executed
287+
(Optional) Designating groups in playbook to be executed.
288288
:type value: str
289289
"""
290290
self.attributes['Ansible Config 2G.Inventory Groups'] = value
@@ -314,7 +314,7 @@ def timeout_minutes(self):
314314
@timeout_minutes.setter
315315
def timeout_minutes(self, value='10'):
316316
"""
317-
(Optional) Minutes to wait while polling target hosts
317+
(Optional) Minutes to wait while polling target hosts.
318318
:type value: float
319319
"""
320320
self.attributes['Ansible Config 2G.Timeout Minutes'] = value
@@ -327,13 +327,28 @@ def gitlab_branch(self):
327327
return self.attributes['Ansible Config 2G.Gitlab Branch'] if 'Ansible Config 2G.Gitlab Branch' in self.attributes else None
328328

329329
@gitlab_branch.setter
330-
def gitlab_branch(self, value='master'):
330+
def gitlab_branch(self, value):
331331
"""
332332
(Optional) Defaults to master branch. This attribute relevant for downloading from non-master branches in Gitlab repos.
333333
:type value: str
334334
"""
335335
self.attributes['Ansible Config 2G.Gitlab Branch'] = value
336336

337+
@property
338+
def ansible_config_selector(self):
339+
"""
340+
:rtype: str
341+
"""
342+
return self.attributes['Ansible Config 2G.Ansible Config Selector'] if 'Ansible Config 2G.Ansible Config Selector' in self.attributes else None
343+
344+
@ansible_config_selector.setter
345+
def ansible_config_selector(self, value):
346+
"""
347+
(Optional) As alternative to connectors, match this attribute with target resources. Similar to Execution Server Selector Workflow.
348+
:type value: str
349+
"""
350+
self.attributes['Ansible Config 2G.Ansible Config Selector'] = value
351+
337352
@property
338353
def name(self):
339354
"""

0 commit comments

Comments
 (0)