Mercurial > code > home > repos > infra
annotate tasks.py @ 34:d4fb38f13c79
refactor dns and some other non-net setup
author | drewp@bigasterisk.com |
---|---|
date | Sat, 15 Jan 2022 15:40:22 -0800 |
parents | 67fc0d4b1859 |
children | dc2100504c45 |
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 |
12 | 17 def ssh(ctx): |
18 ctx.run(cmd + 'inventory.py ssh.py', pty=True) | |
19 | |
20 | |
21 @task | |
1 | 22 def system(ctx): |
3
61945df2a392
updates to work on recent raspbian installs
drewp@bigasterisk.com
parents:
1
diff
changeset
|
23 ctx.run(cmd + 'inventory.py system.py', pty=True) |
61945df2a392
updates to work on recent raspbian installs
drewp@bigasterisk.com
parents:
1
diff
changeset
|
24 |
5 | 25 |
26 @task | |
12 | 27 def packages(ctx): |
28 ctx.run(cmd + 'inventory.py packages.py', pty=True) | |
29 | |
30 | |
31 @task | |
7
b6fff51f8676
net.py setup. May not be safe on bang yet
drewp@bigasterisk.com
parents:
5
diff
changeset
|
32 def net(ctx): |
23 | 33 ctx.run(cmd + 'inventory.py net.py -v --limit prime', pty=True) |
7
b6fff51f8676
net.py setup. May not be safe on bang yet
drewp@bigasterisk.com
parents:
5
diff
changeset
|
34 |
b6fff51f8676
net.py setup. May not be safe on bang yet
drewp@bigasterisk.com
parents:
5
diff
changeset
|
35 |
b6fff51f8676
net.py setup. May not be safe on bang yet
drewp@bigasterisk.com
parents:
5
diff
changeset
|
36 @task |
34
d4fb38f13c79
refactor dns and some other non-net setup
drewp@bigasterisk.com
parents:
23
diff
changeset
|
37 def dns(ctx): |
d4fb38f13c79
refactor dns and some other non-net setup
drewp@bigasterisk.com
parents:
23
diff
changeset
|
38 ctx.run(cmd + 'inventory.py dns.py -v', pty=True) |
d4fb38f13c79
refactor dns and some other non-net setup
drewp@bigasterisk.com
parents:
23
diff
changeset
|
39 |
d4fb38f13c79
refactor dns and some other non-net setup
drewp@bigasterisk.com
parents:
23
diff
changeset
|
40 |
d4fb38f13c79
refactor dns and some other non-net setup
drewp@bigasterisk.com
parents:
23
diff
changeset
|
41 @task |
5 | 42 def wireguard(ctx): |
43 ctx.run(cmd + 'inventory.py wireguard.py', pty=True) | |
44 | |
45 | |
3
61945df2a392
updates to work on recent raspbian installs
drewp@bigasterisk.com
parents:
1
diff
changeset
|
46 @task |
8 | 47 def kube(ctx): |
12 | 48 ctx.run(cmd + 'inventory.py kube.py ', pty=True) |
49 | |
8 | 50 |
14 | 51 @task |
52 def sync(ctx): | |
53 ctx.run(cmd + 'inventory.py sync.py ', pty=True) | |
54 | |
8 | 55 |
56 @task | |
16 | 57 def mail(ctx): |
58 ctx.run(cmd + 'inventory.py mail.py -vv', pty=True) | |
59 | |
60 | |
61 @task | |
3
61945df2a392
updates to work on recent raspbian installs
drewp@bigasterisk.com
parents:
1
diff
changeset
|
62 def get_fact(ctx, host='dash', fact='server.LinuxDistribution'): |
8 | 63 ctx.run(cmd + f'{host} -vv fact {fact}', pty=True) |