From c787398f0fa0a5dfcfc48ca3b5814c529ec93376 Mon Sep 17 00:00:00 2001 From: etgraylog Date: Thu, 9 Jan 2025 13:54:19 -0500 Subject: [PATCH] Enhance conditionals to avoid failure from graylog_full_version being defined without a value. --- tasks/setup-Debian.yml | 12 ++++++------ tasks/setup-RedHat.yml | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tasks/setup-Debian.yml b/tasks/setup-Debian.yml index 130e772..e110e81 100644 --- a/tasks/setup-Debian.yml +++ b/tasks/setup-Debian.yml @@ -26,21 +26,21 @@ - name: "Graylog server package should be installed" apt: - name: "graylog-server{% if graylog_full_version is defined %}={{ graylog_full_version }}{% endif %}" + name: "graylog-server{% if graylog_full_version is not none and graylog_full_version | length > 1 %}={{ graylog_full_version }}{% endif %}" state: "{{ graylog_package_state }}" when: graylog_version is version('5.0', '<') notify: "restart graylog-server" - name: "Graylog Open server package should be installed" apt: - name: "graylog-server{% if graylog_full_version is defined %}={{ graylog_full_version }}{% endif %}" + name: "graylog-server{% if graylog_full_version is not none and graylog_full_version | length > 1 %}={{ graylog_full_version }}{% endif %}" state: "{{ graylog_package_state }}" when: (graylog_install_open_package | bool == true and graylog_install_enterprise_package | bool == false and graylog_version is version('5.0', '>=')) notify: "restart graylog-server" - name: "Graylog Enterprise server package should be installed" apt: - name: "graylog-enterprise{% if graylog_full_version is defined %}={{ graylog_full_version }}{% endif %}" + name: "graylog-enterprise{% if graylog_full_version is not none and graylog_full_version | length > 1 %}={{ graylog_full_version }}{% endif %}" state: "{{ graylog_package_state }}" when: (graylog_install_open_package | bool == false and graylog_install_enterprise_package | bool == true and graylog_version is version('5.0', '>=')) notify: "restart graylog-server" @@ -54,21 +54,21 @@ - name: "Installing graylog-enterprise-plugins" apt: - name: "graylog-enterprise-plugins{% if graylog_full_version is defined %}={{ graylog_full_version }}{% endif %}" + name: "graylog-enterprise-plugins{% if graylog_full_version is not none and graylog_full_version | length > 1 %}={{ graylog_full_version }}{% endif %}" state: "{{ graylog_package_state }}" when: (graylog_install_enterprise_plugins | bool == true and graylog_version is version('5.0', '<')) notify: restart graylog-server - name: "Installing graylog-integrations-plugins" apt: - name: "graylog-integrations-plugins{% if graylog_full_version is defined %}={{ graylog_full_version }}{% endif %}" + name: "graylog-integrations-plugins{% if graylog_full_version is not none and graylog_full_version | length > 1 %}={{ graylog_full_version }}{% endif %}" state: "{{ graylog_package_state }}" when: (graylog_install_integrations_plugins | bool == true and graylog_version is version('5.0', '<')) notify: restart graylog-server - name: "Installing graylog-enterprise-integrations-plugins" apt: - name: "graylog-enterprise-integrations-plugins{% if graylog_full_version is defined %}={{ graylog_full_version }}{% endif %}" + name: "graylog-enterprise-integrations-plugins{% if graylog_full_version is not none and graylog_full_version | length > 1 %}={{ graylog_full_version }}{% endif %}" state: "{{ graylog_package_state }}" when: (graylog_install_enterprise_integrations_plugins | bool == true and graylog_version is version('5.0', '<')) notify: restart graylog-server diff --git a/tasks/setup-RedHat.yml b/tasks/setup-RedHat.yml index 2dedad4..75fe48d 100644 --- a/tasks/setup-RedHat.yml +++ b/tasks/setup-RedHat.yml @@ -10,42 +10,42 @@ - name: "Graylog server should be installed" yum: - name: "graylog-server{% if graylog_full_version is defined %}-{{ graylog_full_version }}{% endif %}" + name: "graylog-server{% if graylog_full_version is not none and graylog_full_version | length > 1 %}-{{ graylog_full_version }}{% endif %}" state: "{{ graylog_package_state }}" when: graylog_version is version('5.0', '<') notify: "restart graylog-server" - name: "Graylog Open server package should be installed" yum: - name: "graylog-server{% if graylog_full_version is defined %}-{{ graylog_full_version }}{% endif %}" + name: "graylog-server{% if graylog_full_version is not none and graylog_full_version | length > 1 %}-{{ graylog_full_version }}{% endif %}" state: "{{ graylog_package_state }}" when: (graylog_install_open_package | bool == true and graylog_install_enterprise_package | bool == false and graylog_version is version('5.0', '>=')) notify: "restart graylog-server" - name: "Graylog Enterprise server package should be installed" yum: - name: "graylog-enterprise{% if graylog_full_version is defined %}-{{ graylog_full_version }}{% endif %}" + name: "graylog-enterprise{% if graylog_full_version is not none and graylog_full_version | length > 1 %}-{{ graylog_full_version }}{% endif %}" state: "{{ graylog_package_state }}" when: (graylog_install_open_package | bool == false and graylog_install_enterprise_package | bool == true and graylog_version is version('5.0', '>=')) notify: "restart graylog-server" - name: "Installing graylog-enterprise-plugins" yum: - name: "graylog-enterprise-plugins{% if graylog_full_version is defined %}-{{ graylog_full_version }}{% endif %}" + name: "graylog-enterprise-plugins{% if graylog_full_version is not none and graylog_full_version | length > 1 %}-{{ graylog_full_version }}{% endif %}" state: "{{ graylog_package_state }}" when: (graylog_install_enterprise_plugins | bool == true and graylog_version is version('5.0', '<')) notify: restart graylog-server - name: "Installing graylog-integrations-plugins" yum: - name: "graylog-integrations-plugins{% if graylog_full_version is defined %}-{{ graylog_full_version }}{% endif %}" + name: "graylog-integrations-plugins{% if graylog_full_version is not none and graylog_full_version | length > 1 %}-{{ graylog_full_version }}{% endif %}" state: "{{ graylog_package_state }}" when: (graylog_install_integrations_plugins | bool == true and graylog_version is version('5.0', '<')) notify: restart graylog-server - name: "Installing graylog-enterprise-integrations-plugins" yum: - name: "graylog-enterprise-integrations-plugins{% if graylog_full_version is defined %}-{{ graylog_full_version }}{% endif %}" + name: "graylog-enterprise-integrations-plugins{% if graylog_full_version is not none and graylog_full_version | length > 1 %}-{{ graylog_full_version }}{% endif %}" state: "{{ graylog_package_state }}" when: (graylog_install_enterprise_integrations_plugins | bool == true and graylog_version is version('5.0', '<')) notify: restart graylog-server