def install_auto(package): """Install a package answering yes to all questions""" with settings(linewise=True, warn_only=True): sudo("apt-get update") sudo('DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get install -o' ' Dpkg::Options::="--force-confold" --force-yes -y %s' % package)
def user_passwd(user, passwd=False): """Change password for user""" with settings(hide('running', 'stdout', 'stderr'), warn_only=True): if not passwd: passwd = generate_passwd() sudo("echo -e '%s\n%s' | passwd %s" % ( passwd, passwd, user))
def start_nagios(): ''' Starts Nagios on VM and sets up Nagios as upstart job. ''' cuisine.file_upload('/usr/local/nagios/etc/objects/commands.cfg','nrpe_commands.cfg', sudo=True) cuisine.sudo('ln -sf /etc/init.d/nagios /etc/rcS.d/S99nagios') cuisine.sudo('/etc/init.d/nagios start')
def push_git_repo(self, computer, user, group, git_url, target_path): ''' Make a local clone of the repo in git_url into the temp directory specified in the settings file, then rsync it to the remote path. :type computer: string :param computer: computer name to push to :type user: string :param user: user to own the files in the repo :type group: string :param group: group to own the files in the repo :type git_url: string :param git_url: git url of repo (probably from github) :type target_path: string :param target_path: root path on remote server to copy git repo to ''' rsync_command = ('rsync -qrlptz --delete --delete-excluded ' '--exclude=.svn --exclude=.git') tmp_path = os.path.join(self.settings["tmp_dir"], 'push_git_repo/repo/') if not os.path.exists(tmp_path): local('git clone %s %s' % (git_url, tmp_path)) else: local('cd %s && git pull' % tmp_path) local('%s %s root@%s:%s' % (rsync_command, tmp_path, computer, target_path)) cuisine.sudo('chown -R %s:%s %s' % (user, group, target_path)) shutil.rmtree(tmp_path)
def crontab_add(schedule, script, cron_name, root=False): command = '(crontab -l; echo "%s %s && echo \'%s\'" ) | crontab -' % ( schedule, script, cron_name) if root: sudo(command) else: run(command)
def service_ctl(service='listenerdaemon', command='start', use_sudo=False): cuisine.file_ensure(('/etc/init.d/%s' % service)) cmd = str('/etc/init.d/%s %s' % (service, command)) if use_sudo: cuisine.sudo(cmd, shell=False) else: cuisine.run(cmd, shell=False)
def apply(self, computer): cuisine.package_ensure('shorewall') cuisine.package_ensure('shorewall-doc') self.push_package_file_set('shorewall', computer) cuisine.sudo("service shorewall restart")
def install_nagios_plugins_from_source(): ''' Downloads Nagios plugins source code and installs Nagios plugins on VM. ''' if not nagios_plugins_downloaded(): cuisine.sudo('wget http://nagios-plugins.org/download/nagios-plugins-2.0.3.tar.gz') cuisine.run('tar xzf nagios-plugins-2.0.3.tar.gz') cuisine.run('cd ~/nagios-plugins-2.0.3 && ./configure --with-nagios-user=nagios --with-nagios-group=nagios && make && make install', shell=False)
def puppet_cert_sign(): ''' Connet to the puppet master and sign the client cert. ''' client = get_hostname() print(green("Signing cert for %s on %s" % (client, env.puppet_server))) with settings(user=DEFAULT_USER, host_string=env.puppet_server): sudo("puppet cert sign %s" % client)
def run_python_program(program=None, sudo=False): """ Fabric task to run a Python program on a VM. """ cuisine.file_ensure('/usr/bin/python') if sudo: cuisine.sudo(('/usr/bin/python %s' % program)) else: cuisine.run(('/usr/bin/python %s' % program))
def apply(self, computer): cuisine.package_ensure('nginx-extras') cuisine.dir_ensure('/srv/www/', mode='755') tmp_env = {"name": computer} self.push_package_file_set('nginx', computer, tmp_env) cuisine.sudo("service nginx restart")
def apply(self, computer): group = self.environment["computers"][computer]["host_group"] computers = self.environment["groups"][group]["computers"] sibs = [comp for comp in computers if comp != computer] tmp_env = {"host": computer, "sibs": sibs, "computers": self.environment["computers"]} self.push_package_file_set('hosts', computer, tmp_env) cuisine.sudo("service hostname restart")
def install_pip(): ''' Install pip package manager. Will install on CentOS > 6. ''' family = distro_family() if family == 'debian': package_ensure('python-pip') elif family == 'redhat': package_ensure('python-pip') sudo('pip-python install --upgrade pip')
def install(package): """Install a package""" with settings(linewise=True, warn_only=True): sudo("apt-get update") for retry in range(2): if sudo("apt-get -y install %s" % package).failed: local("echo INSTALLATION FAILED FOR %s: was installing %s" " $(date) >> ~/fail.log" % (env.host, package)) else: break
def apache_site_ensure(name, config, root_dir=None): '''Configures and loads an apache site config''' root_dir = root_dir or join('/var/www', name) with cuisine.mode_sudo(): cuisine.dir_ensure(root_dir, recursive=True) cuisine.file_write('/etc/apache2/sites-available/{}'.format(name), config, sudo=True) if not cuisine.file_exists('/etc/apache2/sites-enabled/{}'.format(name)): cuisine.sudo('a2ensite {}'.format(name)) cuisine.sudo('service apache2 reload')
def update_git_repo(self, user, git_url, target_path): ''' Update an existing git repo on a remote server. :type git_url: string :param git_url: git url of repo (probably from github) :type target_path: string :param target_path: root path on remote server to update git repo in ''' cuisine.sudo('cd %s && sudo -u %s git pull' % (target_path, user))
def user_add(new_user, passwd=False): """Add new user""" with settings(hide('running', 'stdout', 'stderr'), warn_only=True): if not passwd: passwd = generate_passwd() if not sudo("echo -e '%s\n%s\n' | adduser %s" % (passwd, passwd, new_user)).failed: if env.host == 'host1.local': sudo("mkdir /home/%s/public_html" % new_user) sudo("chown %s:%s /home/%s/public_html/" % new_user)
def clone_git_repo(self, user, git_url, target_path): ''' Clone a git repo on a remote server. :type git_url: string :param git_url: git url of repo (probably from github) :type target_path: string :param target_path: root path on remote server to clone git repo into ''' cuisine.sudo('sudo -Hi -u %s git clone %s %s' % (user, git_url, target_path))
def checkout_project(self): with mode_sudo(): dir_ensure(self.repo_dir, owner=self.user_name, group=self.group_name, recursive=True, ) with cd(self.repo_dir): sudo(r'chown %s:%s .' % (self.user_name, self.group_name)) sudo(r'ls -d * > /dev/null 2>&1 || %s clone -q %s .' % (self.vcs, self.repo_url), user=self.user_name)
def apply(self, computer): with prefix('export DEBIAN_FRONTEND=noninteractive'): cuisine.package_ensure('postfix') cuisine.package_ensure('mailutils') tmp_env = {"name": computer} if "name" in self.settings["params"]: tmp_env["name"] = self.settings["params"]["name"] self.push_package_file_set('postfix', computer, tmp_env) cuisine.sudo("/usr/bin/newaliases") cuisine.sudo("service postfix restart")
def install_python27(): print white('--- install python2.7 ---', bold=True) #if not file_exists('/usr/local/bin/python2.7'): with cd('~/'): run('curl -O https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz') run('tar zxvf Python-2.7.9.tgz') with cd('/home/{}/Python-2.7.9'.format(run('whoami'))): run('./configure') run('make') sudo('make install') with cd('~/'): run('rm Python-2.7.9.tgz') run('rm -rf Python-2.7.9')
def set_mac_environment(): print white('--- set mac environment ---', bold=True) sudo('nvram SystemAudioVolume=%80') run('defaults write com.apple.dock autohide -bool true') run('defaults write com.apple.dock autohide-delay -float 0') run('defaults write com.apple.dock magnification -bool true') run('defaults write com.apple.dock tilesize -int 40') run('defaults write com.apple.dock largesize -int 80') run('defaults write com.apple.dock mineffect -string "scale"') run('killall Dock') run('defaults write com.apple.finder CreateDesktop -bool false') run('killall Finder')
def install(): """ Install python packages """ puts(green('-> Installing python')) cuisine.package_ensure("python") puts(green('-> Installing python-dev')) cuisine.package_ensure("python-dev") puts(green('-> Installing python-pip')) cuisine.package_ensure("python-pip") puts(green('-> Install python virtualenv wrapper')) cuisine.sudo('pip install virtualenvwrapper')
def _setup_postgres(): """ Install PostgreSQL and setup the database. """ print blue("Setup PostgreSQL") cuisine.sudo('echo "deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main" > /etc/apt/sources.list.d/pgdg.list') cuisine.sudo('wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -') cuisine.package_update() cuisine.package_ensure('postgresql') cuisine.package_ensure('postgresql-server-dev-9.3') role = run('psql postgres -tAc "SELECT 1 FROM pg_roles WHERE rolname=\'vagrant\'"') if not role: print blue("Create DB user") run('sudo su -c "createuser --createdb --superuser vagrant" postgres')
def setup_time_calibration(): sudo('apt-get -y install ntp') put('config/ntpdate.cron', '%s/' % env.NEWSBLUR_PATH) sudo('chmod 755 %s/ntpdate.cron' % env.NEWSBLUR_PATH) sudo('mv %s/ntpdate.cron /etc/cron.hourly/ntpdate' % env.NEWSBLUR_PATH) with settings(warn_only=True): sudo('/etc/cron.hourly/ntpdate')
def copy_source(): local('git archive $(git symbolic-ref HEAD 2>/dev/null) ' '| bzip2 > /tmp/app_name.tar.bz2') remote_filename = '/tmp/app_name.tar.bz2' code_dir = '~/app_name' sudo('rm -rf %s' % code_dir) if cuisine.file_exists(remote_filename): sudo('rm %s' % remote_filename) cuisine.file_upload(remote_filename, '/tmp/app_name.tar.bz2') with cuisine.mode_sudo(): run('mkdir -p %s' % code_dir) cuisine.file_attribs(remote_filename) run('tar jxf %s -C %s' % (remote_filename, code_dir)) run('rm %s' % (remote_filename,))
def install_apache(): """Install Apache server with userdir enabled""" with settings(linewise=True, warn_only=True): sudo("apt-get update") sudo("apt-get -y install apache2") if run("ls /etc/apache2/mods-enabled/userdir.conf").failed: sudo("a2enmod userdir") sudo("/etc/init.d/apache2 restart")
def install_nagiosbpi(): cuisine.sudo('rm -rf /tmp/nagios-nagiosbpi') cuisine.run('git clone git://git.code.sf.net/p/nagios/nagiosbpi /tmp/nagios-nagiosbpi') cuisine.run('cp -R /tmp/nagios-nagiosbpi/nagiosbpi /usr/local/nagios/share') cuisine.sudo('mkdir -p /usr/local/nagios/share/nagiosbpi/tmp') chmod_file('o+rx', '/usr/local/nagios/share/nagiosbpi/config_functions') chmod_file('o+rx', '/usr/local/nagios/share/nagiosbpi/functions') chmod_file('o+rx', '/usr/local/nagios/share/nagiosbpi/images') chmod_file('o+rx', '/usr/local/nagios/share/nagiosbpi/tmp') chmod_file('o+rxw', '/usr/local/nagios/share/nagiosbpi/tmp') cuisine.file_upload('/usr/local/nagios/share/nagiosbpi/constants.conf', 'constants.conf', sudo=True) chmod_file('+x', '/usr/local/nagios/share/nagiosbpi/set_bpi_perms.sh') chmod_file('777', '/usr/local/nagios/share/nagiosbpi/bpi.conf') chmod_file('-R 777', '/usr/local/nagios/share/nagiosbpi/tmp') chmod_file('+x', '/usr/local/nagios/share/nagiosbpi/check_bpi.php')
def copy_source(): '''archive the git source and copy it''' local('git archive $(git symbolic-ref HEAD 2>/dev/null)' ' | bzip2 > /tmp/%s.tar.bz2' % APP_NAME) remote_filename = '/tmp/%s.tar.bz2' % APP_NAME code_dir = '/home/%s/CODE' % APP_NAME sudo('rm -rf %s' % code_dir) if cuisine.file_exists(remote_filename): sudo('rm %s' % remote_filename) cuisine.file_upload( remote_filename, '/tmp/%s.tar.bz2' % APP_NAME) with cuisine.mode_sudo(): run('mkdir -p %s' % code_dir) cuisine.file_attribs(remote_filename) run('tar jxf %s -C %s' % (remote_filename, code_dir)) run('rm %s' % (remote_filename,))
def install_python27(): sudo('yum -y groupinstall "Development tools"') sudo('yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel') sudo('yum -y install python-virtualenvwrapper') append('~/.bashrc', venv_snippet) if exists('/opt/python27'): return sudo('mkdir /opt/python27') with cd('/tmp'): run('curl -O https://www.python.org/ftp/python/2.7.6/Python-2.7.6.tgz') run('tar zxf Python-2.7.6.tgz') with cd('Python-2.7.6'): run('./configure --prefix=/opt/python27') run('make') sudo('make install') run('rm -rf Python-2.7.6*')
def testSudoPrefix( self ): # Ensure that env.sudo_prefix is respected by setting it to # echo the command to stdout rather than executing it with settings(use_shell=True, sudo_prefix="echo %s"): cmd = 'ls -la' run_result = cuisine.run(cmd) sudo_result = cuisine.sudo(cmd) self.assertNotEqual(run_result.stdout, sudo_result.stdout) self.assertIn(env.shell, sudo_result) self.assertIn(cmd, sudo_result)
def run_as_postgres(cmd): """ Run given command as postgres user. """ # The cd below is needed to avoid the following warning: # # could not change directory to "/root" # with cd('/'): return sudo(cmd, user='******')
def apply(self, computer): username = "******" if not cuisine.user_check(username): cuisine.user_create(username) cuisine.sudo('usermod -p `openssl rand -base64 32` %s' % username) key = self.environment["users"][username]["ssh_public_key"] cuisine.ssh_authorize(username, key) cuisine.dir_ensure('/home/example_com/www', mode='755', owner=username, group=username) cuisine.file_link('/home/example_com/www', '/srv/www/example_com') self.push_package_file_set('example_com', computer) cuisine.file_link('/etc/nginx/sites-available/example_com', '/etc/nginx/sites-enabled/example_com') cuisine.sudo("service nginx restart")
def add_nagios_user(): ''' Adds Nagios user and group and sets correct file permissions. ''' cuisine.group_ensure('nagcmd') cuisine.group_ensure('nagios') cuisine.user_ensure('nagios') cuisine.group_user_ensure('nagios', 'nagios') cuisine.group_user_ensure('nagcmd', 'nagios') cuisine.user_ensure('www-data') cuisine.group_user_ensure('nagcmd', 'www-data') cuisine.sudo('mkdir -p /usr/local/nagios') cuisine.sudo('mkdir -p /usr/local/nagios/libexec') cuisine.dir_ensure('/usr/local/nagios') cuisine.dir_ensure('/usr/local/nagios/libexec') cuisine.sudo('chown nagios.nagcmd /usr/local/nagios') cuisine.sudo('chown -R nagios.nagcmd /usr/local/nagios/libexec')
def install_nagios_from_source(): ''' Downloads Nagios source code and installs Nagios on VM. ''' cuisine.dir_ensure('/usr/local/src') cuisine.sudo('mkdir -p /etc/httpd/conf.d/') cuisine.dir_ensure('/etc/httpd/conf.d/') cuisine.sudo('cd /usr/local/src') if not nagios_downloaded(): cuisine.sudo('wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.4.1.tar.gz') cuisine.sudo('tar xzf nagios-3.4.1.tar.gz') cuisine.run('cd ~/nagios && ./configure --with-command-group=nagcmd && make all && make install', shell=False) cuisine.run('cd ~/nagios && make install-init && make install-config && make install-commandmode', shell=False) cuisine.run('cd ~/nagios && make install-webconf', shell=False) cuisine.run('cp /etc/httpd/conf.d/nagios.conf /etc/apache2/conf-available/nagios.conf', shell=False) cuisine.run('cp /etc/httpd/conf.d/nagios.conf /etc/apache2/conf-enabled/nagios.conf', shell=False) cuisine.run('rm -rf /etc/apache2/conf-available/nagios3.conf') cuisine.run('rm -rf /etc/apache2/conf-enabled/nagios3.conf')
def install_nrpe_plugin_from_source(): ''' Downloads NRPE plugin source code and installs NRPE plugin on VM. ''' cuisine.package_ensure_apt('libssl-dev') cuisine.dir_ensure('/usr/local/src') cuisine.sudo('cd /usr/local/src') if not nrpe_plugins_downloaded(): cuisine.sudo('wget http://sourceforge.net/projects/nagios/files/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz') cuisine.sudo('tar xzf nrpe-2.15.tar.gz') cuisine.run('cd ~/nrpe-2.15 && ./configure --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/x86_64-linux-gnu && make all && make install-plugin')
def django_search_ensure(project_path, venv_path='.venv'): with virtualenv(project_path, venv_path): run("python manage.py build_solr_schema > schema.xml") sudo("mv schema.xml /etc/solr/conf/") sudo("service tomcat6 restart") sudo('python manage.py rebuild_index --noinput')
def pip_install(package): cuisine.package_ensure('python-pip') command = str('pip install %s' % package) cuisine.sudo(command, shell=False)
def apply(self, computer): # the ssh package is already installed, or else we woudln't # be able to run all the fabric/cuisine stuff self.push_package_file_set('ssh', computer) cuisine.sudo("service ssh restart")
def bootstrap(): """ Bootstrap vagrant enviroment """ puts(red('###############################')) puts(red('### Setup host')) puts(red('###############################')) puts(green('-> Add backports')) cuisine.sudo( 'echo "deb http://ftp.us.debian.org/debian wheezy-backports main" >> /etc/apt/sources.list' ) puts(green('-> Update repositories')) cuisine.package_update() puts(green('-> Installing gettext')) cuisine.package_ensure("gettext") puts(green('-> Installing curl')) cuisine.package_ensure("curl") puts(green('-> Installing git')) cuisine.package_ensure("git") puts(green('-> Installing nano')) cuisine.package_ensure("nano") puts(green('-> Installing build-essential')) cuisine.package_ensure("build-essential") puts(green('-> Installing libxml2-dev')) cuisine.package_ensure("libxml2-dev") puts(green('-> Installing libjpeg8-dev')) cuisine.package_ensure("libjpeg8-dev") puts(green('-> Installing libpng12-dev')) cuisine.package_ensure("libpng12-dev") puts(green('-> Installing python')) cuisine.package_ensure("python") puts(green('-> Installing python-dev')) cuisine.package_ensure("python-dev") puts(green('-> Installing python-pip')) cuisine.package_ensure("python-pip") puts(green('-> Installing postgres')) if not cuisine.dir_exists('/etc/postgresql'): cuisine.sudo( 'echo "deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main" > /etc/apt/sources.list.d/pgdg.list' ) cuisine.sudo( 'wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -' ) cuisine.package_update() cuisine.package_ensure('postgresql') cuisine.package_ensure('postgresql-server-dev-9.3') puts(green('-> Configuring postgres user login')) old_srt = "local all all peer" new_srt = "local all all trust" cuisine.sudo('sed -i "s/%s/%s/g" /etc/postgresql/9.3/main/pg_hba.conf' % (old_srt, new_srt)) cuisine.sudo('/etc/init.d/postgresql restart') puts(green('-> Creating database')) db_name = DATABASES['default']['NAME'] db_user = DATABASES['default']['USER'] db_pass = DATABASES['default']['PASSWORD'] puts(green('-> Creating postgres username')) cuisine.sudo('psql -c "CREATE USER %s WITH PASSWORD \'%s\';"' % (db_user, db_pass), user='******') puts(green('-> Creating postgres database')) cuisine.sudo('psql -c "CREATE DATABASE %s;"' % db_name, user='******') puts(green('-> Installing requirements for django')) with cuisine.cd(env.project_path): cuisine.run( 'pip install --user https://www.djangoproject.com/download/1.7c2/tarball/' ) cuisine.run('pip install --user -r requirements.txt') puts(green('-> Installing nodejs')) cuisine.package_ensure('nodejs-legacy') cuisine.sudo('curl https://www.npmjs.org/install.sh | sh ') puts(green('-> Installing yuglify')) cuisine.sudo('npm -g install yuglify') puts(green('-> Installing bower')) cuisine.sudo('npm -g install bower') puts(green('-> Creating directories')) cuisine.dir_ensure(env.project_path + 'assets/components') cuisine.dir_ensure(env.project_path + 'assets/images') cuisine.dir_ensure(env.project_path + 'assets/stylesheets') cuisine.dir_ensure(env.project_path + 'assets/scripts') cuisine.dir_ensure(env.project_path + 'locale/') puts(red('###############################')) puts(red('### Host setup completed')) puts(red('###############################'))
def buildbox(): for pkg in test_packages: sudo('apt-get install -y %s' % pkg) run('echo "%s" > %s' % (test_file_content, test_file))
def pip_install(package): sudo('apt-get -y install python-pip') command = str('pip install %s' % package) cuisine.sudo(command, shell=False)
def crontab_remove(cron_name, root=False): command = 'crontab -l | sed "/^.*[\']%s[\']/d" | crontab -' % cron_name if root: sudo(command) else: run(command)
def run_python_program(program=None, sudo=False): cuisine.file_ensure('/usr/bin/python') if sudo: cuisine.sudo(('/usr/bin/python %s' % program)) else: cuisine.run(('/usr/bin/python %s' % program))
def install_nagiosgraph(): cuisine.run('svn checkout --force http://svn.code.sf.net/p/nagiosgraph/code/trunk /tmp/nagiosgraph-code') cuisine.sudo('mkdir -p /opt/nagiosgraph/etc') cuisine.sudo('cp /tmp/nagiosgraph-code/nagiosgraph/lib/insert.pl /usr/local/nagios/libexec/insert.pl') cuisine.sudo('chown nagios.nagios /usr/local/nagios/libexec/insert.pl') cuisine.sudo('cp /tmp/nagiosgraph-code/nagiosgraph/cgi/*.cgi /usr/local/nagios/sbin') cuisine.sudo('chown -R nagios.nagios /usr/local/nagios/sbin') cuisine.sudo('cp /tmp/nagiosgraph-code/nagiosgraph/share/nagiosgraph.css /usr/local/nagios/share') cuisine.sudo('cp /tmp/nagiosgraph-code/nagiosgraph/share/nagiosgraph.js /usr/local/nagios/share') cuisine.sudo('chown -R nagios.nagios /usr/local/nagios/share') cuisine.sudo('cp /tmp/nagiosgraph-code/nagiosgraph/etc/* /opt/nagiosgraph/etc') # cuisine.sudo('mkdir -p /opt/nagiosgraph/etc/map') # cuisine.sudo('cp -r /tmp/nagiosgraph-code/nagiosgraph/etc/map/* /opt/nagiosgraph/etc/map') cuisine.file_upload('/opt/nagiosgraph/etc/nagiosgraph.conf','nagiosgraph.conf',sudo=True) cuisine.file_upload('/usr/local/nagios/etc/nagios.cfg','nagios.cfg',sudo=True) cuisine.file_upload('/usr/local/nagios/etc/objects/commands.cfg','commands.cfg',sudo=True) cuisine.file_upload('/usr/local/nagios/etc/objects/graphed_service.cfg','graphed_service.cfg',sudo=True) cuisine.sudo('mkdir -p /var/nagios') cuisine.sudo('chown nagios.nagios /var/nagios') cuisine.sudo('chmod 775 /var/nagios') cuisine.sudo('mkdir -p /var/nagios/rrd') cuisine.sudo('chown nagios.nagios /var/nagios/rrd') cuisine.sudo('chmod 775 /var/nagios/rrd') cuisine.sudo('touch /var/log/nagiosgraph.log') cuisine.sudo('chown nagios.nagios /var/log/nagiosgraph.log') cuisine.sudo('chmod 664 /var/log/nagiosgraph.log') cuisine.sudo('touch /var/log/nagiosgraph-cgi.log') cuisine.sudo('chown nagios.nagios /var/log/nagiosgraph-cgi.log') cuisine.sudo('chmod 664 /var/log/nagiosgraph-cgi.log') cuisine.sudo('cp /tmp/nagiosgraph-code/nagiosgraph/share/graph.gif /usr/local/nagios/share/images/action.gif') cuisine.file_upload('/usr/local/nagios/share/ssi/common-header.ssi', 'common-header.ssi', sudo=True) cuisine.file_upload('/usr/local/nagios/share/side.php', 'side.php', sudo=True)