From cc96f30a504aa32030eafefdba69d635869c7949 Mon Sep 17 00:00:00 2001 From: Alexis de Talhouët Date: Thu, 18 Apr 2019 16:27:20 -0400 Subject: Add support for Ansible packages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - rework how to provide packages - support proxy as parameters Change-Id: I1d10d921ead0837aa0f74b965cadf985424ceedc Issue-ID: CCCSDK-1215 Signed-off-by: Alexis de Talhouët --- .../remote_scripts/Definitions/artifact_types.json | 8 +++ .../remote_scripts/Definitions/data_types.json | 28 +++++++++- .../remote_scripts/Definitions/node_types.json | 10 +++- .../remote_scripts/Definitions/remote_scripts.json | 62 ++++++++++++++++++++++ .../remote_scripts/Scripts/ansible/first.yaml | 22 ++++++++ 5 files changed, 128 insertions(+), 2 deletions(-) create mode 100644 components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Scripts/ansible/first.yaml (limited to 'components/model-catalog/blueprint-model/test-blueprint/remote_scripts') diff --git a/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/artifact_types.json b/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/artifact_types.json index 445236354..a6a34ae8e 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/artifact_types.json +++ b/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/artifact_types.json @@ -7,6 +7,14 @@ "file_ext": [ "py" ] + }, + "artifact-script-ansible": { + "description": "Ansible Script file", + "version": "1.0.0", + "file_ext": [ + "yaml" + ], + "derived_from": "tosca.artifacts.Implementation" } } } \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/data_types.json b/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/data_types.json index b22e30d00..df594ab9e 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/data_types.json +++ b/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/data_types.json @@ -1,3 +1,29 @@ { - "data_types": {} + "data_types": { + "dt-system-packages": { + "description": "This represent System Package Data Type", + "version": "1.0.0", + "properties": { + "type": { + "required": true, + "type": "string", + "constraints": [ + { + "valid_values": [ + "ANSIBLE", "PYTHON" + ] + } + ] + }, + "package": { + "required": true, + "type": "list", + "entry_schema" : { + "type" : "string" + } + } + }, + "derived_from": "tosca.datatypes.Root" + } + } } \ No newline at end of file diff --git a/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/node_types.json b/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/node_types.json index cd63f0091..0ee00b3ba 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/node_types.json +++ b/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/node_types.json @@ -33,7 +33,15 @@ "command": { "description": "Command to execute.", "required": true, - "type": "string" + "type" : "string" + }, + "packages": { + "description": "Packages to install based on type.", + "required": true, + "type" : "list", + "entry_schema" : { + "type" : "dt-system-packages" + } } } } diff --git a/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/remote_scripts.json b/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/remote_scripts.json index 464911478..80ef02f4f 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/remote_scripts.json +++ b/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/remote_scripts.json @@ -51,6 +51,31 @@ } } } + }, + "execute-remote-ansible": { + "steps": { + "execute-script": { + "description": "Execute Remote Ansible Script", + "target": "execute-remote-ansible", + "activities": [ + { + "call_operation": "" + } + ] + } + }, + "inputs": {}, + "outputs": { + "logs": { + "type": "json", + "value": { + "get_attribute": [ + "execute-remote-ansible", + "execution-logs" + ] + } + } + } } }, "node_templates": { @@ -79,6 +104,43 @@ "file": "Scripts/python/SamplePython.py" } } + }, + "execute-remote-ansible": { + "type": "component-remote-python-executor", + "interfaces": { + "ComponentRemotePythonExecutor": { + "operations": { + "process": { + "implementation": { + "primary": "component-script" + }, + "inputs": { + "command": "ansible-playbook first.yaml", + "packages": [ + { + "type": "PYTHON", + "package": [ + "ansible" + ] + }, + { + "type": "ANSIBLE", + "package": [ + "juniper.junos" + ] + } + ] + } + } + } + } + }, + "artifacts": { + "component-script": { + "type": "artifact-script-ansible", + "file": "Scripts/ansible/first.yaml" + } + } } } } diff --git a/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Scripts/ansible/first.yaml b/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Scripts/ansible/first.yaml new file mode 100644 index 000000000..78d292e10 --- /dev/null +++ b/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Scripts/ansible/first.yaml @@ -0,0 +1,22 @@ +--- +- name: Get Device Facts + hosts: dc1 + roles: + - juniper.junos + connection: local + gather_facts: no + + tasks: + - name: Checking NETCONF connectivity + wait_for: + host: "{{ inventory_hostname }}" + port: 830 + timeout: 5 + + - name: Retrieving information from devices running Junos OS + juniper_junos_facts: + host: "{{ inventory_hostname }}" + + - name: Print version + debug: + var: junos.version \ No newline at end of file -- cgit 1.2.3-korg