Last active
October 3, 2017 12:24
-
-
Save psachin/f0724c80c6f8aaf5fe507a485f0e8e29 to your computer and use it in GitHub Desktop.
Tripleo autoscale instance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
heat_template_version: 2016-10-14 | |
description: Common Template | |
resources: | |
flavor-cirros: | |
type: OS::Nova::Flavor | |
properties: | |
name: flavor-cirros | |
ram: 100 | |
vcpus: 1 | |
disk: 1 | |
mykey: | |
type: OS::Nova::KeyPair | |
properties: | |
name: psachin-key | |
save_private_key: true | |
ping-ssh: | |
type: OS::Neutron::SecurityGroup | |
properties: | |
name: ping-ssh-sec-group | |
rules: | |
- protocol: tcp | |
remote_ip_prefix: 0.0.0.0/0 | |
port_range_min: 22 | |
port_range_max: 22 | |
- protocol: icmp | |
remote_ip_prefix: 0.0.0.0/0 | |
public-net: | |
description: External network | |
type: OS::Neutron::ProviderNet | |
properties: | |
name: public-net | |
network_type: flat | |
physical_network: datacentre | |
router_external: true | |
public-net-subnet: | |
type: OS::Neutron::Subnet | |
properties: | |
name: public-subnet | |
network_id: { get_resource: public-net } | |
cidr: 192.168.24.0/24 | |
allocation_pools: [{"start": "192.168.24.100", "end": "192.168.24.120"}] | |
enable_dhcp: false | |
gateway_ip: "192.168.24.1" | |
int-green: | |
description: internal network | |
type: OS::Neutron::Net | |
properties: | |
name: int-green | |
int-green-subnet: | |
type: OS::Neutron::Subnet | |
properties: | |
name: int-green-subnet | |
network_id: { get_resource: int-green } | |
cidr: 30.0.0.0/24 | |
dns_nameservers: ["8.8.8.8"] | |
router-green: | |
type: OS::Neutron::Router | |
properties: | |
name: route-green | |
external_gateway_info: { network: { get_resource: public-net }} | |
router-green-interface: | |
type: OS::Neutron::RouterInterface | |
properties: | |
router: { get_resource: router-green } | |
subnet: { get_resource: int-green-subnet } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource_registry: | |
"OS::Nova::Server::Cirros": ./simple-stack.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
heat_template_version: 2016-10-14 | |
description: Simple template to deploy a single compute instance. Need to change image name | |
parameters: | |
metadata: | |
type: json | |
image: | |
type: string | |
description: Image name or id | |
default: cirros | |
key: | |
type: string | |
default: psachin-key | |
flavor-cirros: | |
type: string | |
default: flavor-cirros | |
sec-group: | |
type: string | |
default: ping-ssh-sec-group | |
internal-network: | |
type: string | |
default: int-green | |
external-network: | |
type: string | |
default: public-net | |
resources: | |
psachin_instance-1: | |
type: OS::Nova::Server | |
properties: | |
key_name: { get_param: key } | |
image: { get_param: image } | |
flavor: { get_param: flavor-cirros} | |
metadata: {get_param: metadata} | |
networks: | |
- port: { get_resource: instance_port } | |
instance_port: | |
type: OS::Neutron::Port | |
properties: | |
network: { get_param: internal-network } | |
security_groups: [ { get_param: sec-group } ] | |
floating_ip: | |
type: OS::Neutron::FloatingIP | |
properties: | |
floating_network: { get_param: external-network } | |
port_id: { get_resource: instance_port } | |
floating_ip_assoc: | |
type: OS::Neutron::FloatingIPAssociation | |
properties: | |
floatingip_id: { get_resource: floating_ip } | |
port_id: { get_resource: instance_port } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
heat_template_version: 2016-10-14 | |
description: Example auto scale group, policy and alarm | |
resources: | |
scaleup_group: | |
type: OS::Heat::AutoScalingGroup | |
properties: | |
cooldown: 60 | |
desired_capacity: 1 | |
max_size: 3 | |
min_size: 1 | |
resource: | |
type: OS::Nova::Server::Cirros | |
properties: | |
metadata: {"metering.server_group": {get_param: "OS::stack_id"}} | |
scaleup_policy: | |
type: OS::Heat::ScalingPolicy | |
properties: | |
adjustment_type: change_in_capacity | |
auto_scaling_group_id: { get_resource: scaleup_group } | |
cooldown: 60 | |
scaling_adjustment: 1 | |
scaledown_policy: | |
type: OS::Heat::ScalingPolicy | |
properties: | |
adjustment_type: change_in_capacity | |
auto_scaling_group_id: { get_resource: scaleup_group } | |
cooldown: 60 | |
scaling_adjustment: -1 | |
cpu_alarm_high: | |
type: OS::Aodh::GnocchiAggregationByResourcesAlarm | |
properties: | |
description: Scale up if CPU > 80% | |
metric: cpu_util | |
aggregation_method: mean | |
granularity: 300 | |
evaluation_periods: 1 | |
threshold: 50 | |
resource_type: instance | |
comparison_operator: gt | |
ok_actions: ['log://'] | |
insufficient_data_actions: ['log://'] | |
alarm_actions: | |
- str_replace: | |
template: trust+url | |
params: | |
url: {get_attr: [scaleup_policy, signal_url]} | |
query: | |
str_replace: | |
template: '{"=": {"server_group": "stack_id"}}' | |
params: | |
stack_id: {get_param: "OS::stack_id"} | |
cpu_alarm_low: | |
type: OS::Aodh::GnocchiAggregationByResourcesAlarm | |
properties: | |
metric: cpu_util | |
aggregation_method: mean | |
granularity: 300 | |
evaluation_periods: 1 | |
threshold: 5 | |
resource_type: instance | |
comparison_operator: le | |
ok_actions: ['log://'] | |
insufficient_data_actions: ['log://'] | |
alarm_actions: | |
- str_replace: | |
template: trust+url | |
params: | |
url: {get_attr: [scaledown_policy, signal_url]} | |
query: | |
str_replace: | |
template: '{"=": {"server_group": "stack_id"}}' | |
params: | |
stack_id: {get_param: "OS::stack_id"} | |
outputs: | |
scaleup_policy_signal_url: | |
value: {get_attr: [scaleup_policy, signal_url]} | |
scaledown_policy_signal_url: | |
value: {get_attr: [scaledown_policy, signal_url]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Stack events