From 9cc617be4554700420b99d1fc1236adc1c4d7514 Mon Sep 17 00:00:00 2001 From: Sven Velt Date: Fri, 29 Nov 2024 10:08:26 +0100 Subject: [PATCH] Kapitel 12: group_by --- .gitmodules | 3 +++ 12/group_by.yml | 38 ++++++++++++++++++++++++++++++++ 12/timesync.yml | 1 + ansible.cfg | 2 +- helper/12_gitmodules_timesync.sh | 6 +++++ roles.extern/roles_timesync | 1 + 6 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 12/group_by.yml create mode 120000 12/timesync.yml create mode 100755 helper/12_gitmodules_timesync.sh create mode 160000 roles.extern/roles_timesync diff --git a/.gitmodules b/.gitmodules index 26d9052..86a6ea3 100644 --- a/.gitmodules +++ b/.gitmodules @@ -26,3 +26,6 @@ [submodule "roles.extern/selfsignedcert"] path = roles.extern/selfsignedcert url = https://git.velt.biz/Ansible/selfsignedcert.git +[submodule "roles.extern/roles_timesync"] + path = roles.extern/roles_timesync + url = https://git.velt.biz/Ansible/roles_timesync.git diff --git a/12/group_by.yml b/12/group_by.yml new file mode 100644 index 0000000..d044165 --- /dev/null +++ b/12/group_by.yml @@ -0,0 +1,38 @@ +--- +- hosts: + - all + - localhost + + tasks: + - group_by: + key: "sv_pkgsvcmgr_{{ ansible_pkg_mgr }}-{{ ansible_service_mgr }}" + parents: + - "sv_pkgmgr_{{ ansible_pkg_mgr }}" + + - group_by: + key: "sv_svcmgr_{{ ansible_service_mgr }}" + + - group_by: + key: "sv_mac_{{ '_'.join(ansible_default_ipv4.macaddress.split(':')[5:6]) }}" + + - group_by: + key: "sv_net4_{{ ansible_default_ipv4.network }}" + + - group_by: + key: "sv_v6int_{{ ansible_default_ipv6.interface|default('nov6') }}" + + - group_by: + key: "sv_distri_{{ ansible_distribution }}" + + - group_by: + key: "sv_family_{{ ansible_os_family }}" + + - group_by: + key: "sv_{{ ansible_virtualization_role }}_{{ ansible_virtualization_type }}" + +- hosts: localhost + gather_facts: no + tasks: + - debug: + msg: "{{ groups | dict2items | selectattr('key', 'contains', 'sv_') | list | items2dict }}" + diff --git a/12/timesync.yml b/12/timesync.yml new file mode 120000 index 0000000..6c62d55 --- /dev/null +++ b/12/timesync.yml @@ -0,0 +1 @@ +../roles.extern/roles_timesync/timesync.yml \ No newline at end of file diff --git a/ansible.cfg b/ansible.cfg index 31fbd81..00efac9 120000 --- a/ansible.cfg +++ b/ansible.cfg @@ -1 +1 @@ -11/ansible.cfg \ No newline at end of file +12/ansible.cfg \ No newline at end of file diff --git a/helper/12_gitmodules_timesync.sh b/helper/12_gitmodules_timesync.sh new file mode 100755 index 0000000..2149bd8 --- /dev/null +++ b/helper/12_gitmodules_timesync.sh @@ -0,0 +1,6 @@ +#!/bin/bash -ex + +mkdir -p roles.extern + +git submodule add https://git.velt.biz/Ansible/roles_timesync.git roles.extern/roles_timesync + diff --git a/roles.extern/roles_timesync b/roles.extern/roles_timesync new file mode 160000 index 0000000..bb38d9e --- /dev/null +++ b/roles.extern/roles_timesync @@ -0,0 +1 @@ +Subproject commit bb38d9e89130b68dabf997059cf8f863d4625739