1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-22 13:33:52 +03:00

M #-: Add Firecracker to oneprovision (#819)

Signed-off-by: Ricardo Diaz <rdiaz@opennebula.io>
This commit is contained in:
Ricardo Diaz 2021-02-17 09:36:05 +01:00 committed by GitHub
parent c4c56207ea
commit 52b2f29bc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 536 additions and 3 deletions

View File

@ -9,7 +9,8 @@
roles:
- ddc
- opennebula-repository
- opennebula-node-kvm
- { role: opennebula-node-kvm, when: oneprovision_hypervisor == 'kvm' }
- { role: opennebula-node-firecracker, when: oneprovision_hypervisor == 'firecracker' }
- opennebula-ssh
- role: iptables
iptables_base_rules_services:

View File

@ -0,0 +1,9 @@
# opennebula-node-firecracker
## Description
Install the opennebula-node-firecracker package.
## Requirements
OpenNebula repository must be configured before executing this role.

View File

@ -0,0 +1,61 @@
---
- block:
- name: Update centos-release package
yum: name=centos-release state=latest
register: yum_result
until: yum_result is succeeded
retries: 3
delay: 10
- name: Install qemu-ev repository
yum: name=centos-release-qemu-ev state=latest
register: yum_result
until: yum_result is succeeded
retries: 3
delay: 10
- name: Install qemu-kvm-ev
yum: name=qemu-kvm-ev state=present
register: yum_result
until: yum_result is succeeded
retries: 3
delay: 10
when:
- ansible_distribution == "CentOS"
- ansible_distribution_major_version == "7"
- opennebula_node_kvm_use_ev
- block:
- name: Enable RHEV repo
command: subscription-manager repos --enable {{ opennebula_node_kvm_rhev_repo }}
register: sm_result
until: sm_result is succeeded
retries: 3
delay: 10
- name: Instal RHEV
yum: name=qemu-kvm-rhev state=latest
until: yum_result is succeeded
retries: 3
delay: 10
when:
- ansible_distribution == "RedHat"
- ansible_distribution_major_version == "7"
- opennebula_node_kvm_use_ev
- name: Install libgcrypt
package:
name: libgcrypt
state: latest
register: pkg_result
until: pkg_result is succeeded
retries: 3
delay: 10
when:
- ansible_os_family == "RedHat"
- ansible_distribution_major_version == "8"
- name: Install OpenNebula node Firecracker package
yum: name=opennebula-node-firecracker state=latest
register: yum_result
until: yum_result is succeeded
retries: 3
delay: 10

View File

@ -0,0 +1,10 @@
---
- name: Install OpenNebula node Firecracker package
apt:
name: opennebula-node-firecracker
state: latest
register: apt_result
until: apt_result is success
retries: 3
delay: 10

View File

@ -0,0 +1,11 @@
---
- include: centos.yml
when: ansible_os_family == "RedHat"
- include: debian.yml
when: ansible_os_family == "Debian"
- name: "create datastore for ONE_LOCATION"
file: path={{ one_location }}/var/datastores owner=oneadmin group=oneadmin state=directory
when: one_location is defined

View File

@ -17,7 +17,7 @@ inputs:
- name: 'aws_ami_image'
type: 'list'
options:
- 'ami-08b547f0dcb46c4d3'
- 'ami-00008506813cea27a'
- name: 'aws_instance_type'
type: 'list'
options:

View File

@ -21,6 +21,8 @@
defaults:
configuration:
oneprovision_hypervisor: 'kvm'
opennebula_node_kvm_use_ev: true
# required for copying recovery VM snaphosts to the replica host

View File

@ -0,0 +1,7 @@
The Firecracker provision uses the Firecracker virtualization technology to start VMs in virtualized hosts. It is useful for developing and testing purposes. It features the following characteristics:
* Hosts are provisioned as VMs in the selected provider
* The provision includes a public network (Internet reachable IPs)
* It also includes a virtual network template to create private VLANs. You need to instantiate this network template.
More information about using this provision can be found in the [OpenNebula documentation](https://opennebula.io)

View File

@ -0,0 +1,26 @@
name: 'aws-frankfurt'
description: 'Elastic cluster on AWS in Frankfurt'
provider: 'aws'
plain:
provision_type: 'hybrid+_firecracker'
image: 'AWS.webp'
location_key: 'region'
connection:
access_key: 'AWS access key'
secret_key: 'AWS secret key'
region: 'eu-central-1'
inputs:
- name: 'aws_ami_image'
type: 'list'
options:
- 'ami-04c21037b3f953d37'
- name: 'aws_instance_type'
type: 'list'
options:
- 'c5.metal'
- 'i3.metal'
- 'm5.metal'

View File

@ -0,0 +1,26 @@
name: 'aws-london'
description: 'Elastic cluster on AWS in London'
provider: 'aws'
plain:
provision_type: 'hybrid+_firecracker'
image: 'AWS.webp'
location_key: 'region'
connection:
access_key: 'AWS access key'
secret_key: 'AWS secret key'
region: 'eu-west-2'
inputs:
- name: 'aws_ami_image'
type: 'list'
options:
- 'ami-0bab5c8be0975423b'
- name: 'aws_instance_type'
type: 'list'
options:
- 'c5.metal'
- 'm5.metal'
- 'r5.metal'

View File

@ -0,0 +1,26 @@
name: 'aws-north-virginia'
description: 'Elastic cluster on AWS in North Virginia'
provider: 'aws'
plain:
provision_type: 'hybrid+_firecracker'
image: 'AWS.webp'
location_key: 'region'
connection:
access_key: 'AWS access key'
secret_key: 'AWS secret key'
region: 'us-east-1'
inputs:
- name: 'aws_ami_image'
type: 'list'
options:
- 'ami-0d6e9a57f6259ba3a'
- name: 'aws_instance_type'
type: 'list'
options:
- 'c5.metal'
- 'i3.metal'
- 'm5.metal'

View File

@ -0,0 +1,26 @@
name: 'aws-north-california'
description: 'Elastic cluster on AWS in North California'
provider: 'aws'
plain:
provision_type: 'hybrid+_firecracker'
image: 'AWS.webp'
location_key: 'region'
connection:
access_key: 'AWS access key'
secret_key: 'AWS secret key'
region: 'us-west-1'
inputs:
- name: 'aws_ami_image'
type: 'list'
options:
- 'ami-00008506813cea27a'
- name: 'aws_instance_type'
type: 'list'
options:
- 'c5.metal'
- 'i3.metal'
- 'm5.metal'

View File

@ -0,0 +1,46 @@
---
# ---------------------------------------------------------------------------- #
# Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
# ---------------------------------------------------------------------------- #
#-------------------------------------------------------------------------------
# datastores: Defines the storage area for the cluster using the SSH replication
# drivers. It creates the following datastores, using Replica driver:
# 1. Image datastore, ${cluster_name}-image
# 2. System datastore, ${cluster_name}-system
# 3. File datastore, ${cluster_name}-files
#
# Configuration/Input attributes:
# - replica_host: The host that will hold the cluster replicas and snapshots.
#-------------------------------------------------------------------------------
datastores:
- name: "${provision}-image"
type: 'image_ds'
ds_mad: 'fs'
tm_mad: 'ssh'
safe_dirs: "/var/tmp /tmp"
- name: "${provision}-system"
type: 'system_ds'
tm_mad: 'ssh'
safe_dirs: "/var/tmp /tmp"
replica_host: "use-first-host"
- name: "${provision}-files"
type: 'file_ds'
ds_mad: 'fs'
tm_mad: 'ssh'
safe_dirs: "/var/tmp /tmp"

View File

@ -0,0 +1,26 @@
---
# ---------------------------------------------------------------------------- #
# Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
# ---------------------------------------------------------------------------- #
#-------------------------------------------------------------------------------
# defaults: Common configuration attributes for provision objects
#--------------------------------------------------------------------------------
# configuration: Ansible role parameters.
#--------------------------------------------------------------------------------
# Check defaults/main.yml in each role for the available variables
#-------------------------------------------------------------------------------
...

View File

@ -0,0 +1,38 @@
---
# ---------------------------------------------------------------------------- #
# Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
# ---------------------------------------------------------------------------- #
inputs:
- name: 'number_hosts'
type: text
description: 'Number of AWS instances to create'
default: '1'
- name: 'number_public_ips'
type: text
description: 'Number of public IPs to get'
default: '1'
- name: 'aws_ami_image'
type: text
description: "AWS ami image used for host deployments"
default: ''
- name: 'aws_instance_type'
type: text
description: "AWS instance type, use bare-metal instances"
default: ''
...

View File

@ -0,0 +1,40 @@
---
# ---------------------------------------------------------------------------- #
# Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
# ---------------------------------------------------------------------------- #
networks:
- name: "${provision}-public"
vn_mad: 'elastic'
bridge: 'br0'
netrole: 'public'
provision:
count: "${input.number_public_ips}"
ar:
- provison_id: "${provision_id}"
size: '1'
ipam_mad: 'aws'
cidr: "${cluster.0.cidr}"
vntemplates:
- name: "${provision}-private"
vn_mad: 'vxlan'
phydev: 'eth0'
automatic_vlan_id: 'yes'
netrole: 'private'
vxlan_mode: 'evpn'
vxlan_tep: 'dev'
ip_link_conf: 'nolearning='
cluster_ids: "${cluster.0.id}"

View File

@ -0,0 +1,81 @@
---
# ---------------------------------------------------------------------------- #
# Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
# ---------------------------------------------------------------------------- #
#-------------------------------------------------------------------------------
# This is the canonical description file for a cluster build with 'AWS'
# resources using the KVM hypervisor.
# ------------------------------------------------------------------------------
name: 'aws-cluster'
provision_type: 'hybrid+_firecracker'
provider: 'aws'
image: 'OPENNEBULA-AWS.png'
extends:
- common.d/defaults.yml
- common.d/resources.yml
- common.d/firecracker_hosts.yml
- aws.d/datastores.yml
- aws.d/defaults.yml
- aws.d/inputs.yml
- aws.d/networks.yml
#-------------------------------------------------------------------------------
# playbook: Ansible playbook used for hosts configuration.The aws playbook
# include the following roles:
# - ddc
# - opennebula-repository
# - opennebula-node-kvm
# - opennebula-ssh
# - tuntap
# - bridged-networking
# - iptables
#-------------------------------------------------------------------------------
playbook:
- aws
#-------------------------------------------------------------------------------
# defaults: Common configuration attributes for provision objects
#--------------------------------------------------------------------------------
defaults:
provision:
provider_name: 'aws'
ami: "${input.aws_ami_image}"
instancetype: "${input.aws_instance_type}"
cloud_init: true
connection:
remote_user: 'centos'
#-------------------------------------------------------------------------------
# cluster: Parameters for the OpenNebula cluster. Applies to all the Hosts
#--------------------------------------------------------------------------------
# name: of the cluster
# description: Additional information
# reserved_cpu: In percentage. It will be subtracted from the TOTAL CPU
# reserved_memory: In percentage. It will be subtracted from the TOTAL MEM
#--------------------------------------------------------------------------------
cluster:
name: "${provision}"
description: 'AWS cluster'
reserved_cpu: '0'
reserved_mem: '0'
datastores:
- 1
- 2
provision:
cidr: '10.0.0.0/16'

View File

@ -0,0 +1,24 @@
---
# ---------------------------------------------------------------------------- #
# Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
# ---------------------------------------------------------------------------- #
#-------------------------------------------------------------------------------
# defaults: Common configuration attributes for provision objects
#--------------------------------------------------------------------------------
defaults:
configuration:
oneprovision_hypervisor: 'firecracker'

View File

@ -0,0 +1,35 @@
---
# ---------------------------------------------------------------------------- #
# Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
# ---------------------------------------------------------------------------- #
#-------------------------------------------------------------------------------
# hosts: Packet or AWS metal servers
# provision:
# - count: Number of servers to create
# - hostname: kvm-host1, kvm-host2 .... of the server
#
# You can define specific OpenNebula configuration attributes for all the hosts:
# - reserved_cpu: In percentage. It will be subtracted from the TOTAL CPU
# - reserved_memory: In percentage. It will be subtracted from the TOTAL MEM
#-------------------------------------------------------------------------------
hosts:
- im_mad: 'firecracker'
vm_mad: 'firecracker'
provision:
count: "${input.number_hosts}"
hostname: "firecracker-host${index}"
...

View File

@ -0,0 +1,36 @@
---
# ---------------------------------------------------------------------------- #
# Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
# ---------------------------------------------------------------------------- #
#-------------------------------------------------------------------------------
# Use this file to define custom resources associated to the cluster, example:
# - images
# - marketplaceapps
# - templates
# - vntemplates
# - flowtemplates
#
# Cross-references to other objects can be made:
# - by name, eg. ${datastore.images.id} to get the OpenNebula ID of the
# datastore with name "images"
# - by index, eg. ${datastore.0.id} to get the OpenNebula ID of the **first**
# datastore defined in the provision
#-------------------------------------------------------------------------------
images:
- name: fc_kernel
ds_id: "${datastore.2.id}"
type: kernel
path: https://marketplace.opennebula.io/appliance/634c654e-e32c-43d4-9370-20d0e97a3de2/download/0

View File

@ -17,7 +17,7 @@ inputs:
- name: 'aws_ami_image'
type: 'list'
options:
- 'ami-08b547f0dcb46c4d3'
- 'ami-00008506813cea27a'
- name: 'aws_instance_type'
type: 'list'
options:

View File

@ -21,6 +21,8 @@
defaults:
configuration:
oneprovision_hypervisor: 'kvm'
opennebula_node_kvm_use_ev: true
# required for copying recovery VM snaphosts to the replica host