Skip to content

Commit 20edae8

Browse files
committed
trm alias
1 parent 1ef1b56 commit 20edae8

4 files changed

Lines changed: 44 additions & 1 deletion

File tree

ansible/roles/base/tasks/main.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,35 @@
4646
mode: "0755"
4747
remote_src: true
4848

49+
- name: Inspect existing terrariumctl shorthand alias
50+
ansible.builtin.stat:
51+
path: /usr/local/bin/trm
52+
follow: false
53+
register: terrarium_trm_alias
54+
55+
- name: Install terrariumctl shorthand alias
56+
ansible.builtin.file:
57+
src: /usr/local/bin/terrariumctl
58+
dest: /usr/local/bin/trm
59+
state: link
60+
force: true
61+
when: >-
62+
not terrarium_trm_alias.stat.exists
63+
or (
64+
terrarium_trm_alias.stat.islnk | default(false)
65+
and terrarium_trm_alias.stat.lnk_source == "/usr/local/bin/terrariumctl"
66+
)
67+
68+
- name: Warn when terrariumctl shorthand alias is unavailable
69+
ansible.builtin.debug:
70+
msg: /usr/local/bin/trm already exists and is not managed by Terrarium; leaving it untouched.
71+
when: >-
72+
terrarium_trm_alias.stat.exists
73+
and not (
74+
terrarium_trm_alias.stat.islnk | default(false)
75+
and terrarium_trm_alias.stat.lnk_source == "/usr/local/bin/terrariumctl"
76+
)
77+
4978
- name: Ensure root has a local password for Cockpit
5079
ansible.builtin.user:
5180
name: root

docs/reference/terrariumctl.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# terrariumctl
22

3-
`terrariumctl` is the main Terrarium control surface. It handles install, status, reconfiguration, proxy sync, IDP sync, backup export, and restore.
3+
`terrariumctl` is the main Terrarium control surface. It handles install, status, reconfiguration, proxy sync, IDP sync, backup export, and restore. Installed hosts also provide `trm` as a shorthand alias for the same command.
44

55
## Top-Level Commands
66

tests/ansible-base.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,19 @@ describe("config store reconciliation", () => {
3636
});
3737
});
3838

39+
describe("terrariumctl install alias", () => {
40+
test("installs trm as a shorthand symlink to the installed CLI", () => {
41+
const tasks = readFileSync(join(repoRoot, "ansible/roles/base/tasks/main.yml"), "utf8");
42+
43+
expect(tasks).toContain("Inspect existing terrariumctl shorthand alias");
44+
expect(tasks).toContain("Install terrariumctl shorthand alias");
45+
expect(tasks).toContain("src: /usr/local/bin/terrariumctl");
46+
expect(tasks).toContain("dest: /usr/local/bin/trm");
47+
expect(tasks).toContain("state: link");
48+
expect(tasks).toContain("leaving it untouched");
49+
});
50+
});
51+
3952
describe("terrariumctl mount defaults", () => {
4053
test("disable client-side CIFS permission checks for single-credential managed mounts", () => {
4154
const mount = readFileSync(join(repoRoot, "scripts/ctl/mount.ts"), "utf8");

tests/integration/scenarios/common.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ export async function installTerrarium(context: IntegrationContext, host: Manage
243243
].join(" && ");
244244
await ssh.execDetached(installCommand, remoteScriptPath, remoteStatusPath, remoteLogPath);
245245
await waitForDetachedCommand(ssh, remoteStatusPath, remoteLogPath, 45 * 60 * 1000);
246+
await ssh.exec("test -L /usr/local/bin/trm && /usr/local/bin/trm status >/dev/null");
246247
}
247248

248249
/** Returns the local ZITADEL bootstrap credentials from an installed Terrarium host. */

0 commit comments

Comments
 (0)