Skip to content
Snippets Groups Projects
Commit 83fe1ae8 authored by dehury's avatar dehury
Browse files

added remoteWorkstation

parent 9a5cdffa
No related branches found
No related tags found
No related merge requests found
tosca_definitions_version: tosca_simple_yaml_1_3
node_types:
radon.nodes.VM.RemoteWorkstation:
derived_from: tosca.nodes.Compute
metadata:
targetNamespace: "radon.nodes.VM"
abstract: "false"
final: "false"
attributes:
public_ip:
description: this is public IP
type: string
public_address:
description: This is similar to External IP
type: string
id:
description: public IP of the VM
type: string
properties:
ssh_username:
type: string
KeyFile:
type: string
description: Give the path to the Key file OR give the key file artifact
required: false
external_ip:
type: string
description: provide the external Ip of the existing VM.
interfaces:
Standard:
type: tosca.interfaces.node.lifecycle.Standard
operations:
stop:
description: The standard stop operation
start:
description: The standard start operation
create:
description: The standard create operation
inputs:
ssh_username:
type: string
required: true
default: { get_property: [ SELF, ssh_username ] }
KeyFile:
type: string
required: true
default: { get_property: [ SELF, KeyFile ] }
external_ip:
type: string
required: true
default: { get_property: [ SELF, external_ip ] }
implementation:
primary: create
timeout: 0
configure:
description: The standard configure operation
delete:
description: The standard delete operation
artifacts:
create:
type: radon.artifacts.Ansible
file: create.yml
Here it is assumed that the VM is already created and can be accessed through SSH.
\ No newline at end of file
text/plain
\ No newline at end of file
---
- hosts: all
gather_facts: false
tasks:
# - name: Create VM
# os_server:
# state: present
# name: "{{ vm_name }}"
# image: "{{ image }}"
# key_name: "{{ key_name }}"
# flavor: "{{ flavor }}"
# network: "{{ network }}"
# security_groups: default
# boot_from_volume: true
# volume_size: 20
# timeout: 200
# register: server_info
- name: Set attributes
set_stats:
data:
private_address: "{{ external_ip }}"
public_address: "{{ external_ip }}"
public_ip: "{{ external_ip }}"
id: "{{ external_ip }}"
# This task will be removed later
# - name: keep the IP so that later other VM can access this IP
# copy:
# dest: "/tmp/{{ vm_name }}_ip.txt"
# content: "{{ server_info.server.public_v4 }}"
- name: Create temporary invetory for ssh wait
add_host:
name: server
groups: vms
ansible_host: "{{ external_ip }}"
ansible_user: "{{ ssh_username }}"
ansible_ssh_private_key_file: "{{ KeyFile }}"
ansible_ssh_common_args: >
-o BatchMode=yes
-o UserKnownHostsFile=/dev/null
-o StrictHostKeyChecking=no
- hosts: vms
gather_facts: false
tasks:
- name: Wait for ssh to wake up
wait_for_connection:
timeout: 60
text/plain
\ No newline at end of file
......@@ -13,9 +13,9 @@ node_types:
default: { get_attribute: [ SELF, docker, port ] }
requirements:
- host:
capability: tosca.capabilities.Node
node: radon.nodes.VM.EC2
capability: tosca.capabilities.Compute
relationship: tosca.relationships.HostedOn
occurrences: [ 1, 1 ]
capabilities:
host:
occurrences: [ 1, UNBOUNDED ]
......@@ -29,9 +29,11 @@ node_types:
inputs:
ssh_user:
type: string
required: true
default: { get_attribute: [ SELF, host, ssh_user ] }
ssh_key_file:
type: string
required: true
default: { get_attribute: [ SELF, host, ssh_key_file ] }
implementation:
primary: create
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment