From 66e9c7216387db234f695a5a378f64370b23203b Mon Sep 17 00:00:00 2001 From: Vu Tran Date: Wed, 14 May 2014 16:11:41 -0400 Subject: heat: add example hot templates Add 2 hot templates which can be used to create heat stack for demonstrating heat stack lifecycle management and autoscaling Signed-off-by: Vu Tran --- .../python-heat/autoscaling_example.template | 66 +++++++++++++++++++ .../python/python-heat/one_vm_example.template | 63 ++++++++++++++++++ .../python/python-heat/two_vms_example.template | 74 ++++++++++++++++++++++ 3 files changed, 203 insertions(+) create mode 100644 meta-openstack/recipes-devtools/python/python-heat/autoscaling_example.template create mode 100644 meta-openstack/recipes-devtools/python/python-heat/one_vm_example.template create mode 100644 meta-openstack/recipes-devtools/python/python-heat/two_vms_example.template (limited to 'meta-openstack/recipes-devtools/python/python-heat') diff --git a/meta-openstack/recipes-devtools/python/python-heat/autoscaling_example.template b/meta-openstack/recipes-devtools/python/python-heat/autoscaling_example.template new file mode 100644 index 0000000..6391187 --- /dev/null +++ b/meta-openstack/recipes-devtools/python/python-heat/autoscaling_example.template @@ -0,0 +1,66 @@ +heat_template_version: 2014-05-06 +description: AutoScaling +parameters: + instance_type: + type: string + description: Type of the instance to be created. + default: m1.tiny + constraints: + - allowed_values: [m1.tiny, m1.small, m1.medium, m1.large] + description: + Value must be one of 'm1.tiny', 'm1.small', 'm1.medium' or 'm1.large'. + image_id: + type: string + description: ID of the image to use for the instance to be created. + default: myfirstimage +resources: + web_server_group_launch_conf: + type: AWS::AutoScaling::LaunchConfiguration + properties: + ImageId: { get_param: image_id } + InstanceType: { get_param: instance_type } + server_group: + type: AWS::AutoScaling::AutoScalingGroup + properties: + AvailabilityZones: ["RegionOne"] + MinSize: '1' + MaxSize: '3' + LaunchConfigurationName: {get_resource: web_server_group_launch_conf} + web_server_scaleup_policy: + type: AWS::AutoScaling::ScalingPolicy + properties: + AdjustmentType: ChangeInCapacity + AutoScalingGroupName: {get_resource: server_group} + Cooldown: 60 + ScalingAdjustment: 1 + web_server_scaledown_policy: + type: AWS::AutoScaling::ScalingPolicy + properties: + AdjustmentType: ChangeInCapacity + AutoScalingGroupName: {get_resource: server_group} + Cooldown: 60 + ScalingAdjustment: -1 + cpu_alarm_high: + type: OS::Ceilometer::Alarm + properties: + description: Scale-up if the average CPU > 80% for 5 minute + meter_name: cpu_util + statistic: avg + period: '300' + evaluation_periods: '1' + threshold: '80' + alarm_actions: + - {get_attr: [web_server_scaleup_policy, AlarmUrl]} + comparison_operator: gt + cpu_alarm_low: + type: OS::Ceilometer::Alarm + properties: + description: Scale-down if the average CPU < 45% for 2 minutes + meter_name: cpu_util + statistic: avg + period: '120' + evaluation_periods: '1' + threshold: '45' + alarm_actions: + - {get_attr: [web_server_scaledown_policy, AlarmUrl]} + comparison_operator: lt diff --git a/meta-openstack/recipes-devtools/python/python-heat/one_vm_example.template b/meta-openstack/recipes-devtools/python/python-heat/one_vm_example.template new file mode 100644 index 0000000..07d6e6d --- /dev/null +++ b/meta-openstack/recipes-devtools/python/python-heat/one_vm_example.template @@ -0,0 +1,63 @@ +heat_template_version: 2014-05-06 +description: Template to deploy one VM +parameters: + vm_type: + type: string + description: Type of the instance to be created. + default: m1.tiny + constraints: + - allowed_values: [m1.tiny, m1.small, m1.medium, m1.large] + description: + Value must be one of 'm1.tiny', 'm1.small', 'm1.medium' or 'm1.large'. + image_id: + type: string + description: ID of the image to use for VM to be created. + default: myfirstimage + vol_1_size: + type: number + description: Size of the volume to be created. + default: 1 + constraints: + - range: { min: 1, max: 1024 } + description: must be between 1 and 1024 Gb. + vol_1_type: + type: string + description: Cinder backend type + default: lvm_iscsi + constraints: + - allowed_values: [lvm_iscsi, nfs, glusterfs, cephrbd] + description: + Value must be one of 'lvm_iscsi', 'nfs', 'glusterfs' or 'cephrbd'. + vol_2_id: + type: string + description: Cinder existing volume id +resources: + vm_1: + type: OS::Nova::Server + properties: + image: { get_param: image_id } + flavor: { get_param: vm_type } + vol_1: + type: OS::Cinder::Volume + properties: + size: { get_param: vol_1_size } + volume_type: { get_param: vol_1_type } + vol_1_attachment: + type: OS::Cinder::VolumeAttachment + properties: + volume_id: { get_resource: vol_1 } + instance_uuid: { get_resource: vm_1 } + mountpoint: /dev/vdb + vol_2_attachment: + type: OS::Cinder::VolumeAttachment + properties: + volume_id: { get_param: vol_2_id } + instance_uuid: { get_resource: vm_1 } + mountpoint: /dev/vdc +outputs: + vm_1_instance_ip: + description: Public IP address of VM 1. + value: { get_attr: [vm_1, first_address] } + vm_1_show: + description: Show details of VM 1. + value: { get_attr: [vm_1, show] } diff --git a/meta-openstack/recipes-devtools/python/python-heat/two_vms_example.template b/meta-openstack/recipes-devtools/python/python-heat/two_vms_example.template new file mode 100644 index 0000000..9690e5a --- /dev/null +++ b/meta-openstack/recipes-devtools/python/python-heat/two_vms_example.template @@ -0,0 +1,74 @@ +heat_template_version: 2014-05-06 +description: Template to deploy two VMs +parameters: + vm_type: + type: string + description: Type of the instance to be created. + default: m1.tiny + constraints: + - allowed_values: [m1.tiny, m1.small, m1.medium, m1.large] + description: + Value must be one of 'm1.tiny', 'm1.small', 'm1.medium' or 'm1.large'. + image_id: + type: string + description: ID of the image to use for 2 VMs to be created. + default: myfirstimage + vol_1_size: + type: number + description: Size of the volume to be created. + default: 1 + constraints: + - range: { min: 1, max: 1024 } + description: must be between 1 and 1024 Gb. + vol_1_type: + type: string + description: Cinder backend type + default: lvm_iscsi + constraints: + - allowed_values: [lvm_iscsi, nfs, glusterfs, cephrbd] + description: + Value must be one of 'lvm_iscsi', 'nfs', 'glusterfs' or 'cephrbd'. + vol_2_id: + type: string + description: Cinder existing volume id +resources: + vm_1: + type: OS::Nova::Server + properties: + image: { get_param: image_id } + flavor: { get_param: vm_type } + vm_2: + type: OS::Nova::Server + properties: + image: { get_param: image_id } + flavor: { get_param: vm_type } + vol_1: + type: OS::Cinder::Volume + properties: + size: { get_param: vol_1_size } + volume_type: { get_param: vol_1_type } + vol_1_attachment: + type: OS::Cinder::VolumeAttachment + properties: + volume_id: { get_resource: vol_1 } + instance_uuid: { get_resource: vm_1 } + mountpoint: /dev/vdb + vol_2_attachment: + type: OS::Cinder::VolumeAttachment + properties: + volume_id: { get_param: vol_2_id } + instance_uuid: { get_resource: vm_1 } + mountpoint: /dev/vdc +outputs: + vm_1_instance_ip: + description: Public IP address of VM 1. + value: { get_attr: [vm_1, first_address] } + vm_1_show: + description: Show details of VM 1. + value: { get_attr: [vm_1, show] } + vm_2_instance_ip: + description: Public IP address of VM 2. + value: { get_attr: [vm_2, first_address] } + vm_2_show: + description: Show details of VM 2. + value: { get_attr: [vm_2, show] } -- cgit v1.2.3-54-g00ecf