Skip to content

Instantly share code, notes, and snippets.

View tamirko's full-sized avatar

Tamir Korem tamirko

  • www.whitesourcesoftware.com
View GitHub Profile
@tamirko
tamirko / install_open_vpn.sh
Last active June 20, 2016 06:38
Install Open_VPN
#!/bin/bash
which openvpn
if [ $? -ne 0 ]; then
# Install openvpn
which yum
if [ $? -ne 0 ]; then
# Install on Ubuntu
sudo apt-get install -y openvpn
else
# Install on CentOs
@tamirko
tamirko / installub1404.sh
Created June 15, 2016 07:51
Prepare Ubuntu 14.04
#!/bin/bash
sudo apt-get update
sudo apt-get install -y gcc
sudo apt-get install -y python-pip
sudo apt-get install -y python-virtualenv
sudo apt-get install -y python-dev
sudo pip install --upgrade pip
sudo pip install --upgrade virtualenv
@tamirko
tamirko / influx_cli.py
Last active June 7, 2016 06:49
Access InfluxDB from Cloudify Rest Client
#!/usr/bin/env python
import sys
import time
from cloudify_rest_client.executions import Execution
from cloudify_cli.utils import get_rest_client
from influxdb.influxdb08 import InfluxDBClient
from influxdb.influxdb08.client import InfluxDBClientError
client = get_rest_client()
@tamirko
tamirko / restart_a_VM_by_using_Cfy_Wf.py
Last active May 23, 2016 12:18
Restart a VM by using Cfy Workflow
# The following should be defined in your blueprint :
node_templates: # or node_types if you specify this on a type
my_vm:
type: ...
...
interfaces:
...
my_custom_interface:
restart_linux_vm: scripts/restart_my_vm.sh
restart_windows_vm: scripts/restart_my_vm.ps1
@tamirko
tamirko / getManagerIPAddress.sh
Last active May 18, 2016 17:00
How can I retrieve the Cloudify's manager IP address from a shell script - Cloudify version 3.3.1 ?
#!/bin/bash
# Use The next three lines - Do NOT remove them !!!
# - It seems that one of these three lines, somehow sets the value of instance _node_instance host_id
# - which is used later on.
host_id2=$(ctx instance host_id)
host_id3=$(ctx instance runtime_properties host_id)
host_id4=$(ctx _node_instance host_id)
host_id=$(ctx instance _node_instance host_id)
@tamirko
tamirko / install_xap_deployment_tool.sh
Last active May 29, 2016 12:54
install_xap_deployment_tool.sh
#!/bin/bash
sudo apt-get install -y npm
sudo apt-get install -y git
sudo apt-get install -y unzip
sudo apt-get install -y gcc
sudo apt-get install -y python-pip
sudo apt-get install -y python-virtualenv
sudo apt-get install -y python-dev
sudo pip install --upgrade pip
@tamirko
tamirko / patch_cfy_manager_331.sh
Last active May 15, 2016 13:14
Patch Cloudify Manager 3.3.1
#!/bin/bash
# Memory Leak patch
sudo sed -i 's/--autoscale=5,2 \\/--maxtasksperchild=1 \\\n --autoscale=5,2 \\/g' /usr/lib/systemd/system/cloudify-mgmtworker.service
sudo systemctl daemon-reload
sudo systemctl restart cloudify-mgmtworker.service
# Enable auto complete for metrics in the UI (per deployment)
sudo sed -i 's/ like / /g' /opt/cloudify-ui/backend/services/MonitoringService.js
sudo systemctl restart cloudify-webui.service
@tamirko
tamirko / delete_deployment_fail.sh
Created May 6, 2016 13:28
delete_deployment_fail.sh
# cfy deployments delete -d nc-cfy-newVM
Deleting deployment nc-cfy-newVM from management server MNGR_Ip_ADDRESS
An error occurred on the server: 502: 502: <html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.8.0</center>
</body>
</html>
[http://MNGR_Ip_ADDRESS:80/api/v2/deployments/nc-cfy-newVM]
@tamirko
tamirko / install_cfy331_centos7.sh
Last active May 26, 2016 13:17
install_cfy331_centos7
#!/bin/bash
sudo rpm -iUvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
sudo yum -y update
sudo yum install -y -q git
sudo yum install -y python-pip
sudo yum install -y gcc
sudo yum install -y python-virtualenv
sudo yum install -y python-setuptools
sudo yum install -y python-devel
@tamirko
tamirko / delete_deployment.py
Created April 12, 2016 08:47
How to delete a Cloudify deployment
#!/usr/bin/env python
import sys
from cloudify_rest_client.executions import Execution
from cloudify_cli.utils import get_rest_client
client = get_rest_client()
deployment_id = sys.argv[1]