Skip to content

Instantly share code, notes, and snippets.

@guixing
Created January 5, 2014 09:30
Show Gist options
  • Save guixing/8266239 to your computer and use it in GitHub Desktop.
Save guixing/8266239 to your computer and use it in GitHub Desktop.
from fabric.api import run, env
env.user = 'root'
env.password = 'vagrant'
def host_type():
run('uname -s')
def init(identity):
run('rm -f /etc/yum.repos.d/*')
run('cd /etc/yum.repos.d/ && wget http://mirrors.163.com/.help/CentOS6-Base-163.repo')
run('rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm')
run('rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm')
run('rpm -ivh https://yum.puppetlabs.com/el/6/products/x86_64/puppetlabs-release-6-7.noarch.rpm')
run('echo 172.16.1.10 puppet simplecmdb configserver >> /etc/hosts')
run('echo 172.16.1.11 deploymaster >> /etc/hosts')
run('echo %s >> /etc/hostidentity' % identity)
run('yum install -y puppet dmidecode')
run('curl -o /etc/puppet/puppet.conf http://configserver:8081/puppet/puppet.conf')
run('puppet agent --onetime --no-daemonize')
run("""cat << EOF > /etc/cron.hourly/puppetagent
#!/bin/bash
puppet agent --onetime --no-daemonize >> /tmp/puppetagent.log 2>&1
EOF
""")
run("chmod +x /etc/cron.hourly/puppetagent")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment