This repository has been archived on 2024-07-19. You can view files and clone it, but cannot push or open issues or pull requests.
spadinastan/pyinfra/system_updates.py

21 lines
456 B
Python
Raw Normal View History

"""
Runs Ubuntu system updates.
"""
import pyinfra
def update_ubuntu_packages():
common = {"_sudo": True, "_use_sudo_password": True}
pyinfra.operations.server.shell(
name="Search for system updates", commands=["apt update"], **common
)
pyinfra.operations.server.shell(
name="Apply updates and remove orphaned packages",
2022-11-19 16:42:25 +00:00
commands=["apt upgrade --autoremove -y"],
**common
)
update_ubuntu_packages()