Skip to content

Instantly share code, notes, and snippets.

@alexcos78
Created May 4, 2021 12:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexcos78/beb87d024cbf2bbb5e9bd3b8af200b4a to your computer and use it in GitHub Desktop.
Save alexcos78/beb87d024cbf2bbb5e9bd3b8af200b4a to your computer and use it in GitHub Desktop.
2021-05-04 12:28:26,670 - InfrastructureManager - DEBUG - TOSCA: tosca_definitions_version: tosca_simple_yaml_1_0
metadata:
template_name: template
template_version: 1.0.0-SNAPSHOT
template_author: orchestrator
description: "Launch a compute node getting the IP and SSH credentials to access via ssh"
imports:
- indigo_custom_types: https://raw.githubusercontent.com/indigo-dc/tosca-types/k8s/custom_types.yaml
topology_template:
inputs:
num_cpus:
type: integer
required: true
default: 1
constraints:
- valid_values: [1, 2, 4]
description: "Number of virtual cpus for the VM"
mem_size:
type: scalar-unit.size
required: true
default: "2 GB"
constraints:
- valid_values: ["2 GB", "4 GB"]
description: "Amount of memory for the VM"
num_instances:
type: integer
required: true
default: 1
description: "Number of VMs to be spawned"
os_distribution:
type: string
required: true
default: ubuntu
node_templates:
simple_node:
type: tosca.nodes.indigo.Compute
properties:
zabbix_server: "orchestrator.cloud.cnaf.infn.it"
zabbix_server_port: 10051
zabbix_server_metadata: "Linux 668c875e-9a39-4dc0-a710-17c41376c1e0"
capabilities:
scalable:
properties:
min_instances: 1
max_instances: 1
count: 1
os:
properties:
type: linux
distribution: ubuntu
image: "ost://cloud-api-pub.cr.cnaf.infn.it/6345e75f-c527-4a34-9561-33e37c0188e5"
endpoint:
properties:
private_ip: true
protocol: tcp
secure: false
network_name: PUBLIC
initiator: source
host:
properties:
num_cpus: 1
mem_size: "2 GB"
instance_type: "iotwins.small"
artifacts:
zabbix_agent_role:
file: indigo-dc.zabbix-agent
type: tosca.artifacts.AnsibleGalaxy.role
outputs:
node_creds:
value: { get_attribute: [ simple_node, endpoint, credential, 0 ] }
node_ip:
value: { get_attribute: [ simple_node, public_address, 0 ] }
2021-05-04 12:28:28,673 - InfrastructureManager - DEBUG - User requested 1 instances of type simple_node and there are 0
2021-05-04 12:28:44,925 - InfrastructureManager - INFO - Creating new Inf ID: 449aaa30-acd4-11eb-8b75-0242ac110004
2021-05-04 12:28:44,925 - InfrastructureManager - DEBUG - Inf ID: 449aaa30-acd4-11eb-8b75-0242ac110004 created Async.
2021-05-04 12:28:44,928 - InfrastructureManager - INFO - Inf ID:449aaa30-acd4-11eb-8b75-0242ac110004: Successfully created
2021-05-04 12:28:45,106 - InfrastructureManager - INFO - Adding resources to Inf ID: 449aaa30-acd4-11eb-8b75-0242ac110004
2021-05-04 12:28:45,127 - InfrastructureManager - DEBUG - Inf ID: 449aaa30-acd4-11eb-8b75-0242ac110004:
network private_net ( outbound = 'no' )
network public_net ( outbound = 'yes' )
system simple_node (
instance_name = 'simple_node' and
disk.0.os.name = 'linux' and
disk.0.os.flavour = 'ubuntu' and
disk.0.image.url = 'ost://cloud-api-pub.cr.cnaf.infn.it/6345e75f-c527-4a34-9561-33e37c0188e5' and
cpu.count >= 1 and
memory.size >= 2000000000B and
instance_type = 'iotwins.small' and
disk.0.applications contains (name = 'ansible.modules.indigo-dc.zabbix-agent') and
net_interface.0.connection = 'private_net' and
net_interface.1.connection = 'public_net'
)
configure simple_node_conf (
@begin
---
- pre_tasks:
- set_fact: hostname_prefix="{{ IM_INFRASTRUCTURE_ID }}."
when: IM_INFRASTRUCTURE_ID is defined
roles:
- role: indigo-dc.zabbix-agent
zabbix_agent_hostname_prefix: '{{hostname_prefix}}'
zabbix_agent_metadata: '{{ zabbix_server_metadata }}'
zabbix_agent_server: '{{ zabbix_server }}'
zabbix_agent_server_port: '{{ zabbix_server_port }}'
vars:
hostname_prefix: zagent.
zabbix_server: orchestrator.cloud.cnaf.infn.it
zabbix_server_metadata: Linux 668c875e-9a39-4dc0-a710-17c41376c1e0
zabbix_server_port: 10051
@end
)
contextualize (
system simple_node configure simple_node_conf step 1
)
deploy simple_node 1
2021-05-04 12:28:46,014 - InfrastructureManager - INFO - Getting state of the Inf ID: 449aaa30-acd4-11eb-8b75-0242ac110004
2021-05-04 12:28:46,034 - InfrastructureManager - INFO - Inf ID: 449aaa30-acd4-11eb-8b75-0242ac110004 is in state: pending
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment