Beispiel #1
0
def ensure():
    # Make sure the user exists
    user_ensure('acme')
    group_ensure('acme')
    group_user_ensure('acme', 'acme')

    # Make sure acme.sh is installed for the acme user
    if not path.has('acme.sh', user='******'):
        git.ensure_clone_github('Neilpang/acme.sh', '/home/acme/acme.sh', user='******')
        with cd("/home/acme/acme.sh"):
            sudo("./acme.sh --install", user='******')
    dir_ensure(well_known_base)
    sudo("chown acme:acme {well_known} && chmod 755 {well_known}".format(well_known=well_known_base)) # Can't change attributes without sudo in a sticky (not write) directory... annoying
Beispiel #2
0
def equilibriate():
    """Equilibriate runs games."""
    # Out of scope: Set up DNS (including poll script), ssh, sudo

    # Set up the firewall
    put("config/firewalls/equilibriate.sh", "/usr/local/bin", use_sudo=True)
    sudo("sh /usr/local/bin/equilibriate.sh")

    # Set up java for minecraft
    if not path.has('java'):
        sudo('echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee /etc/apt/sources.list.d/webupd8team-java.list')
        sudo('echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list')
        sudo('apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886')
        sudo('apt-get update')
        sudo('echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections')
        package_ensure(["oracle-java8-installer"]) # fails
Beispiel #3
0
def xenu():
    """Xenu runs minecraft."""
    # Set up the firewall
    util.put_file("config/firewalls/xenu.sh",
                  "/usr/local/bin/xenu.sh",
                  mode='755',
                  user='******')
    sudo("sh /usr/local/bin/xenu.sh")
    util.put_file("config/firewalls/iptables",
                  "/etc/network/if-pre-up.d/",
                  mode='755',
                  user='******')

    # Set up logging
    logs.setup()

    # Set up authorization to back up
    public_key = ssh.ensure_key('/var/local/germinate-backup', use_sudo=True)
    with settings(user='******', host_string='germinate'):
        files.append('/home/xenu-linux/.ssh/authorized_keys',
                     public_key,
                     use_sudo=True)
    sudo("mkdir -p /root/.ssh")
    util.put_file("config/backup/sshconfig-xenu",
                  "/root/.ssh/config",
                  user='******')

    # Set up backup
    package_ensure(["rsync"])
    util.put_file("config/backup/generic-backup.sh",
                  "/var/local",
                  mode='755',
                  user='******')
    util.put_file("config/backup/backup-exclude-xenu",
                  "/var/local/backup-exclude",
                  mode='644',
                  user='******')
    util.put_file("config/backup/backup-xenu.sh",
                  "/etc/cron.daily/backup-xenu",
                  mode='755',
                  user='******')

    # Minecraft prereqs
    package_ensure(["make", "tmux"])
    # Set up java for minecraft
    if not path.has('java'):
        sudo(
            'echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee /etc/apt/sources.list.d/webupd8team-java.list'
        )
        sudo(
            'echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list'
        )
        sudo(
            'apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886'
        )
        sudo('apt-get update')
        sudo(
            'echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections'
        )
        package_ensure(["oracle-java8-installer"])  # fails

    # Set up nginx
    already_installed = nginx.ensure()
    if not already_installed:
        nginx.restart()  # IPv[46] listener only changes on restart
    util.put_dir("data/minecraft-www",
                 "/var/www/minecraft-www",
                 user="******")
    nginx.ensure_site('config/nginx/minecraft.za3k.com')
    nginx.reload()