Пример #1
0
def configure_apache():
    with settings(warn_only=True):
        if sudo("test -e /etc/apache2/sites-enabled/jenkins").succeeded:
            print(green('Apache is already configured'))
            return

    deploy_dir = env.conf['deploy_dir']

    # Configure enabled sites
    sudo('rm -rf /etc/apache2/sites-enabled/*')
    links_to('/etc/apache2/sites-enabled/jenkins', '%sjenkins/config/apache/jenkins' % deploy_dir)

    apache_modules = ['proxy', 'proxy_http', 'vhost_alias']

    for module in apache_modules:
        enable_module(module)

    print(green('Finished Apache configuration.'))
Пример #2
0
def configure_jenkins():
    with settings(warn_only=True):
        if files.contains('/var/lib/jenkins/config.xml', 'hudson.security.PAMSecurityRealm'):
            print(green('Jenkins is already configured'))
            return

    # I want to have user authentication based on the unix pam
    sudo('usermod -a -G shadow jenkins')

    # And I want to be able to login!
    username = prompt("Jenkins username: "******"%s username password: ")
    sudo('useradd %s -p `openssl passwd -1 %s`' % (username, password))

    deploy_dir = env.conf['deploy_dir']
    links_to('/var/lib/jenkins/config.xml', '%sjenkins/config/jenkins/global.config.xml' % deploy_dir)
    
    # Configure the GIT plugin
    links_to('/var/lib/jenkins/hudson.plugins.git.GitSCM.xml', '%sjenkins/config/jenkins/hudson.plugins.git.GitSCM.xml' % deploy_dir)
    
    # Configure the w3af build job
    sudo('mkdir -p /var/lib/jenkins/jobs/w3af/')
    sudo('mkdir -p /var/lib/jenkins/jobs/w3af/builds/')
    links_to('/var/lib/jenkins/jobs/w3af/config.xml', '%sjenkins/config/jenkins/w3af.job.config.xml' % deploy_dir)
    
    print(green('Finished Jenkins configuration.'))
Пример #3
0
def configure_sudo():
    deploy_dir = env.conf['deploy_dir']
    links_to('/etc/sudoers', '%sjenkins/config/sudoers' % deploy_dir)