Document the notebook format and provide SSH-key, hardening-check, and package-install examples with inventory and credential exclusions.
1.8 KiB
1.8 KiB
title, params
| title | params | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Install and enable a package |
|
Install and enable {{package}}
For Debian hosts using apt and systemd. Check the package/service pairing before running; installing packages can start services and expose network ports. Existing apt indexes must be available. Runs require passwordless sudo and confirmation.
command -v apt-get
command -v systemctl
apt-cache show -- {{package}} > /dev/null
dpkg-query -W -f='${Status}\n' -- {{package}} | grep -qx 'install ok installed'
An absent package is an expected failed check. Proceed with installation only after the repository check succeeds.
if ! dpkg-query -W -f='${Status}\n' -- {{package}} 2>/dev/null | grep -qx 'install ok installed'; then
DEBIAN_FRONTEND=noninteractive apt-get install -y -- {{package}}
fi
systemctl enable --now -- {{service}}
systemctl is-enabled -- {{service}}
systemctl is-active -- {{service}}
:::after{step=enable} The enable command succeeded. Run the final checks and verify application health and firewall policy before directing traffic to {{host}}. :::