From 146bdf53875df5d6b04f0a9dc365b4bdd5294029 Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Wed, 11 Nov 2026 15:08:48 -0500 Subject: [PATCH 1/4] feat: add Fleet AO smoke service demo --- docs/_data/demos.yml | 17 +++++++++++++++++ linux/README.md | 1 + linux/docs/linux-fleet-ao-smoke.md | 11 +++++++++++ linux/fleet_ao_smoke.yml | 27 +++++++++++++++++++++++++++ tests/test_fleet_ao_smoke.sh | 7 +++++++ 5 files changed, 63 insertions(+) create mode 100644 linux/docs/linux-fleet-ao-smoke.md create mode 100644 linux/fleet_ao_smoke.yml create mode 100644 tests/test_fleet_ao_smoke.sh diff --git a/docs/_data/demos.yml b/docs/_data/demos.yml index a690e62b5..c1842c1fc 100644 --- a/docs/_data/demos.yml +++ b/docs/_data/demos.yml @@ -477,6 +477,23 @@ playbooks: 1 github_path: linux/run_script.yml +- slug: linux-fleet-ao-smoke + readme_path: linux/docs/linux-fleet-ao-smoke.md + url: /demos/linux-fleet-ao-smoke/ + title: "Fleet AO Smoke Service" + category: linux + status: active + tags: + - Playbook + - Automation Orchestrator + thumbnail: + gradient: "linear-gradient(135deg, #d13438 0%, #7a0000 100%)" + icon: "🐧" + blurb: "Start and verify the short-lived service used by the Fleet Automation Orchestrator integration." + stats: + playbooks: 1 + github_path: linux/fleet_ao_smoke.yml + - slug: linux-install-ssh-key readme_path: linux/docs/linux-install-ssh-key.md url: /demos/linux-install-ssh-key/ diff --git a/linux/README.md b/linux/README.md index 4837f254b..ee267f593 100644 --- a/linux/README.md +++ b/linux/README.md @@ -32,6 +32,7 @@ This category of demos shows examples of linux operations and management with An | [**Start Service**](docs/linux-start-service.md) | Start a named service on a target system. | | [**Stop Service**](docs/linux-stop-service.md) | Stop a named service on a target system. | | [**Run Shell Script**](docs/linux-run-shell-script.md) | Execute a shell script or command across a group of systems as root, with RBAC-controlled access. | +| [**Fleet AO Smoke Service**](docs/linux-fleet-ao-smoke.md) | Start and verify the bounded transient service used by the Fleet Automation Orchestrator integration. | | [**Add SSH Public Key**](docs/linux-install-ssh-key.md) | Add an SSH public key to a Linux user's authorized_keys file on one or more hosts. | | [**Fact Scan**](docs/linux-fact-scan.md) | Run a fact, package, and service scan against a system and store results in the AAP fact cache. | | [**Podman Webserver**](docs/linux-podman-webserver.md) | Install and run an Apache webserver in a Podman container with a configurable home page message. | diff --git a/linux/docs/linux-fleet-ao-smoke.md b/linux/docs/linux-fleet-ao-smoke.md new file mode 100644 index 000000000..f2c3a6a1d --- /dev/null +++ b/linux/docs/linux-fleet-ao-smoke.md @@ -0,0 +1,11 @@ +# Fleet Automation Orchestrator smoke service + +`fleet_ao_smoke.yml` provides the visible state change used by the +`aap-demo` Fleet and Automation Orchestrator integration. It starts +`aap-demo-fleet-smoke.service` on the selected Linux host, then verifies that +the unit is active. The transient service sleeps for five minutes and systemd +collects it afterwards. + +Run it only through the Fleet-scoped AAP job template created by the +integration. The playbook needs a host with systemd and permission to use +`systemd-run`. diff --git a/linux/fleet_ao_smoke.yml b/linux/fleet_ao_smoke.yml new file mode 100644 index 000000000..3e9d8737d --- /dev/null +++ b/linux/fleet_ao_smoke.yml @@ -0,0 +1,27 @@ +--- +# A bounded, visible state change for the aap-demo Fleet/AO integration. +# The transient unit is collected by systemd after its five-minute sleep. +- name: Start a short-lived Fleet AO demo service + hosts: "{{ _hosts | default('all') }}" + become: true + gather_facts: false + + tasks: + - name: Check whether the transient demo service is already active + ansible.builtin.command: + cmd: systemctl is-active --quiet aap-demo-fleet-smoke.service + register: fleet_ao_service_state + changed_when: false + failed_when: false + + - name: Run the temporary Fleet AO demo service + ansible.builtin.command: + cmd: >- + systemd-run --collect --unit=aap-demo-fleet-smoke /usr/bin/sleep 300 + when: fleet_ao_service_state.rc != 0 + changed_when: true + + - name: Verify transient Fleet AO demo service is active + ansible.builtin.command: + cmd: systemctl is-active --quiet aap-demo-fleet-smoke.service + changed_when: false diff --git a/tests/test_fleet_ao_smoke.sh b/tests/test_fleet_ao_smoke.sh new file mode 100644 index 000000000..8a509f72b --- /dev/null +++ b/tests/test_fleet_ao_smoke.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +set -euo pipefail + +playbook=linux/fleet_ao_smoke.yml +test -f "$playbook" +rg -F 'systemd-run --collect --unit=aap-demo-fleet-smoke /usr/bin/sleep 300' "$playbook" +rg -F 'systemctl is-active --quiet aap-demo-fleet-smoke.service' "$playbook" From 14e72394f6b9158f12a42439e82db8c4042ebd2e Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Thu, 12 Nov 2026 10:20:52 -0500 Subject: [PATCH 2/4] Add Fleet smoke service job template --- linux/docs/linux-fleet-ao-smoke.md | 32 +++++++++++++++++++++++++++--- linux/setup.yml | 23 +++++++++++++++++++++ tests/test_fleet_ao_smoke.sh | 7 ------- 3 files changed, 52 insertions(+), 10 deletions(-) delete mode 100644 tests/test_fleet_ao_smoke.sh diff --git a/linux/docs/linux-fleet-ao-smoke.md b/linux/docs/linux-fleet-ao-smoke.md index f2c3a6a1d..896e0c931 100644 --- a/linux/docs/linux-fleet-ao-smoke.md +++ b/linux/docs/linux-fleet-ao-smoke.md @@ -6,6 +6,32 @@ the unit is active. The transient service sleeps for five minutes and systemd collects it afterwards. -Run it only through the Fleet-scoped AAP job template created by the -integration. The playbook needs a host with systemd and permission to use -`systemd-run`. +Product Demos setup creates a generic job template. The `aap-demo` integration +separately provisions its Fleet-scoped template, inventory, and Automation +Orchestrator workflow. + +## Prerequisites + +- Linux hosts with systemd and privilege to run `systemd-run`. +- For the generic template, hosts in **Ansible Product Demos Inventory** and SSH access through **APD Machine Credential**. + +## Survey prompts + +| Prompt | Variable | Type | Required | +|--------|----------|------|----------| +| Server Name or Pattern | `_hosts` | text | Yes | + +## Job templates + +| Template | Playbook | Description | +|----------|----------|-------------| +| LINUX ǀ Fleet AO Smoke Service | [`linux/fleet_ao_smoke.yml`](../fleet_ao_smoke.yml) | Starts and verifies the transient service on selected hosts | + +The playbook defaults to all hosts in its inventory when `_hosts` is omitted; +the generic template requires the survey response. Use a tightly scoped inventory +for other templates that do not provide `_hosts`. + +If a previous unit remains failed or uncollected, inspect it with +`systemctl status aap-demo-fleet-smoke.service` and clear the failed state with +`sudo systemctl reset-failed aap-demo-fleet-smoke.service` before retrying. If +the unit still exists, stop it with `sudo systemctl stop aap-demo-fleet-smoke.service`. diff --git a/linux/setup.yml b/linux/setup.yml index 5168169af..ea3d488ad 100644 --- a/linux/setup.yml +++ b/linux/setup.yml @@ -252,6 +252,29 @@ controller_templates: variable: service_name required: true + - name: "LINUX | Fleet AO Smoke Service" + labels: + - linux + job_type: run + inventory: Ansible Product Demos Inventory + project: "Ansible Product Demos" + playbook: "linux/fleet_ao_smoke.yml" + notification_templates_started: Telemetry + notification_templates_success: Telemetry + notification_templates_error: Telemetry + use_fact_cache: true + credentials: + - APD Machine Credential + survey_enabled: true + survey: + name: '' + description: '' + spec: + - question_name: Server Name or Pattern + type: text + variable: _hosts + required: true + - name: "LINUX | Stop Service" labels: - linux diff --git a/tests/test_fleet_ao_smoke.sh b/tests/test_fleet_ao_smoke.sh deleted file mode 100644 index 8a509f72b..000000000 --- a/tests/test_fleet_ao_smoke.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -playbook=linux/fleet_ao_smoke.yml -test -f "$playbook" -rg -F 'systemd-run --collect --unit=aap-demo-fleet-smoke /usr/bin/sleep 300' "$playbook" -rg -F 'systemctl is-active --quiet aap-demo-fleet-smoke.service' "$playbook" From 35e8dd7991b3b50e834c3b816fb1977bf4f840bf Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Thu, 12 Nov 2026 10:28:41 -0500 Subject: [PATCH 3/4] Require explicit Fleet smoke host selection --- linux/docs/linux-fleet-ao-smoke.md | 5 ++--- linux/fleet_ao_smoke.yml | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/linux/docs/linux-fleet-ao-smoke.md b/linux/docs/linux-fleet-ao-smoke.md index 896e0c931..3939bde58 100644 --- a/linux/docs/linux-fleet-ao-smoke.md +++ b/linux/docs/linux-fleet-ao-smoke.md @@ -27,9 +27,8 @@ Orchestrator workflow. |----------|----------|-------------| | LINUX ǀ Fleet AO Smoke Service | [`linux/fleet_ao_smoke.yml`](../fleet_ao_smoke.yml) | Starts and verifies the transient service on selected hosts | -The playbook defaults to all hosts in its inventory when `_hosts` is omitted; -the generic template requires the survey response. Use a tightly scoped inventory -for other templates that do not provide `_hosts`. +The generic template requires a host pattern through its survey. Other job +templates must also provide `_hosts` to select their target hosts. If a previous unit remains failed or uncollected, inspect it with `systemctl status aap-demo-fleet-smoke.service` and clear the failed state with diff --git a/linux/fleet_ao_smoke.yml b/linux/fleet_ao_smoke.yml index 3e9d8737d..8373f41a0 100644 --- a/linux/fleet_ao_smoke.yml +++ b/linux/fleet_ao_smoke.yml @@ -2,7 +2,7 @@ # A bounded, visible state change for the aap-demo Fleet/AO integration. # The transient unit is collected by systemd after its five-minute sleep. - name: Start a short-lived Fleet AO demo service - hosts: "{{ _hosts | default('all') }}" + hosts: "{{ _hosts | default(omit) }}" become: true gather_facts: false From b6633296231b0241e34538c0b9faf90d0ec924f3 Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Fri, 13 Nov 2026 10:54:15 -0500 Subject: [PATCH 4/4] Fix Fleet smoke playbook lint --- linux/fleet_ao_smoke.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/linux/fleet_ao_smoke.yml b/linux/fleet_ao_smoke.yml index 8373f41a0..4d19f9ff8 100644 --- a/linux/fleet_ao_smoke.yml +++ b/linux/fleet_ao_smoke.yml @@ -7,7 +7,8 @@ gather_facts: false tasks: - - name: Check whether the transient demo service is already active + # is-active returns a useful nonzero status when the transient unit is absent. + - name: Check whether the transient demo service is already active # noqa: command-instead-of-module ansible.builtin.command: cmd: systemctl is-active --quiet aap-demo-fleet-smoke.service register: fleet_ao_service_state @@ -21,7 +22,8 @@ when: fleet_ao_service_state.rc != 0 changed_when: true - - name: Verify transient Fleet AO demo service is active + # Verify with the same active-state check used before starting the unit. + - name: Verify transient Fleet AO demo service is active # noqa: command-instead-of-module ansible.builtin.command: cmd: systemctl is-active --quiet aap-demo-fleet-smoke.service changed_when: false