20 lines
456 B
Python
20 lines
456 B
Python
"""
|
|
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",
|
|
commands=["apt upgrade --autoremove -y"],
|
|
**common
|
|
)
|
|
|
|
|
|
update_ubuntu_packages()
|