From df89b4306ffeecb876cefb8ad7c5327e9c004f9b Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Thu, 29 Feb 2024 18:29:00 -0500 Subject: [PATCH] Add loop_control; Fix hostname for containers; Fix Ansible compat; Update baseos collection to 1.0.24 --- galaxy.yml | 2 +- meta/runtime.yml | 2 +- roles/hostname/tasks/main.yml | 30 +++--------------------------- roles/node_status/tasks/main.yml | 2 ++ 4 files changed, 7 insertions(+), 29 deletions(-) diff --git a/galaxy.yml b/galaxy.yml index 561c77e..ee3da91 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -8,7 +8,7 @@ namespace: jchristianh name: baseos # The version of the collection. Must be compatible with semantic versioning -version: 1.0.23 +version: 1.0.24 # The path to the Markdown (.md) readme file. This path is relative to the root of the collection readme: README.md diff --git a/meta/runtime.yml b/meta/runtime.yml index 1e85b01..ce6befd 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -1,2 +1,2 @@ --- -requires_ansible: ">=2.15.0" +requires_ansible: ">=2.14.0" diff --git a/roles/hostname/tasks/main.yml b/roles/hostname/tasks/main.yml index 11e6764..0d132ba 100644 --- a/roles/hostname/tasks/main.yml +++ b/roles/hostname/tasks/main.yml @@ -9,32 +9,8 @@ - "Restart_syslog_{{ ansible_distribution | lower }}_{{ ansible_distribution_major_version }}" rescue: - - name: Ensure hostname package is present - ansible.builtin.package: - name: hostname - state: present - - - name: Set hostname file if running in container - ansible.builtin.set_fact: - hostname_hostname_file: "{{ hostname_hostname_file }}.container" - when: - - ansible_virtualization_type | regex_search("docker|podman|container") - - - name: Add entry into hostname file - ansible.builtin.lineinfile: - path: "{{ hostname_hostname_file }}" - line: "{{ inventory_hostname }}" - state: present - create: true - mode: '0644' - - - name: Update hostname from /etc/hostname - ansible.builtin.command: - cmd: "hostname -F {{ hostname_hostname_file }}" - notify: - - "Restart_syslog_{{ ansible_distribution | lower }}_{{ ansible_distribution_major_version }}" - when: - - not ansible_virtualization_type | regex_search("docker|podman|container") - + - name: Unable to set hostname + ansible.builtin.debug: + msg: "Unable to set hostname for {{ ansible_hostname }} to {{ inventory_hostname }}." ... diff --git a/roles/node_status/tasks/main.yml b/roles/node_status/tasks/main.yml index f67d146..44e0785 100644 --- a/roles/node_status/tasks/main.yml +++ b/roles/node_status/tasks/main.yml @@ -30,3 +30,5 @@ group : "{{ node_status_group }}" delegate_to : "{{ node_status_host }}" throttle : 1 + loop_control: + loop_var : node_status_log_loop -- 2.47.1