Various fixes to the cluster script.
This commit is contained in:
parent
857fc969a6
commit
b536e89bf5
@ -51,7 +51,7 @@ data_bag_path "{dir}/data_bags"'''.format(dir=chef_dir)
|
|||||||
|
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def git_mini_mon(install_dir, proxy=None):
|
def git_mini_mon(install_dir, branch=None, proxy=None):
|
||||||
"""Download mini-mon from git
|
"""Download mini-mon from git
|
||||||
"""
|
"""
|
||||||
with prefix(proxy_string(proxy)):
|
with prefix(proxy_string(proxy)):
|
||||||
@ -61,10 +61,14 @@ def git_mini_mon(install_dir, proxy=None):
|
|||||||
|
|
||||||
if install_dir_check.succeeded:
|
if install_dir_check.succeeded:
|
||||||
with cd(install_dir):
|
with cd(install_dir):
|
||||||
sudo('git pull -f origin master')
|
sudo('git checkout master; git pull -f origin master')
|
||||||
else:
|
else:
|
||||||
sudo('git clone https://github.com/hpcloud-mon/mon-vagrant.git %s' % install_dir)
|
sudo('git clone https://github.com/hpcloud-mon/mon-vagrant.git %s' % install_dir)
|
||||||
|
|
||||||
|
if branch is not None:
|
||||||
|
with cd(install_dir):
|
||||||
|
sudo('git checkout %s' % branch)
|
||||||
|
|
||||||
@task(default=True)
|
@task(default=True)
|
||||||
def install(install_dir='/vagrant', proxy=None):
|
def install(install_dir='/vagrant', proxy=None):
|
||||||
"""Installs the latest mini-mon and bits necessary to run chef-solo and runs chef-solo on the box.
|
"""Installs the latest mini-mon and bits necessary to run chef-solo and runs chef-solo on the box.
|
||||||
|
@ -17,4 +17,3 @@ The goal of this fabric script is to setup a test cluster on baremetal leveragin
|
|||||||
- Setup the Vertica database schema
|
- Setup the Vertica database schema
|
||||||
- Setup the mysql database schema
|
- Setup the mysql database schema
|
||||||
- Restart any services which require vertica or mysql
|
- Restart any services which require vertica or mysql
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ These tasks were developed for hLinux but will likely work on any decently up to
|
|||||||
"""
|
"""
|
||||||
from fabric.api import *
|
from fabric.api import *
|
||||||
from fabric.tasks import Task
|
from fabric.tasks import Task
|
||||||
|
import os
|
||||||
|
|
||||||
from baremetal import chef_solo, git_mini_mon, install_deps
|
from baremetal import chef_solo, git_mini_mon, install_deps
|
||||||
|
|
||||||
@ -34,6 +35,7 @@ class SetupCluster(Task):
|
|||||||
self.cluster_dir = '/var/tmp/chef-Mon-Node'
|
self.cluster_dir = '/var/tmp/chef-Mon-Node'
|
||||||
self.cluster_hosts = None
|
self.cluster_hosts = None
|
||||||
self.mini_mon_dir = '/vagrant' # mini_mon_dir is /vagrant to match assumptions in mini-mon
|
self.mini_mon_dir = '/vagrant' # mini_mon_dir is /vagrant to match assumptions in mini-mon
|
||||||
|
self.vertica_packages = ['vertica_7.0.1-0_amd64.deb', 'vertica-r-lang_7.0.1-0_amd64.deb']
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
"""Installs the latest cookbooks and dependencies to run chef-solo and runs chef-solo on each box.
|
"""Installs the latest cookbooks and dependencies to run chef-solo and runs chef-solo on each box.
|
||||||
@ -42,18 +44,26 @@ class SetupCluster(Task):
|
|||||||
self.cluster_hosts = env.hosts
|
self.cluster_hosts = env.hosts
|
||||||
|
|
||||||
execute(install_deps)
|
execute(install_deps)
|
||||||
execute(git_mini_mon, self.mini_mon_dir)
|
execute(git_mini_mon, self.mini_mon_dir, 'feature/cluster')
|
||||||
|
|
||||||
# download cookbooks
|
# download cookbooks
|
||||||
with cd(self.cluster_dir):
|
with settings(hide('running', 'output', 'warnings'), warn_only=True):
|
||||||
sudo('berks vendor')
|
sudo('rm -r %s' % self.cluster_dir)
|
||||||
|
sudo('mkdir %s' % self.cluster_dir)
|
||||||
|
|
||||||
|
with cd(self.mini_mon_dir):
|
||||||
|
sudo('berks vendor %s/berks-cookbooks' % self.cluster_dir)
|
||||||
|
|
||||||
# the vertica packages from my.vertica.com are needed, this assumes they are one level up from cwd
|
# the vertica packages from my.vertica.com are needed, this assumes they are one level up from cwd
|
||||||
put('../vertica*.deb', self.mini_mon_dir, use_sudo=True)
|
for deb in self.vertica_packages:
|
||||||
|
with settings(hide('running', 'output', 'warnings'), warn_only=True):
|
||||||
|
if run('ls %s/%s' %(self.mini_mon_dir, deb)).failed:
|
||||||
|
puts('Uploading %s' % deb)
|
||||||
|
put('../../vertica*.deb', self.mini_mon_dir, use_sudo=True)
|
||||||
|
|
||||||
# Copy roles and data bags
|
# Copy roles and data bags - assumes you are running from the utils directory
|
||||||
put('%s/utils/cluster/data_bags' % self.mini_mon_dir, self.cluster_dir, use_sudo=True)
|
put('%s/cluster/data_bags' % os.path.dirname(env.real_fabfile), self.cluster_dir, use_sudo=True)
|
||||||
put('%s/utils/cluster/roles' % self.mini_mon_dir, self.cluster_dir, use_sudo=True)
|
put('%s/cluster/roles' % os.path.dirname(env.real_fabfile), self.cluster_dir, use_sudo=True)
|
||||||
|
|
||||||
execute(chef_solo, self.cluster_dir, "role[Mon-Node]")
|
execute(chef_solo, self.cluster_dir, "role[Mon-Node]")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user