--- /dev/null
+
+heat_template_version: 2017-09-01
+
+parameters:
+ key_name:
+ type: string
+ description: Name of keypair to assign to servers
+ default: maintenance-ci-public-key
+ image:
+ type: string
+ description: Name of image to use for servers
+ default: maintenance-ci-mos-image
+ flavor:
+ type: string
+ description: Flavor to use for servers
+ private_net:
+ type: string
+ description: >
+ ID or name of public network for which floating IP addresses will be allocated
+ default: maintenance-ci-network
+ private_subnet:
+ type: string
+ default: maintenance-ci-subnet
+ description: Id of the private sub network for the compute server
+ public_net:
+ type: string
+ default: public
+ description: Id of the public network for the compute server
+ jenkins_labels:
+ type: string
+ default: ''
+ description: List of labels for jenkins swarm agent separated by whitespace
+
+resources:
+
+ wait_condition:
+ type: OS::Heat::WaitCondition
+ properties:
+ handle: {get_resource: wait_handle}
+ count: 1
+ timeout: 300
+
+ wait_handle:
+ type: OS::Heat::WaitConditionHandle
+
+ public_port:
+ type: OS::Neutron::Port
+ properties:
+ network_id: { get_param: private_net }
+ fixed_ips:
+ - subnet_id: { get_param: private_subnet }
+ security_groups:
+ - dc56d304-e75e-437a-8ef5-656f9bfcd2a0
+
+ floating_ip:
+ type: OS::Neutron::FloatingIP
+ properties:
+ floating_network_id: { get_param: public_net }
+ port_id: { get_resource: public_port }
+
+ node:
+ type: OS::Nova::Server
+ properties:
+ image: { get_param: image }
+ availability_zone: nova
+ flavor: { get_param: flavor }
+ key_name: { get_param: key_name }
+ networks:
+ - port: { get_resource: public_port }
+ user_data:
+ str_replace:
+ template: |
+ #!/bin/bash
+ mkdir -p /etc/jenkins-agent/
+ echo "LABELS" > /etc/jenkins-agent/labels
+ echo "127.0.0.1 $(hostname)" >> /etc/hosts
+ echo "FLOATING" > /etc/jenkins-agent/description
+ service jenkins-swarm-agent restart
+ wc_notify --data-binary '{"status": "SUCCESS"}'
+ params:
+ LABELS: {get_param: jenkins_labels}
+ wc_notify: { get_attr: [wait_handle, curl_cli] }
+ FLOATING: { get_attr: [ floating_ip, floating_ip_address ] }
+
+
+outputs:
+ floating_ip:
+ description: Floating IP
+ value: { get_attr: [ floating_ip, floating_ip_address ] }