This repository has been archived on 2023-02-05. You can view files and clone it, but cannot push or open issues or pull requests.
pyinfra-linkding/remove.py
2021-11-20 11:51:50 +09:00

26 lines
695 B
Python

from pyinfra import host
from pyinfra.operations import server, files, systemd
systemd.service(
name='Disable systemd service',
service=f"{host.data.app['name']}.service",
running=False,
enabled=False,
)
if host.fact.file(f"{host.data.undocker['cache']}/{host.data.app['name']}.tar"):
server.shell(
name='Remove Docker image',
chdir=host.data.undocker['cache'],
commands=[
f"rm {host.data.app['name']}.tar"
],
)
if host.fact.directory(f"{host.data.undocker['app_dst']}"):
server.shell(
name='Remove undocker destination',
commands=[
f"rm -rf {host.data.undocker['app_dst']}"
],
)