view tasks.py @ 5:7e8c7de5b490

port wireguard setup
author drewp@bigasterisk.com
date Wed, 10 Nov 2021 09:51:54 -0800
parents 61945df2a392
children b6fff51f8676
line wrap: on
line source

from invoke import task

cmd = '''
HOME=/root
export HOME
eval `keychain --quiet --eval id_ecdsa`
cd /my/proj/infra
env/bin/pyinfra '''


@task
def users(ctx):
    ctx.run(cmd + 'inventory.py users.py', pty=True)


@task
def system(ctx):
    ctx.run(cmd + 'inventory.py system.py', pty=True)


@task
def wireguard(ctx):
    ctx.run(cmd + 'inventory.py wireguard.py', pty=True)


@task
def get_fact(ctx, host='dash', fact='server.LinuxDistribution'):
    ctx.run(cmd + f'{host} fact {fact}', pty=True)