Mercurial > code > home > repos > infra
annotate tasks.py @ 16:c5784e3d4f8d
mail/postfix setup on prime
author | drewp@bigasterisk.com |
---|---|
date | Sat, 13 Nov 2021 13:51:26 -0800 |
parents | ac4d24d01b68 |
children | 67fc0d4b1859 |
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): |
b6fff51f8676
net.py setup. May not be safe on bang yet
drewp@bigasterisk.com
parents:
5
diff
changeset
|
33 # workaround for https://github.com/Fizzadar/pyinfra/issues/702 |
12 | 34 ctx.run(cmd + 'inventory.py exec -- rm -f /tmp/pyinfra-7ed098bf43cef74d8ab8ea095e4a95c92605c61c', pty=True, warn=True) |
7
b6fff51f8676
net.py setup. May not be safe on bang yet
drewp@bigasterisk.com
parents:
5
diff
changeset
|
35 |
12 | 36 ctx.run(cmd + 'inventory.py net.py', pty=True) |
7
b6fff51f8676
net.py setup. May not be safe on bang yet
drewp@bigasterisk.com
parents:
5
diff
changeset
|
37 |
b6fff51f8676
net.py setup. May not be safe on bang yet
drewp@bigasterisk.com
parents:
5
diff
changeset
|
38 |
b6fff51f8676
net.py setup. May not be safe on bang yet
drewp@bigasterisk.com
parents:
5
diff
changeset
|
39 @task |
5 | 40 def wireguard(ctx): |
41 ctx.run(cmd + 'inventory.py wireguard.py', pty=True) | |
42 | |
43 | |
3
61945df2a392
updates to work on recent raspbian installs
drewp@bigasterisk.com
parents:
1
diff
changeset
|
44 @task |
8 | 45 def kube(ctx): |
12 | 46 ctx.run(cmd + 'inventory.py kube.py ', pty=True) |
47 | |
8 | 48 |
14 | 49 @task |
50 def sync(ctx): | |
51 ctx.run(cmd + 'inventory.py sync.py ', pty=True) | |
52 | |
8 | 53 |
54 @task | |
16 | 55 def mail(ctx): |
56 ctx.run(cmd + 'inventory.py mail.py -vv', pty=True) | |
57 | |
58 | |
59 @task | |
3
61945df2a392
updates to work on recent raspbian installs
drewp@bigasterisk.com
parents:
1
diff
changeset
|
60 def get_fact(ctx, host='dash', fact='server.LinuxDistribution'): |
8 | 61 ctx.run(cmd + f'{host} -vv fact {fact}', pty=True) |