linuxfabrik.lfops.uptimerobot_mwindow_info¶
List UptimeRobot maintenance windows
Synopsis¶
- Calls
getMWindowson the UptimeRobot v2 API and returns every maintenance window on the account. - Enum-coded fields are translated to human-readable labels -
typebecomesonce/daily/weekly/monthly,statusbecomespaused/active, and for weekly windowsvalueis decoded from the dash-joined day-IDs (e.g.1-3-5) back into labels (mon-wed-fri). Monthly day-of-month numbers are passed through unchanged. - Read-only; the module always reports
changed=falseand is safe to run in check mode.
Available since LFOps 6.0.2.
Optional Parameters¶
api_key
- UptimeRobot API key. See
uptimerobot_monitorfor the resolution order. - Type: String.
api_key_file
- Path to a file whose first line is the UptimeRobot API key. Tilde-expanded.
- Type: String.
- Default:
~/.uptimerobot
friendly_name
- Filter the returned list to the maintenance window whose
friendly_nameis an exact match for this value. The result is still a list (length 0 or 1) for shape stability. - Type: String.
Examples¶
# 1) List every maintenance window on the account.
- name: 'Capture all maintenance windows'
linuxfabrik.lfops.uptimerobot_mwindow_info:
register: 'ur_mwindows'
- ansible.builtin.debug:
msg: '{{ ur_mwindows.mwindows | length }} maintenance windows defined'
# 2) Look up a single window by its friendly_name (auto-synthesised
# `<type> [<value>] <start_time>-<end_time>` form is fine).
- linuxfabrik.lfops.uptimerobot_mwindow_info:
friendly_name: 'weekly mon 03:30-05:30'
register: 'ur_window'
- ansible.builtin.debug:
msg: 'Window status: {{ ur_window.mwindows[0].status }}'
# 3) Inventory check: list all PAUSED windows (e.g. before kicking off a
# deployment that needs them re-activated).
- linuxfabrik.lfops.uptimerobot_mwindow_info:
register: 'ur_all'
- ansible.builtin.debug:
msg: >-
Paused windows: {{
ur_all.mwindows
| selectattr("status", "equalto", "paused")
| map(attribute="friendly_name")
| list
}}
Return Values¶
debug
- Diagnostic information about the API call. Stable enough to assert against, not stable enough to be load-bearing.
- Type: Dictionary.
- Returned: always.
-
Sample:
yaml count: 4 operation: list
mwindows
- List of maintenance window dicts. Empty list when nothing matched.
- Type: List.
- Returned: always.
Authors¶
- Linuxfabrik GmbH, Zurich, Switzerland (info (at) linuxfabrik (dot) ch)