heat_template_version: '2016-04-08'
resources: heatnetwork_100: type: OS::Neutron::Net properties: name: heatnetwork_100 tenant_id: da0df6b3ca594c748700a7f13fffe6de
heatnetwork_200: type: OS::Neutron::Net properties: name: heatnetwork_200 tenant_id: da0df6b3ca594c748700a7f13fffe6de
heatnet_100: type: OS::Neutron::Subnet depends_on: heatnetwork_100 properties: name: heatnet_100 network_id: { get_resource: heatnetwork_100 } cidr: 10.10.100.0/24 gateway_ip: enable_dhcp: true allocation_pools: [{"start": 10.10.100.100, "end": 10.10.100.250}]
heatnet_200: type: OS::Neutron::Subnet depends_on: heatnetwork_200 properties: name: heatnet_200 network_id: { get_resource: heatnetwork_200 } cidr: 10.10.200.0/24 gateway_ip: enable_dhcp: true allocation_pools: [{"start": 10.10.200.100, "end": 10.10.200.250}]
provider_port: type: OS::Neutron::Port properties: name: "provider_port" network: provider
heatnet_100_port: type: OS::Neutron::Port depends_on: heatnet_100 properties: name: "heatnet_100_port" network: { get_resource: heatnetwork_100 } fixed_ips: - subnet: { get_resource: heatnet_100 }
heatnet_200_port: depends_on: heatnet_200 type: OS::Neutron::Port properties: name: "heatnet_200_port" network: { get_resource: heatnetwork_200 } fixed_ips: - subnet: { get_resource: heatnet_200 }
lb1_port_vip: depends_on: provider_port type: OS::Neutron::Port properties: name: "lb1_port_vip" network: "provider" fixed_ips: [{"subnet": "provider", "ip_address": "172.17.17.11"}]
lb2_port_vip: depends_on: heatnet_100 type: OS::Neutron::Port properties: name: "lb2_port_vip" network: {get_resource: "heatnetwork_100"} fixed_ips: - ip_address: "10.10.100.11"
lb3_port_vip: depends_on: heatnet_200 type: OS::Neutron::Port properties: name: "lb3_port_vip" network: {get_resource: "heatnetwork_200"} fixed_ips: - ip_address: "10.10.200.11"
suricata_port_gw1: depends_on: heatnet_100 type: OS::Neutron::Port properties: name: "suricata_port_gw1" network: {get_resource: "heatnetwork_100"} fixed_ips: - ip_address: "10.10.100.21"
suricata_port_gw2: depends_on: heatnet_100 type: OS::Neutron::Port properties: name: "suricata_port_gw2" network: {get_resource: "heatnetwork_100"} fixed_ips: - ip_address: "10.10.100.22"
haproxy1: depends_on: [ suricata1, suricata2 ] properties: name: "haproxy1" flavor: m1.small image: heat-vlb_03 networks: - port: { get_resource: lb1_port_vip } user_data: str_replace: template: | #!/bin/bash echo "--- Sciprts_START ---" echo -e "\tserver server1 $suricata1:80 maxconn 2048" >> /etc/haproxy/haproxy.conf echo -e "\tserver server1 $suricata2:80 maxconn 2048" >> /etc/haproxy/haproxy.conf haproxy -f /etc/haproxy/haproxy.conf echo "--- Sciprts_END ---" params: $suricata1: get_attr: [suricata1, networks, provider, 0] $suricata2: get_attr: [suricata2, networks, provider, 0] user_data_format: RAW type: OS::Nova::Server
haproxy2: depends_on: [ webserver1, webserver2 ] properties: name: "haproxy2" flavor: m1.small image: heat-vlb_03 networks: - port: { get_resource: lb2_port_vip } - subnet: { get_resource: heatnet_200} user_data: str_replace: template: | #!/bin/bash echo "--- Sciprts_START ---" echo -e "\tserver server1 $svr1:80 maxconn 2048" >> /etc/haproxy/haproxy.conf echo -e "\tserver server2 $svr2:80 maxconn 2048" >> /etc/haproxy/haproxy.conf haproxy -f /etc/haproxy/haproxy.conf echo "--- Sciprts_END ---" params: $svr1: get_attr: [webserver1, networks, {get_resource: heatnetwork_200}, 0] $svr2: get_attr: [webserver2, networks, {get_resource: heatnetwork_200}, 0] user_data_format: RAW type: OS::Nova::Server
suricata1: depends_on: haproxy2 properties: name: "suricata1" flavor: m1.small image: heat-vfw_03 networks: - network: provider - port: { get_resource: suricata_port_gw1 } user_data: str_replace: template: | #!/bin/bash echo "--- Sciprts_START ---" iptables -t nat -A PREROUTING -p tcp --dport 80 -i eth0 -j DNAT --to 10.10.100.11:80 iptables -t nat -A POSTROUTING -o eth1 -j SNAT --to $(ip addr show eth1 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1) iptables -I FORWARD -i eth0 -o eth1 -j NFQUEUE iptables -I FORWARD -i eth1 -o eth0 -j NFQUEUE suricata -c /etc/suricata/suricata.yaml -q 0 -D echo "--- Sciprts_END ---" params: $lb2: get_attr: [haproxy2, networks, {get_resource: heatnetwork_100}, 0] user_data_format: RAW type: OS::Nova::Server
suricata2: depends_on: haproxy2 properties: name: "suricata2" flavor: m1.small image: heat-vfw_03 networks: - network: provider - port: { get_resource: suricata_port_gw2 } user_data: str_replace: template: | #!/bin/bash echo "--- Sciprts_START ---" iptables -t nat -A PREROUTING -p tcp --dport 80 -i eth0 -j DNAT --to 10.10.100.11:80 iptables -t nat -A POSTROUTING -o eth1 -j SNAT --to $(ip addr show eth1 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1) iptables -I FORWARD -i eth0 -o eth1 -j NFQUEUE iptables -I FORWARD -i eth1 -o eth0 -j NFQUEUE suricata -c /etc/suricata/suricata.yaml -q 0 -D echo "--- Sciprts_END ---" params: $lb2: get_attr: [haproxy2, networks, {get_resource: heatnetwork_100}, 0] user_data_format: RAW type: OS::Nova::Server
webserver1: depends_on: heatnet_200 properties: name: "webserver1" flavor: m1.small image: heat-vweb_03 key_name: spark networks: - subnet: { get_resource: heatnet_200} user_data: | #!/bin/bash echo "--- Sciprts_START ---" echo "SVR1" > /var/www/html/index.html systemctl restart httpd echo "--- Sciprts_END ---" user_data_format: RAW type: OS::Nova::Server
webserver2: depends_on: heatnet_200 properties: name: "webserver2" flavor: m1.small image: heat-vweb_03 key_name: spark networks: - subnet: { get_resource: heatnet_200} user_data: | #!/bin/bash echo "--- Sciprts_START ---" echo "SVR2" > /var/www/html/index.html systemctl restart httpd echo "--- Sciprts_END ---" user_data_format: RAW type: OS::Nova::Server |