Skip to content
Snippets Groups Projects
0_setup.py 521 B
Newer Older
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import utils


def setup(interactive=True):
    dir_path = utils.get_dir(__file__)
    cmds = [
        # NTP
        'DEBIAN_FRONTEND=noninteractive apt-get install -y ntp',
        'echo "Replacing /etc/ntp.conf"',
        dict(line='write', template='%s/ntp.conf' % dir_path, target='/etc/ntp.conf', params=(
            ('{{ NTP_SERVER }}', utils.get_conf('NTP_SERVER') or 'ntp.ubuntu.com'),
        )),
        'service ntp restart',
    ]
    utils.run_commands(cmds)