From 3946b43ad4ee7ac760ee3e23e606ca952581654d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Wed, 4 Sep 2024 15:34:05 +0200 Subject: [PATCH 1/3] Replace flatten jinja filter with list --- CHANGELOG.md | 4 ++++ defaults/main.yml | 2 +- tasks/main.yml | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 46d035e..609b2a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## v1.2.0 + +### Fix +* Replace flatten jinja filter with **list**. ## v1.1.2 diff --git a/defaults/main.yml b/defaults/main.yml index d06c6f9..be9843b 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -11,7 +11,7 @@ # # List of base packages to install. xymon_server__base_packages: - - 'xymon' + - xymon # ]]] # .. envvar:: xymon_server__deploy_state [[[ diff --git a/tasks/main.yml b/tasks/main.yml index 5ce0acb..e8165b6 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -6,7 +6,7 @@ # Server Manage required system packages [[[1 - name: Ensure required packages are in there desired state package: - name: '{{ xymon_server__base_packages | flatten }}' + name: '{{ xymon_server__base_packages | list }}' state: '{{ "present" if (xymon_server__deploy_state == "present") else "absent" }}' install_recommends: False register: server_pkg_result -- 2.39.5 From c84bc060902424ad987ab30c74f7f193819d6377 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Wed, 4 Sep 2024 15:36:27 +0200 Subject: [PATCH 2/3] Call modules with FQCN --- CHANGELOG.md | 1 + tasks/main.yml | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 609b2a9..788b5d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ### Fix * Replace flatten jinja filter with **list**. +* Call module with FQCN. ## v1.1.2 diff --git a/tasks/main.yml b/tasks/main.yml index e8165b6..3b4d92a 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -5,7 +5,7 @@ # Server Manage required system packages [[[1 - name: Ensure required packages are in there desired state - package: + ansible.builtin.package: name: '{{ xymon_server__base_packages | list }}' state: '{{ "present" if (xymon_server__deploy_state == "present") else "absent" }}' install_recommends: False @@ -15,7 +15,7 @@ # Server Manage /etc configuration files [[[1 - name: Ensure /etc directory structure exists - file: + ansible.builtin.file: path: '/etc/xymon/{{ item.path }}' state: directory with_filetree: '{{ xymon_server__etc_src }}' @@ -23,7 +23,7 @@ notify: ['restart xymon server service'] - name: Generate Xymon configuration files - template: + ansible.builtin.template: src: '{{ item.src }}' dest: "/etc/xymon/{{ item.path | replace('.j2','') }}" mode: '{{ item.mode }}' @@ -32,7 +32,7 @@ notify: ['restart xymon server service'] - name: Generate Xymon configuration symlinks - template: + ansible.builtin.template: src: '{{ item.src }}' dest: "/etc/xymon/{{ item.path }}" mode: '{{ item.mode }}' @@ -45,7 +45,7 @@ # Manage service [[[1 - name: Manage Xymon server service - service: + ansible.builtin.service: name: '{{ xymon_server__service_name }}' state: '{{ "started" if (xymon_server__deploy_state == "present" and (xymon_server__service_manage | d(True) | bool)) -- 2.39.5 From 3b57009d31ab70b2db6fe3c04241bbfd10dd1487 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Wed, 4 Sep 2024 16:57:05 +0200 Subject: [PATCH 3/3] Use comment jinja filter with ansible_managed --- CHANGELOG.md | 3 +++ templates/etc/xymon/hosts.cfg.j2 | 6 +++--- templates/etc/xymon/hosts.d/common.cfg.j2 | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 788b5d2..5e6797f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ * Replace flatten jinja filter with **list**. * Call module with FQCN. +### Enhancements +* Use comment jinja filter with ansible_managed to allow multi-lines comment. + ## v1.1.2 ### Enhancements diff --git a/templates/etc/xymon/hosts.cfg.j2 b/templates/etc/xymon/hosts.cfg.j2 index 5db9407..d63382a 100644 --- a/templates/etc/xymon/hosts.cfg.j2 +++ b/templates/etc/xymon/hosts.cfg.j2 @@ -1,4 +1,4 @@ -# {{ ansible_managed }} +# {{ ansible_managed | comment }} # # Master configuration file for Xymon # @@ -20,6 +20,6 @@ #page common Common -#group-except sslcert|bbd|xymond|xymongen|xymonnet|xymonproxy Test⏎ -#include hosts.d/common.cfg⏎ +#group-except sslcert|bbd|xymond|xymongen|xymonnet|xymonproxy Test +#include hosts.d/common.cfg diff --git a/templates/etc/xymon/hosts.d/common.cfg.j2 b/templates/etc/xymon/hosts.d/common.cfg.j2 index b3fa2a3..23ad118 100644 --- a/templates/etc/xymon/hosts.d/common.cfg.j2 +++ b/templates/etc/xymon/hosts.d/common.cfg.j2 @@ -1,4 +1,4 @@ -# {{ ansible_managed }} +# {{ ansible_managed | comment }} #192.168.0.1 www.{{ ansible_domain }} # apt libs SSH apache https://www.{{ ansible_domain }} #192.168.0.2 pxe.{{ ansible_domain }} # apt libs SSH DESCR:PXE CLIENT:deploy -- 2.39.5