community.general.sysupgrade (8.5.0) — module

Manage OpenBSD system upgrades

| "added in version" 1.1.0 of community.general"

Authors: Andrew Klaus (@precurse)

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

Manage OpenBSD system upgrades using sysupgrade.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Upgrade to latest release
  community.general.sysupgrade:
  register: sysupgrade
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Upgrade to latest snapshot
  community.general.sysupgrade:
    snapshot: true
    installurl: https://cloudflare.cdn.openbsd.org/pub/OpenBSD
  register: sysupgrade
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Reboot to apply upgrade if needed
  ansible.builtin.reboot:
  when: sysupgrade.changed
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Note: Ansible will error when running this way due to how
#   the reboot is forcefully handled by sysupgrade:

- name: Have sysupgrade automatically reboot
  community.general.sysupgrade:
    fetch_only: false
  ignore_errors: true

Inputs

    
force:
    default: false
    description:
    - Force upgrade (for snapshots only).
    type: bool

snapshot:
    default: false
    description:
    - Apply the latest snapshot.
    - Otherwise release will be applied.
    type: bool

fetch_only:
    default: true
    description:
    - Fetch and verify files and create /bsd.upgrade but do not reboot.
    - Set to V(false) if you want sysupgrade to reboot. This will cause Ansible to error,
      as it expects the module to exit gracefully. See the examples.
    type: bool

installurl:
    description:
    - OpenBSD mirror top-level URL for fetching an upgrade.
    - By default, the mirror URL is pulled from /etc/installurl.
    type: str

keep_files:
    default: false
    description:
    - Keep the files under /home/_sysupgrade.
    - By default, the files will be deleted after the upgrade.
    type: bool

Outputs

rc:
  description: The command return code (0 means success).
  returned: always
  type: int
stderr:
  description: Sysupgrade standard error.
  returned: always
  sample: 'sysupgrade: need root privileges'
  type: str
stdout:
  description: Sysupgrade standard output.
  returned: always
  type: str