From 02e8d4166bf33b20d45ec1a3ec898614dae59df5 Mon Sep 17 00:00:00 2001 From: Ziwi Date: Sat, 7 Sep 2024 02:51:36 +0200 Subject: [PATCH] fix: Ansible facts pull for specific Ubuntu version --- .../{ubuntu-22.04.yml => ubuntu-22.yml} | 0 .../{ubuntu-24.04.yml => ubuntu-24.yml} | 0 ansible/roles/config/tasks/main.yml | 6 ++-- ansible/roles/software/tasks/main.yml | 6 ++-- ansible/setup-ubuntu.yml | 36 +++++++++---------- 5 files changed, 24 insertions(+), 24 deletions(-) rename ansible/group_vars/{ubuntu-22.04.yml => ubuntu-22.yml} (100%) rename ansible/group_vars/{ubuntu-24.04.yml => ubuntu-24.yml} (100%) diff --git a/ansible/group_vars/ubuntu-22.04.yml b/ansible/group_vars/ubuntu-22.yml similarity index 100% rename from ansible/group_vars/ubuntu-22.04.yml rename to ansible/group_vars/ubuntu-22.yml diff --git a/ansible/group_vars/ubuntu-24.04.yml b/ansible/group_vars/ubuntu-24.yml similarity index 100% rename from ansible/group_vars/ubuntu-24.04.yml rename to ansible/group_vars/ubuntu-24.yml diff --git a/ansible/roles/config/tasks/main.yml b/ansible/roles/config/tasks/main.yml index 074e821..5f98e82 100644 --- a/ansible/roles/config/tasks/main.yml +++ b/ansible/roles/config/tasks/main.yml @@ -20,12 +20,12 @@ - always # Include OS-specific variables -- name: "[Software] Include OS group_vars {{ facter_os.name }}-{{ facter_os.release.major }}" +- name: "[Config] Include OS group_vars Ubuntu-{{ distribution_major_version }}" ansible.builtin.include_vars: "{{ item }}" with_first_found: - files: - - "{{ playbook_dir }}/group_vars/{{ facter_os.name | lower }}-{{ facter_os.release.major }}.yml" - skip: true + - "{{ playbook_dir }}/group_vars/ubuntu-{{ distribution_major_version }}.yml" + skip: false tags: - always diff --git a/ansible/roles/software/tasks/main.yml b/ansible/roles/software/tasks/main.yml index 3d05f0a..530e4fc 100644 --- a/ansible/roles/software/tasks/main.yml +++ b/ansible/roles/software/tasks/main.yml @@ -24,12 +24,12 @@ - always # Include OS-specific variables -- name: "[Software] Include OS group_vars {{ facter_os.name }}-{{ facter_os.release.major }}" +- name: "[Software] Include OS group_vars Ubuntu-{{ distribution_major_version }}" ansible.builtin.include_vars: "{{ item }}" with_first_found: - files: - - "{{ playbook_dir }}/group_vars/{{ facter_os.name | lower }}-{{ facter_os.release.major }}.yml" - skip: true + - "{{ playbook_dir }}/group_vars/ubuntu-{{ distribution_major_version }}.yml" + skip: false tags: - always diff --git a/ansible/setup-ubuntu.yml b/ansible/setup-ubuntu.yml index 5e4aedc..d266a49 100644 --- a/ansible/setup-ubuntu.yml +++ b/ansible/setup-ubuntu.yml @@ -3,31 +3,31 @@ ### Comment out roles you don't need ### vars: summary: | - ############################################# + ############################################# - Thank you for using - ___ _ - / _ \_ __ _____ _____ __ _ ___(_) ___ - / /_)/ '__/ _ \ \ / / _ \/ _` / __| |/ _ \ - / ___/| | | (_) \ V / __/ (_| \__ \ | (_) | - \/ |_| \___/ \_/ \___|\__,_|___/_|\___/ + Thank you for using + ___ _ + / _ \_ __ _____ _____ __ _ ___(_) ___ + / /_)/ '__/ _ \ \ / / _ \/ _` / __| |/ _ \ + / ___/| | | (_) \ V / __/ (_| \__ \ | (_) | + \/ |_| \___/ \_/ \___|\__,_|___/_|\___/ - For example usages see `Usages.md`. + For example usages see `Usages.md`. - IF you like it, gimme a star! :) + IF you like it, gimme a star! :) - ############################################# + ############################################# - This ansible run ended up with below versions installed/upgraded: + This ansible run ended up with below versions installed/upgraded: - {{ current_versions | to_nice_yaml }} + {{ current_versions | to_nice_yaml }} - All above versions are added/updated in `{{ playbook_dir }}/../current-versions.yml` + All above versions are added/updated in `{{ playbook_dir }}/../current-versions.yml` - See `README.md` for details on versioning. + See `README.md` for details on versioning. tasks: - - name: '[Init] Check sudo password' + - name: "[Init] Check sudo password" ansible.builtin.command: echo "sudo password is correct" become: true changed_when: false @@ -43,14 +43,14 @@ - name: "[Init] Ensure `current-versions.yml` file" ansible.builtin.file: path: "{{ playbook_dir }}/../current-versions.yml" - mode: '0644' + mode: "0644" state: touch tags: - always - - name: '[Software] Include software role' + - name: "[Software] Include software role" ansible.builtin.import_role: name: software - - name: '[Config] Include config role' + - name: "[Config] Include config role" ansible.builtin.import_role: name: config - name: "[Summary] Show detailed info"