From c65828ef87626faabf78734ea288b5889b128589 Mon Sep 17 00:00:00 2001 From: jerick Date: Sat, 14 Mar 2026 23:46:12 -0400 Subject: [PATCH] jenkins localhost fix and ubuntu version fix --- inventory/host_vars/jenkins.yml | 5 +++++ inventory/inventory.proxmox.yml | 5 +---- roles/zabbix_agent/tasks/main.yml | 7 ++++++- 3 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 inventory/host_vars/jenkins.yml diff --git a/inventory/host_vars/jenkins.yml b/inventory/host_vars/jenkins.yml new file mode 100644 index 0000000..cc9ec89 --- /dev/null +++ b/inventory/host_vars/jenkins.yml @@ -0,0 +1,5 @@ +--- +# The Jenkins controller installs the agent on itself locally +# rather than SSHing back into the machine running the playbook +ansible_connection: local +ansible_host: localhost diff --git a/inventory/inventory.proxmox.yml b/inventory/inventory.proxmox.yml index 4e79041..16f5c4e 100644 --- a/inventory/inventory.proxmox.yml +++ b/inventory/inventory.proxmox.yml @@ -22,8 +22,5 @@ groups: zabbix_targets: "'zabbix' in (proxmox_tags | default([]))" compose: - # 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_host: name + '.lan' ansible_user: 'jenkins' diff --git a/roles/zabbix_agent/tasks/main.yml b/roles/zabbix_agent/tasks/main.yml index e8c2ac0..0c578df 100644 --- a/roles/zabbix_agent/tasks/main.yml +++ b/roles/zabbix_agent/tasks/main.yml @@ -1,8 +1,13 @@ --- # Install tasks +- name: Resolve supported Ubuntu version for Zabbix repository + ansible.builtin.set_fact: + zabbix_ubuntu_repo_version: "{{ ansible_distribution_version if ansible_distribution_version is version('25.00', '<') else '24.04' }}" + when: zabbix_state == 'present' + - name: Download Zabbix repository package ansible.builtin.get_url: - url: "https://repo.zabbix.com/zabbix/{{ zabbix_version }}/ubuntu/pool/main/z/zabbix-release/zabbix-release_{{ zabbix_release }}+ubuntu{{ ansible_distribution_version }}_all.deb" + url: "https://repo.zabbix.com/zabbix/{{ zabbix_version }}/ubuntu/pool/main/z/zabbix-release/zabbix-release_{{ zabbix_release }}+ubuntu{{ zabbix_ubuntu_repo_version }}_all.deb" dest: /tmp/zabbix-release.deb mode: '0644' when: zabbix_state == 'present'