From 885d40c064b9369cf4804eb0c9a21fec08fd4710 Mon Sep 17 00:00:00 2001 From: jerick Date: Fri, 13 Mar 2026 08:49:58 -0400 Subject: [PATCH] logic for local connection if the jenkins server is the target --- inventory/inventory.proxmox.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/inventory/inventory.proxmox.yml b/inventory/inventory.proxmox.yml index 16f5c4e..4e79041 100644 --- a/inventory/inventory.proxmox.yml +++ b/inventory/inventory.proxmox.yml @@ -22,5 +22,8 @@ groups: zabbix_targets: "'zabbix' in (proxmox_tags | default([]))" compose: - ansible_host: name + '.lan' + # If this host's Proxmox name matches the controller's hostname, connect locally + # instead of SSHing back into the machine running the playbook + ansible_connection: "'local' if name == lookup('pipe', 'hostname') else 'ssh'" + ansible_host: "lookup('pipe', 'hostname') if name == lookup('pipe', 'hostname') else name + '.lan'" ansible_user: 'jenkins'