Mercurial > code > home > repos > infra
changeset 205:826db3c40fa7
whitespace/etc
author | drewp@bigasterisk.com |
---|---|
date | Fri, 07 Jul 2023 16:11:41 -0700 |
parents | ad6e997fd323 |
children | da0fd5a2ac33 |
files | .flake8 packages.py tasks.py templates/kube/coredns.yaml |
diffstat | 4 files changed, 62 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/.flake8 Fri Jun 30 22:40:27 2023 -0700 +++ b/.flake8 Fri Jul 07 16:11:41 2023 -0700 @@ -1,3 +1,3 @@ [flake8] ignore=W504 -max-line-length=130 \ No newline at end of file +max-line-length=130
--- a/packages.py Fri Jun 30 22:40:27 2023 -0700 +++ b/packages.py Fri Jul 07 16:11:41 2023 -0700 @@ -1,6 +1,7 @@ from pyinfra import host from pyinfra.facts.server import LinuxDistribution from pyinfra.operations import apt, files, server, systemd + import package_lists is_pi = host.get_fact(LinuxDistribution)['name'] in ['Debian', 'Raspbian GNU/Linux'] @@ -31,9 +32,11 @@ "corepack prepare 'pnpm@8.6.3' --activate", ]) + def pdm(): server.shell(["pip install 'pdm==2.7.4'"]) + def proper_locate(): apt.packages(packages='mlocate', present=False) if not is_pi and host.name not in ['prime', 'pipe']: @@ -44,13 +47,13 @@ if host.name in ['pipe', 'prime'] or is_pi: apt.packages(packages=['mandb'], present=False) + def no_unwanted_services(): systemd.service(service='nginx', enabled=False, running=False) kw = dict(latest=True) - apt.packages(packages=package_lists.setup, **kw) if not is_pi: @@ -63,11 +66,10 @@ proper_locate() proper_man() - apt.packages(packages=package_lists.general, **kw) apt.packages(packages=package_lists.debug, **kw) -if host.name in ["bang" ,'ditto']: +if host.name in ["bang", 'ditto']: apt.packages(packages=package_lists.for_bang_ditto, **kw) if host.name == "pipe": @@ -88,11 +90,11 @@ if not is_pi: apt.packages(packages=package_lists.non_pi, **kw) - if host.name != 'prime': # couldn't get prime to install a newer version than 18.7.0 + if host.name != 'prime': # couldn't get prime to install a newer version than 18.7.0 nodejs() else: # move to another file? - files.template(src="templates/pigpiod.service.j2", dest=f"/etc/systemd/system/pigpiod.service") + files.template(src="templates/pigpiod.service.j2", dest="/etc/systemd/system/pigpiod.service") systemd.service(service='pigpiod', daemon_reload=True, enabled=True) -no_unwanted_services() \ No newline at end of file +no_unwanted_services()
--- a/tasks.py Fri Jun 30 22:40:27 2023 -0700 +++ b/tasks.py Fri Jul 07 16:11:41 2023 -0700 @@ -7,60 +7,93 @@ cd /my/proj/infra pdm run pyinfra ''' + def _run(ctx, s): ctx.run(cmd + 'inventory.py %s' % s, pty=True, echo=True) @task -def users(ctx): _run(ctx, 'users.py') +def users(ctx): + _run(ctx, 'users.py') + @task -def ssh(ctx): _run(ctx, 'ssh.py') +def ssh(ctx): + _run(ctx, 'ssh.py') + @task -def system(ctx): _run(ctx, 'system.py') +def system(ctx): + _run(ctx, 'system.py') + @task -def apt(ctx): _run(ctx, 'apt.py') +def apt(ctx): + _run(ctx, 'apt.py') + @task -def packages(ctx): _run(ctx, 'packages.py') +def packages(ctx): + _run(ctx, 'packages.py') + @task -def net(ctx): _run(ctx, 'net.py') +def net(ctx): + _run(ctx, 'net.py') + @task -def dns(ctx): _run(ctx, 'dns.py') +def dns(ctx): + _run(ctx, 'dns.py') + @task -def dns_check(ctx): _run(ctx, 'dns_check.py -v') +def dns_check(ctx): + _run(ctx, 'dns_check.py -v') + @task -def dns_k8s_check(ctx): ctx.run('env/bin/python dns_k8s_check.py', pty=True) +def dns_k8s_check(ctx): + ctx.run('env/bin/python dns_k8s_check.py', pty=True) + @task -def wireguard(ctx): _run(ctx, 'wireguard.py') +def wireguard(ctx): + _run(ctx, 'wireguard.py') + @task -def kube(ctx): _run(ctx, 'kube.py') +def kube(ctx): + _run(ctx, 'kube.py') + @task -def kube_bang(ctx): _run(ctx, 'kube.py --limit bang') +def kube_bang(ctx): + _run(ctx, 'kube.py --limit bang') + @task -def sync(ctx): _run(ctx, 'sync.py') +def sync(ctx): + _run(ctx, 'sync.py') + @task -def mail(ctx): _run(ctx, 'mail.py') +def mail(ctx): + _run(ctx, 'mail.py') + @task -def home(ctx): _run(ctx, 'home.py') +def home(ctx): + _run(ctx, 'home.py') + @task -def pipe(ctx): ctx.run(cmd + 'inventory.py pipe.py --limit pipe', pty=True) +def pipe(ctx): + ctx.run(cmd + 'inventory.py pipe.py --limit pipe', pty=True) + @task -def multikube(ctx): # danger- wipes previous k3s +def multikube(ctx): # danger- wipes previous k3s from multikube_config import server_node, nodes ctx.run(cmd + 'inventory.py multikube_wipe.py', pty=True) ctx.run(cmd + f'inventory.py multikube.py --limit {server_node}', pty=True)