view pi-setup/tasks.py @ 289:65e28d2e0cd8

move static templates to files/ ; use inventory tags for selecting hosts+features ; other refactors
author drewp@bigasterisk.com
date Sun, 21 Apr 2024 17:07:23 -0700
parents 3af02e24eaf9
children b3acb9fff274
line wrap: on
line source

from invoke import task

cmd = '''
HOME=/root
export HOME
eval `keychain --quiet --eval id_ecdsa`
'''

@task
def init_workspace(ctx):
    ctx.run(cmd + 'pdm run -p .. setup_pi.py --init', pty=True)

@task
def setup_pi(ctx, hostname, serial):
    ctx.run(cmd + f'pdm run -p .. setup_pi.py {hostname} {serial}', pty=True)


@task
def iscsi(ctx, hostname):
    ctx.run(cmd + f'pdm run -p .. setup_pi.py --iscsi {hostname}', pty=True)