Mercurial > code > home > repos > infra
annotate tasks.py @ 5:7e8c7de5b490
port wireguard setup
author | drewp@bigasterisk.com |
---|---|
date | Wed, 10 Nov 2021 09:51:54 -0800 |
parents | 61945df2a392 |
children | b6fff51f8676 |
rev | line source |
---|---|
0
1550a6db59b3
first ported section from ansible. shorter, faster, clearer.
drewp@bigasterisk.com
parents:
diff
changeset
|
1 from invoke import task |
1550a6db59b3
first ported section from ansible. shorter, faster, clearer.
drewp@bigasterisk.com
parents:
diff
changeset
|
2 |
1 | 3 cmd = ''' |
0
1550a6db59b3
first ported section from ansible. shorter, faster, clearer.
drewp@bigasterisk.com
parents:
diff
changeset
|
4 HOME=/root |
1550a6db59b3
first ported section from ansible. shorter, faster, clearer.
drewp@bigasterisk.com
parents:
diff
changeset
|
5 export HOME |
1550a6db59b3
first ported section from ansible. shorter, faster, clearer.
drewp@bigasterisk.com
parents:
diff
changeset
|
6 eval `keychain --quiet --eval id_ecdsa` |
1550a6db59b3
first ported section from ansible. shorter, faster, clearer.
drewp@bigasterisk.com
parents:
diff
changeset
|
7 cd /my/proj/infra |
3
61945df2a392
updates to work on recent raspbian installs
drewp@bigasterisk.com
parents:
1
diff
changeset
|
8 env/bin/pyinfra ''' |
1 | 9 |
5 | 10 |
1 | 11 @task |
12 def users(ctx): | |
3
61945df2a392
updates to work on recent raspbian installs
drewp@bigasterisk.com
parents:
1
diff
changeset
|
13 ctx.run(cmd + 'inventory.py users.py', pty=True) |
1 | 14 |
5 | 15 |
1 | 16 @task |
17 def system(ctx): | |
3
61945df2a392
updates to work on recent raspbian installs
drewp@bigasterisk.com
parents:
1
diff
changeset
|
18 ctx.run(cmd + 'inventory.py system.py', pty=True) |
61945df2a392
updates to work on recent raspbian installs
drewp@bigasterisk.com
parents:
1
diff
changeset
|
19 |
5 | 20 |
21 @task | |
22 def wireguard(ctx): | |
23 ctx.run(cmd + 'inventory.py wireguard.py', pty=True) | |
24 | |
25 | |
3
61945df2a392
updates to work on recent raspbian installs
drewp@bigasterisk.com
parents:
1
diff
changeset
|
26 @task |
61945df2a392
updates to work on recent raspbian installs
drewp@bigasterisk.com
parents:
1
diff
changeset
|
27 def get_fact(ctx, host='dash', fact='server.LinuxDistribution'): |
61945df2a392
updates to work on recent raspbian installs
drewp@bigasterisk.com
parents:
1
diff
changeset
|
28 ctx.run(cmd + f'{host} fact {fact}', pty=True) |