-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtasks.py
41 lines (29 loc) · 879 Bytes
/
tasks.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from invoke import task
@task
def clean(ctx):
res = ctx.run(
"docker ps -a | egrep '(veos|spine|leaf)' | awk '{print($1)}'", hide=True
)
if res.ok and len(res.stdout) > 0:
print("Deleting vrnetlab containers...")
ctx.run(
"xargs docker rm -f <<EOF\n{cont_uuids}\nEOF".format(cont_uuids=res.stdout)
)
print("\nAll vrnetlab containers have been removed.")
else:
print("Did not find any vrnetlab containers.")
@task
def deploy_lab(ctx):
ctx.run("cd ansible && ansible-playbook provision_lab.yml")
@task
def configure_lab(ctx):
ctx.run("cd ansible && ansible-playbook configure_lab.yml")
@task
def precheck(ctx):
ctx.run("pre-commit run")
@task
def validate_lab(ctx):
ctx.run("cd ansible && ansible-playbook validate_lab.yml")
@task
def test(ctx):
ctx.run("pytest tests -v")