From 06663f1baa23f0be1302e86475bd4c40ec7ca659 Mon Sep 17 00:00:00 2001 From: Chris Ruettimann Date: Fri, 14 Jul 2023 12:31:04 +0200 Subject: [PATCH 1/5] path fix --- tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/main.yml b/tasks/main.yml index e9cbebf..0b58edf 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -41,7 +41,7 @@ paths: - /runner/requirements_roles - "{{ lookup('env', 'PWD') }}/roles/{{role_path|basename}}/tasks" - - "{{ lookup('env', 'HOME') }}/.ansible/roles{{role_path|basename}}/tasks" + - "{{ lookup('env', 'HOME') }}/.ansible/roles/{{role_path|basename}}/tasks" - "/usr/share/ansible/roles/{{role_path|basename}}/tasks" - "/etc/ansible/roles/{{role_path|basename}}/tasks" - "/runner/project/roles/{{role_path|basename}}/tasks" From 67c889c4beeaa9803e2a3b15c01e48bf599435bc Mon Sep 17 00:00:00 2001 From: Chris Ruettimann Date: Fri, 29 Sep 2023 16:01:20 +0200 Subject: [PATCH 2/5] fallback is not used anymore --- tasks/fallback.yml | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 tasks/fallback.yml diff --git a/tasks/fallback.yml b/tasks/fallback.yml deleted file mode 100644 index b228804..0000000 --- a/tasks/fallback.yml +++ /dev/null @@ -1,4 +0,0 @@ -# tasks/fallback.yml -# If noting matches in include-file.yml, this playbook gets called to inform and debug the situation ---- - From ea575281667431ffd01721a2d2032159a73157ab Mon Sep 17 00:00:00 2001 From: Chris Ruettimann Date: Mon, 16 Oct 2023 18:08:08 +0200 Subject: [PATCH 3/5] auto commit --- meta/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/main.yml b/meta/main.yml index 6f970b3..3d9fbee 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -4,7 +4,7 @@ galaxy_info: author: Chris Ruettimann role_name: template - namespace: joe-speedboat +# namespace: joe-speedboat description: Bitbull Template Ansible Role min_ansible_version: 2.9 license: GPLv3 From b4536383d75c243828497c46bdc5916d07c79a79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chris=20R=C3=BCttimann?= Date: Thu, 14 Dec 2023 11:13:37 +0100 Subject: [PATCH 4/5] Update ansible_setup_local.sh RHEL9 added --- tests/ansible_setup_local.sh | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/tests/ansible_setup_local.sh b/tests/ansible_setup_local.sh index 1af16a8..11730a4 100644 --- a/tests/ansible_setup_local.sh +++ b/tests/ansible_setup_local.sh @@ -1,8 +1,12 @@ #!/bin/bash #DESC: Setup and configure Ansible control node -#WHO: chris@bitbull.ch -#DATE: 20220202 - +# Copyright (c) Chris Ruettimann +# This software is licensed to you under the GNU General Public License. +# There is NO WARRANTY for this software, express or +# implied, including the implied warranties of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2 +# along with this software; if not, see +# http://www.gnu.org/licenses/gpl.txt test -f /etc/os-release if [ $? -ne 0 ] @@ -97,6 +101,27 @@ then test -d /etc/ansible/collections || mkdir /etc/ansible/collections ; chmod 755 /etc/ansible/collections ansible-galaxy search joe-speedboat | cat +elif [ "$os_type$os_ver" == "rel9" ] ######################################################### +then + subscription-manager repos --enable=$(dnf repolist --all | awk '{print $1}' | grep -i codeready | grep $(echo $VERSION |cut -d. -f1)-$(arch)-rpms | tail -1) + for PKG in git wget curl ansible-core + do + rpm -q $PKG >/dev/null 2>&1 && echo $PKG is already installed || dnf -y install $PKG + done + ansibleconfigfile="/etc/ansible/ansible.cfg" + test -d /etc/ansible || mkdir /etc/ansible ; chmod 755 /etc/ansible + test -d /etc/ansible/projects || mkdir /etc/ansible/projects ; chmod 700 /etc/ansible/projects + test -d /etc/ansible/playbooks || mkdir /etc/ansible/playbooks ; chmod 700 /etc/ansible/playbooks + test -d /etc/ansible/collections || mkdir /etc/ansible/collections ; chmod 755 /etc/ansible/collections + test -f $ansibleconfigfile && cp -anv $ansibleconfigfile $ansibleconfigfile.bak + ansible-config init --disabled -t all | sed -e 's|{{ ANSIBLE_HOME ~ "/|/etc/ansible/|g' -e 's|" }}||g' > $ansibleconfigfile + sed -i 's|^;inventory=|inventory=|' $ansibleconfigfile + sed -i 's|^;roles_path=|roles_path=|' $ansibleconfigfile + sed -i 's|^;collections_path=|collections_path=|' $ansibleconfigfile + sed -i 's|^;nocows=.*|nocows=True|' $ansibleconfigfile + test -f /etc/ansible/hosts || echo localhost > /etc/ansible/hosts + ansible-galaxy search joe-speedboat | cat + elif [ "$os_type$os_ver" == "rel_clone9" ] ######################################################### then dnf -y config-manager --set-enabled crb From 4f6536cd8d8f518dd480239403d1d01db48a9bb0 Mon Sep 17 00:00:00 2001 From: Chris Ruettimann Date: Tue, 17 Sep 2024 08:29:58 +0200 Subject: [PATCH 5/5] created dynamic var for role path, this makes role nesting possible --- tasks/include-file.yml | 1 - tasks/main.yml | 14 ++++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/tasks/include-file.yml b/tasks/include-file.yml index d7e308f..2676208 100644 --- a/tasks/include-file.yml +++ b/tasks/include-file.yml @@ -25,5 +25,4 @@ - "{{ vars['task_dir_' + role_name|split('.')|last] }}/shared/{{ include_file_name }}" loop_control: loop_var: include_file_path - ... diff --git a/tasks/main.yml b/tasks/main.yml index 0b58edf..462ff0f 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -6,7 +6,7 @@ set_fact: ansible_distribution_combine: dummy -- name: Create rhelAll fact if needed when AlmaLinux, Rocky, RHEL +- name: Create rhelAll fact, useful when AlmaLinux, Rocky, RHEL, ... all use the same Ansible code base set_fact: ansible_distribution_combine: rhelAll when: > @@ -57,6 +57,11 @@ register: found_task_dirs no_log: True +- name: show tasks directory var + debug: + msg: "{{ 'task_dir_' + role_name|split('.')|last }}: {{ found_task_dirs.files[0].path|dirname }}" + verbosity: 1 + - name: define tasks directory set_fact: "{{ 'task_dir_' + role_name|split('.')|last }}": "{{ found_task_dirs.files[0].path|dirname }}" @@ -86,6 +91,11 @@ set_fact: include_file_names: "{{ include_file_names | unique | sort }}" +- name: show playbooks + debug: + msg: "include_file_names: {{ include_file_names | unique | sort }}" + verbosity: 1 + ######## END: Get playbooks to run ######## @@ -97,4 +107,4 @@ with_items: - "{{ include_file_names }}" ######## END: Execution part ######## - +...