shaker/shaker/resources/image_builder_templates/centos.yaml

125 lines
3.5 KiB
YAML

heat_template_version: 2013-05-23
description: >
HOT template to create a new neutron network plus a router to the public
network, and for deploying servers into the new network.
parameters:
external_net:
type: string
description: ID or name of public network for which floating IP addresses will be allocated
flavor:
type: string
description: Flavor to use for servers
dns_nameservers:
type: comma_delimited_list
description: DNS nameservers for the image builder subnet
resources:
private_net:
type: OS::Neutron::Net
properties:
name: shaker_image_builder_net
private_subnet:
type: OS::Neutron::Subnet
properties:
network_id: { get_resource: private_net }
cidr: 10.0.0.0/29
dns_nameservers: { get_param: dns_nameservers }
router:
type: OS::Neutron::Router
properties:
external_gateway_info:
network: { get_param: external_net }
router_interface:
type: OS::Neutron::RouterInterface
properties:
router_id: { get_resource: router }
subnet_id: { get_resource: private_subnet }
primary_image:
type: OS::Glance::Image
properties:
container_format: bare
disk_format: qcow2
location: http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud-1503.qcow2
min_disk: 10
min_ram: 512
name: shaker_image_build_template
primary_image_server_port:
type: OS::Neutron::Port
properties:
network_id: { get_resource: private_net }
fixed_ips:
- subnet_id: { get_resource: private_subnet }
primary_image_server:
type: OS::Nova::Server
properties:
name: shaker_image_builder_server
image: { get_resource: primary_image }
flavor: { get_param: flavor }
networks:
- port: { get_resource: primary_image_server_port }
user_data_format: RAW
user_data: |
#!/bin/bash
yum install -y wget
yum install -y epel-release
yum install -y iperf iperf3 gcc gcc-c++ python-devel screen
yum install -y zeromq zeromq-devel
wget https://github.com/HewlettPackard/netperf/archive/netperf-2.7.0.tar.gz
tar xvzf netperf-2.7.0.tar.gz
cd netperf-netperf-2.7.0
./configure --enable-demo=yes
make
make install
easy_install pip
pip install pbr flent pyshaker
service network restart
cat<<'EOF' >> /etc/systemd/system/iperf.service
[Unit]
Description=iperf Service
After=network.target
[Service]
Type=simple
ExecStart=/usr/bin/iperf -s
[Install]
WantedBy=multi-user.target
EOF
cat<<'EOF' >> /etc/systemd/system/iperf3.service
[Unit]
Description=iperf3 Service
After=network.target
[Service]
Type=simple
ExecStart=/usr/bin/iperf3 -s
[Install]
WantedBy=multi-user.target
EOF
cat<<'EOF' >> /etc/systemd/system/netperf.service
[Unit]
Description="Netperf netserver daemon"
After=network.target
[Service]
ExecStart=/usr/local/bin/netserver -D
[Install]
WantedBy=multi-user.target
EOF
systemctl start iperf
systemctl enable iperf
systemctl start iperf3
systemctl enable iperf3
systemctl start netperf
systemctl enable netperf
setenforce 0
shutdown -h now
outputs:
server_info:
value: { get_attr: [ primary_image_server, show ] }