Skip to content

Instantly share code, notes, and snippets.

View allthingsclowd's full-sized avatar
🎲
42

Graham Land allthingsclowd

🎲
42
View GitHub Profile
# Create a security group
server_security_group1:
type: OS::Neutron::SecurityGroup
properties:
description: Add security group rules for server
name: Apache
rules:
- remote_ip_prefix: 0.0.0.0/0
protocol: tcp
port_range_min: 1
# AZ 1 Load Balancer
LAMP_Demo_AZ1_LBaaS:
type: FCX::ExpandableLoadBalancer::LoadBalancer
depends_on: [ server1,server2 ]
properties:
Subnets: [{get_resource: private_subnet_az1}]
Instances: [{get_resource: server1},{get_resource: server2}]
Listeners:
- {LoadBalancerPort: '80',
InstancePort: '80',
################### JumpBox - AZ 1 ##############################################################################
# Create a new port for the server interface, assign an ip address and security group
jump-server-port:
type: OS::Neutron::Port
depends_on: [ server_security_group5 ]
properties:
availability_zone: { get_param: az1 }
network_id: { get_resource: private_net_az1 }
security_groups: [{ get_resource: server_security_group5 }]
############################### AZ Interconnect ###########################################################
az1_nc_port:
type: OS::Neutron::Port
depends_on: [ server_security_group2 ]
properties:
availability_zone: { get_param: az1 }
network_id: { get_resource: private_net_az1 }
security_groups: [{ get_resource: server_security_group2 }]
fixed_ips:
heat_template_version: 2013-05-23
# Author: Graham Land
# Date: 21/10/2016
# Purpose: Multi-Availability-Zone template to demonstrate the basic format/usage of HOT stacks on our Fujitsu K5 platform
# It builds a webserver and database server in AZ1 and then the same infrastructure again in AZ2.
# These two environmnets are then joined using a network connector to facilitate data replication between the applications.
# Two public facing load balancers are also deployed - one in each AZ - and the webservers are added to each of these.
#
# The webservers have apache, php, mysql-client and lsyncd installed but NOT configured - didn't have time for this script sorry - loads of examples available online
# The database servers have mysql installed but not configured - again lots of examples available online - can be easily setup in Master/Master mode
@allthingsclowd
allthingsclowd / K5LinuxStackwithFiP.yml
Last active November 10, 2016 23:25
Fujitsu K5 IaaS HOT - Linux server with global ip on existing network
heat_template_version: 2013-05-23
# Author: Graham Land
# Date: 10/11/2016
# Purpose: Demonstrate deployment of a Linux box with Global IP to an existing Network on K5
description: >
HOT template to deploy a server into an existing neutron tenant network and
assign a floating IP addresses to the server so it is routable from the
public network. Fujitsu K5 OpenStack IaaS Public Cloud
@allthingsclowd
allthingsclowd / K5UserOnboarding.MD
Created December 12, 2016 22:55
Fujitsu K5 IaaS Onboarding

Fujitsu K5 Example User OnBoarding APIs

Platform: Fujitsu K5 IaaS Project to hold my OpenStack K5 Python 2.7 API Scripts integrated with Flask

This is an example python flask application used to illustrate how to automate the onboarding of new users to Fujitsu's K5 platform via its APIs.

It has the following functionality :

(i) Add new user to existing group and project

@allthingsclowd
allthingsclowd / K5_Add_Interface_To_Existing_Server.py
Last active December 20, 2016 20:11
Fujitsu K5 Python 2.7X Example API Call to Add a New Interface to an Existing Server
#!/usr/bin/python
"""Summary: Python 2.7X API example calls to do the following
1. Get a project scoped K5 token
2. Attach a new interface to an existing server
Prerequisites: k5contractsettingsV7.py file in the same directory with K5 contract login details
adminUser = 'username'
adminPassword = 'password'
contract = 'contract_name'
@allthingsclowd
allthingsclowd / K5_Example_Route_Maintenance_API.py
Created December 21, 2016 22:34
Fujitsu K5 Routing API Call for Subnets and Routers
#!/usr/bin/python
"""Summary: Python 2.7X API example calls to add routes to subnets and routers
This is a very rough and ready example script ensure to tidy!!
Prerequisites: k5contractsettingsV7.py file in the same directory with K5 contract login details
adminUser = 'username'
adminPassword = 'password'
contract = 'contract_name'
contractid = 'contract_id'
@allthingsclowd
allthingsclowd / CreatePortonK5Subnet.py
Last active January 18, 2017 17:37
K5 Port creation API call
def create_port(k5token, name, netid, sg_id, az, region):
portURL = 'https://networking.' + region + \
'.cloud.global.fujitsu.com/v2.0/ports'
try:
response = requests.post(portURL,
headers={
'X-Auth-Token': k5token, 'Content-Type': 'application/json', 'Accept': 'application/json'},
json={"port":
{"network_id": netid,