Mercurial > code > home > repos > infra
annotate tasks.py @ 8:226f3c8419b2
kube setup
author | drewp@bigasterisk.com |
---|---|
date | Thu, 11 Nov 2021 22:20:46 -0800 |
parents | b6fff51f8676 |
children | 15c5ce7c74b5 |
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 | |
7
b6fff51f8676
net.py setup. May not be safe on bang yet
drewp@bigasterisk.com
parents:
5
diff
changeset
|
22 def net(ctx): |
b6fff51f8676
net.py setup. May not be safe on bang yet
drewp@bigasterisk.com
parents:
5
diff
changeset
|
23 # workaround for https://github.com/Fizzadar/pyinfra/issues/702 |
b6fff51f8676
net.py setup. May not be safe on bang yet
drewp@bigasterisk.com
parents:
5
diff
changeset
|
24 ctx.run(cmd + '-vv inventory.py exec -- rm -f /tmp/pyinfra-7ed098bf43cef74d8ab8ea095e4a95c92605c61c', pty=True) |
b6fff51f8676
net.py setup. May not be safe on bang yet
drewp@bigasterisk.com
parents:
5
diff
changeset
|
25 |
b6fff51f8676
net.py setup. May not be safe on bang yet
drewp@bigasterisk.com
parents:
5
diff
changeset
|
26 ctx.run(cmd + '-vv inventory.py net.py --limit slash ', pty=True) |
b6fff51f8676
net.py setup. May not be safe on bang yet
drewp@bigasterisk.com
parents:
5
diff
changeset
|
27 |
b6fff51f8676
net.py setup. May not be safe on bang yet
drewp@bigasterisk.com
parents:
5
diff
changeset
|
28 |
b6fff51f8676
net.py setup. May not be safe on bang yet
drewp@bigasterisk.com
parents:
5
diff
changeset
|
29 @task |
5 | 30 def wireguard(ctx): |
31 ctx.run(cmd + 'inventory.py wireguard.py', pty=True) | |
32 | |
33 | |
3
61945df2a392
updates to work on recent raspbian installs
drewp@bigasterisk.com
parents:
1
diff
changeset
|
34 @task |
8 | 35 def kube(ctx): |
36 ctx.run(cmd + 'inventory.py kube.py --limit dash --limit garage', pty=True) | |
37 | |
38 | |
39 @task | |
3
61945df2a392
updates to work on recent raspbian installs
drewp@bigasterisk.com
parents:
1
diff
changeset
|
40 def get_fact(ctx, host='dash', fact='server.LinuxDistribution'): |
8 | 41 ctx.run(cmd + f'{host} -vv fact {fact}', pty=True) |