Пример #1
0
    path="/somelink",
    target="/elsewhere",
)

# Add/remove/add same user
server.user(user="******", )

server.user(
    user="******",
    present=False,
)

server.user(user="******", )

# Add/remove/add same group
server.group(group="somegroup", )

server.group(
    group="somegroup",
    present=False,
)

server.group(group="somegroup", )

# Add/remove same apt repo
apt.repo(
    src="deb https://download.virtualbox.org/virtualbox/debian bionic contrib",
)

apt.repo(
    src="deb https://download.virtualbox.org/virtualbox/debian bionic contrib",
Пример #2
0
        packages=['cron'],
        update=True,
    )

# simple example for a crontab
server.crontab(
    name='Backup /etc weekly',
    command='/bin/tar cf /tmp/etc_bup.tar /etc',
    cron_name='backup_etc',
    day_of_week=0,
    hour=1,
    minute=0,
)

server.group(
    name='Create docker group',
    group='docker',
)

# if we are not running inside a docker container
if not host.fact.file('/.dockerenv'):

    # Cannot change hostname if running in a docker container
    server.hostname(
        name='Set the hostname',
        hostname='server1.example.com',
    )

    # Cannot change value on read-only filesystem
    # use "/sbin/sysctl -a | grep file-max" to check value
    server.sysctl(
        name='Change the fs.file-max value',
Пример #3
0
        ['cron'],
        update=True,
    )

# simple example for a crontab
server.crontab(
    {'Backup /etc weekly'},
    '/bin/tar cf /tmp/etc_bup.tar /etc',
    name='backup_etc',
    day_of_week=0,
    hour=1,
    minute=0,
)

server.group(
    {'Create docker group'},
    'docker',
)

# if we are not running inside a docker container
if not host.fact.file('/.dockerenv'):

    # Cannot change hostname if running in a docker container
    server.hostname(
        {'Set the hostname'},
        'server1.example.com',
    )

    # Cannot change value on read-only filesystem
    # use "/sbin/sysctl -a | grep file-max" to check value
    server.sysctl(
        {'Change the fs.file-max value'},
Пример #4
0
        packages=["cron"],
        update=True,
    )

# simple example for a crontab
server.crontab(
    name="Backup /etc weekly",
    command="/bin/tar cf /tmp/etc_bup.tar /etc",
    cron_name="backup_etc",
    day_of_week=0,
    hour=1,
    minute=0,
)

server.group(
    name="Create docker group",
    group="docker",
)

# if we are not running inside a docker container
if not host.get_fact(File, path="/.dockerenv"):

    # Cannot change hostname if running in a docker container
    server.hostname(
        name="Set the hostname",
        hostname="server1.example.com",
    )

    # Cannot change value on read-only filesystem
    # use "/sbin/sysctl -a | grep file-max" to check value
    server.sysctl(
        name="Change the fs.file-max value",