|
| 1 | +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. |
| 2 | +# SPDX-License-Identifier: Apache-2.0 |
| 3 | + |
| 4 | +--- |
| 5 | +- name: Read installed gateway context |
| 6 | + ansible.builtin.slurp: |
| 7 | + src: /var/lib/openshell-test/gateway.yaml |
| 8 | + register: openshell_test_gateway_metadata |
| 9 | + |
| 10 | +- name: Load installed gateway context |
| 11 | + ansible.builtin.set_fact: |
| 12 | + openshell_test_gateway: "{{ (openshell_test_gateway_metadata.content | b64decode | from_yaml).openshell_test_gateway }}" |
| 13 | + |
| 14 | +- name: Validate installed gateway context |
| 15 | + ansible.builtin.assert: |
| 16 | + that: |
| 17 | + - openshell_test_gateway.service_scope in ['system', 'user'] |
| 18 | + - openshell_test_gateway.config_path is match('^/') |
| 19 | + - openshell_test_gateway.name | length > 0 |
| 20 | + |
| 21 | +- name: Resolve installed OpenShell CLI from PATH |
| 22 | + ansible.builtin.command: |
| 23 | + argv: [/bin/sh, -c, command -v openshell] |
| 24 | + register: openshell_test_cli |
| 25 | + changed_when: false |
| 26 | + |
| 27 | +- name: Check active gateway configuration |
| 28 | + become: true |
| 29 | + ansible.builtin.stat: |
| 30 | + path: "{{ openshell_test_gateway.config_path }}" |
| 31 | + register: openshell_test_gateway_config |
| 32 | + |
| 33 | +- name: Require active gateway configuration |
| 34 | + ansible.builtin.assert: |
| 35 | + that: [openshell_test_gateway_config.stat.isreg | default(false)] |
| 36 | + |
| 37 | +- name: Resolve gateway service environment |
| 38 | + ansible.builtin.set_fact: |
| 39 | + openshell_test_gateway_service_environment: |
| 40 | + HOME: "{{ openshell_test_gateway.service_home }}" |
| 41 | + XDG_RUNTIME_DIR: "/run/user/{{ openshell_test_gateway.service_uid }}" |
| 42 | + DBUS_SESSION_BUS_ADDRESS: "unix:path=/run/user/{{ openshell_test_gateway.service_uid }}/bus" |
0 commit comments