diff options
| author | Vu Tran <vu.tran@windriver.com> | 2014-05-14 16:11:41 -0400 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@windriver.com> | 2014-05-23 14:42:23 -0400 |
| commit | 66e9c7216387db234f695a5a378f64370b23203b (patch) | |
| tree | 9e0b1f92f796054fc06528b3114d278940c4ad21 /meta-openstack/recipes-devtools/python/python-heat | |
| parent | 122172307ade3be32aa9962e043495282ad2e794 (diff) | |
| download | meta-cloud-services-66e9c7216387db234f695a5a378f64370b23203b.tar.gz | |
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 <vu.tran@windriver.com>
Diffstat (limited to 'meta-openstack/recipes-devtools/python/python-heat')
3 files changed, 203 insertions, 0 deletions
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 @@ | |||
| 1 | heat_template_version: 2014-05-06 | ||
| 2 | description: AutoScaling | ||
| 3 | parameters: | ||
| 4 | instance_type: | ||
| 5 | type: string | ||
| 6 | description: Type of the instance to be created. | ||
| 7 | default: m1.tiny | ||
| 8 | constraints: | ||
| 9 | - allowed_values: [m1.tiny, m1.small, m1.medium, m1.large] | ||
| 10 | description: | ||
| 11 | Value must be one of 'm1.tiny', 'm1.small', 'm1.medium' or 'm1.large'. | ||
| 12 | image_id: | ||
| 13 | type: string | ||
| 14 | description: ID of the image to use for the instance to be created. | ||
| 15 | default: myfirstimage | ||
| 16 | resources: | ||
| 17 | web_server_group_launch_conf: | ||
| 18 | type: AWS::AutoScaling::LaunchConfiguration | ||
| 19 | properties: | ||
| 20 | ImageId: { get_param: image_id } | ||
| 21 | InstanceType: { get_param: instance_type } | ||
| 22 | server_group: | ||
| 23 | type: AWS::AutoScaling::AutoScalingGroup | ||
| 24 | properties: | ||
| 25 | AvailabilityZones: ["RegionOne"] | ||
| 26 | MinSize: '1' | ||
| 27 | MaxSize: '3' | ||
| 28 | LaunchConfigurationName: {get_resource: web_server_group_launch_conf} | ||
| 29 | web_server_scaleup_policy: | ||
| 30 | type: AWS::AutoScaling::ScalingPolicy | ||
| 31 | properties: | ||
| 32 | AdjustmentType: ChangeInCapacity | ||
| 33 | AutoScalingGroupName: {get_resource: server_group} | ||
| 34 | Cooldown: 60 | ||
| 35 | ScalingAdjustment: 1 | ||
| 36 | web_server_scaledown_policy: | ||
| 37 | type: AWS::AutoScaling::ScalingPolicy | ||
| 38 | properties: | ||
| 39 | AdjustmentType: ChangeInCapacity | ||
| 40 | AutoScalingGroupName: {get_resource: server_group} | ||
| 41 | Cooldown: 60 | ||
| 42 | ScalingAdjustment: -1 | ||
| 43 | cpu_alarm_high: | ||
| 44 | type: OS::Ceilometer::Alarm | ||
| 45 | properties: | ||
| 46 | description: Scale-up if the average CPU > 80% for 5 minute | ||
| 47 | meter_name: cpu_util | ||
| 48 | statistic: avg | ||
| 49 | period: '300' | ||
| 50 | evaluation_periods: '1' | ||
| 51 | threshold: '80' | ||
| 52 | alarm_actions: | ||
| 53 | - {get_attr: [web_server_scaleup_policy, AlarmUrl]} | ||
| 54 | comparison_operator: gt | ||
| 55 | cpu_alarm_low: | ||
| 56 | type: OS::Ceilometer::Alarm | ||
| 57 | properties: | ||
| 58 | description: Scale-down if the average CPU < 45% for 2 minutes | ||
| 59 | meter_name: cpu_util | ||
| 60 | statistic: avg | ||
| 61 | period: '120' | ||
| 62 | evaluation_periods: '1' | ||
| 63 | threshold: '45' | ||
| 64 | alarm_actions: | ||
| 65 | - {get_attr: [web_server_scaledown_policy, AlarmUrl]} | ||
| 66 | 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 @@ | |||
| 1 | heat_template_version: 2014-05-06 | ||
| 2 | description: Template to deploy one VM | ||
| 3 | parameters: | ||
| 4 | vm_type: | ||
| 5 | type: string | ||
| 6 | description: Type of the instance to be created. | ||
| 7 | default: m1.tiny | ||
| 8 | constraints: | ||
| 9 | - allowed_values: [m1.tiny, m1.small, m1.medium, m1.large] | ||
| 10 | description: | ||
| 11 | Value must be one of 'm1.tiny', 'm1.small', 'm1.medium' or 'm1.large'. | ||
| 12 | image_id: | ||
| 13 | type: string | ||
| 14 | description: ID of the image to use for VM to be created. | ||
| 15 | default: myfirstimage | ||
| 16 | vol_1_size: | ||
| 17 | type: number | ||
| 18 | description: Size of the volume to be created. | ||
| 19 | default: 1 | ||
| 20 | constraints: | ||
| 21 | - range: { min: 1, max: 1024 } | ||
| 22 | description: must be between 1 and 1024 Gb. | ||
| 23 | vol_1_type: | ||
| 24 | type: string | ||
| 25 | description: Cinder backend type | ||
| 26 | default: lvm_iscsi | ||
| 27 | constraints: | ||
| 28 | - allowed_values: [lvm_iscsi, nfs, glusterfs, cephrbd] | ||
| 29 | description: | ||
| 30 | Value must be one of 'lvm_iscsi', 'nfs', 'glusterfs' or 'cephrbd'. | ||
| 31 | vol_2_id: | ||
| 32 | type: string | ||
| 33 | description: Cinder existing volume id | ||
| 34 | resources: | ||
| 35 | vm_1: | ||
| 36 | type: OS::Nova::Server | ||
| 37 | properties: | ||
| 38 | image: { get_param: image_id } | ||
| 39 | flavor: { get_param: vm_type } | ||
| 40 | vol_1: | ||
| 41 | type: OS::Cinder::Volume | ||
| 42 | properties: | ||
| 43 | size: { get_param: vol_1_size } | ||
| 44 | volume_type: { get_param: vol_1_type } | ||
| 45 | vol_1_attachment: | ||
| 46 | type: OS::Cinder::VolumeAttachment | ||
| 47 | properties: | ||
| 48 | volume_id: { get_resource: vol_1 } | ||
| 49 | instance_uuid: { get_resource: vm_1 } | ||
| 50 | mountpoint: /dev/vdb | ||
| 51 | vol_2_attachment: | ||
| 52 | type: OS::Cinder::VolumeAttachment | ||
| 53 | properties: | ||
| 54 | volume_id: { get_param: vol_2_id } | ||
| 55 | instance_uuid: { get_resource: vm_1 } | ||
| 56 | mountpoint: /dev/vdc | ||
| 57 | outputs: | ||
| 58 | vm_1_instance_ip: | ||
| 59 | description: Public IP address of VM 1. | ||
| 60 | value: { get_attr: [vm_1, first_address] } | ||
| 61 | vm_1_show: | ||
| 62 | description: Show details of VM 1. | ||
| 63 | 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 @@ | |||
| 1 | heat_template_version: 2014-05-06 | ||
| 2 | description: Template to deploy two VMs | ||
| 3 | parameters: | ||
| 4 | vm_type: | ||
| 5 | type: string | ||
| 6 | description: Type of the instance to be created. | ||
| 7 | default: m1.tiny | ||
| 8 | constraints: | ||
| 9 | - allowed_values: [m1.tiny, m1.small, m1.medium, m1.large] | ||
| 10 | description: | ||
| 11 | Value must be one of 'm1.tiny', 'm1.small', 'm1.medium' or 'm1.large'. | ||
| 12 | image_id: | ||
| 13 | type: string | ||
| 14 | description: ID of the image to use for 2 VMs to be created. | ||
| 15 | default: myfirstimage | ||
| 16 | vol_1_size: | ||
| 17 | type: number | ||
| 18 | description: Size of the volume to be created. | ||
| 19 | default: 1 | ||
| 20 | constraints: | ||
| 21 | - range: { min: 1, max: 1024 } | ||
| 22 | description: must be between 1 and 1024 Gb. | ||
| 23 | vol_1_type: | ||
| 24 | type: string | ||
| 25 | description: Cinder backend type | ||
| 26 | default: lvm_iscsi | ||
| 27 | constraints: | ||
| 28 | - allowed_values: [lvm_iscsi, nfs, glusterfs, cephrbd] | ||
| 29 | description: | ||
| 30 | Value must be one of 'lvm_iscsi', 'nfs', 'glusterfs' or 'cephrbd'. | ||
| 31 | vol_2_id: | ||
| 32 | type: string | ||
| 33 | description: Cinder existing volume id | ||
| 34 | resources: | ||
| 35 | vm_1: | ||
| 36 | type: OS::Nova::Server | ||
| 37 | properties: | ||
| 38 | image: { get_param: image_id } | ||
| 39 | flavor: { get_param: vm_type } | ||
| 40 | vm_2: | ||
| 41 | type: OS::Nova::Server | ||
| 42 | properties: | ||
| 43 | image: { get_param: image_id } | ||
| 44 | flavor: { get_param: vm_type } | ||
| 45 | vol_1: | ||
| 46 | type: OS::Cinder::Volume | ||
| 47 | properties: | ||
| 48 | size: { get_param: vol_1_size } | ||
| 49 | volume_type: { get_param: vol_1_type } | ||
| 50 | vol_1_attachment: | ||
| 51 | type: OS::Cinder::VolumeAttachment | ||
| 52 | properties: | ||
| 53 | volume_id: { get_resource: vol_1 } | ||
| 54 | instance_uuid: { get_resource: vm_1 } | ||
| 55 | mountpoint: /dev/vdb | ||
| 56 | vol_2_attachment: | ||
| 57 | type: OS::Cinder::VolumeAttachment | ||
| 58 | properties: | ||
| 59 | volume_id: { get_param: vol_2_id } | ||
| 60 | instance_uuid: { get_resource: vm_1 } | ||
| 61 | mountpoint: /dev/vdc | ||
| 62 | outputs: | ||
| 63 | vm_1_instance_ip: | ||
| 64 | description: Public IP address of VM 1. | ||
| 65 | value: { get_attr: [vm_1, first_address] } | ||
| 66 | vm_1_show: | ||
| 67 | description: Show details of VM 1. | ||
| 68 | value: { get_attr: [vm_1, show] } | ||
| 69 | vm_2_instance_ip: | ||
| 70 | description: Public IP address of VM 2. | ||
| 71 | value: { get_attr: [vm_2, first_address] } | ||
| 72 | vm_2_show: | ||
| 73 | description: Show details of VM 2. | ||
| 74 | value: { get_attr: [vm_2, show] } | ||
