From ca513b63d5e762de651d437214e7b219d4e0093a Mon Sep 17 00:00:00 2001 From: Julien Girardin Date: Thu, 7 Dec 2023 11:34:32 +0100 Subject: [PATCH] Detect changes on all nodes, for triggering "pause" on review https://docs.ansible.com/ansible/latest/collections/ansible/builtin/pause_module.html "Conditionals will work as if run_once is being used, variables used will be from the first available host". + Able to test this in dev --- roles/process_reasons/tasks/main.yml | 3 ++- scripts/detect-user.sh | 8 ++++++-- tests/dev/group_vars/all/main.yml | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/roles/process_reasons/tasks/main.yml b/roles/process_reasons/tasks/main.yml index e98dbd1..bc7f684 100644 --- a/roles/process_reasons/tasks/main.yml +++ b/roles/process_reasons/tasks/main.yml @@ -21,7 +21,8 @@ - name: 'Pause to review diff and upgrade reasons' pause: when: - - _upgrade_reasons|length > 0 or _config_upgrade_reasons|length > 0 + - ansible_play_hosts_all|map('extract', hostvars, '_upgrade_reasons')|map('default', [])|map('length')|select|list|length > 0 + or ansible_play_hosts_all|map('extract', hostvars, '_config_upgrade_reasons')|map('default', [])|map('length')|select|list|length > 0 - groups.cp_running|default([])|length > 0 - not action_reasons_review_skip|bool diff --git a/scripts/detect-user.sh b/scripts/detect-user.sh index a50c73d..414c2cf 100755 --- a/scripts/detect-user.sh +++ b/scripts/detect-user.sh @@ -24,7 +24,11 @@ fi if [ "$(id -u)" -ne "${PWD_UID}" ] ; then getent passwd ${PWD_UID} || ${USERADD} -u ${PWD_UID} enix PWD_UNAME=$(stat . -c "%U") - exec su ${PWD_UNAME} "$@" + if command -v sudo > /dev/null; then + sudo -HEu ${PWD_UNAME} "$@" + else + exec su ${PWD_UNAME} "$@" + fi; else - $@ + "$@" fi diff --git a/tests/dev/group_vars/all/main.yml b/tests/dev/group_vars/all/main.yml index 50502ed..3fe7f3a 100644 --- a/tests/dev/group_vars/all/main.yml +++ b/tests/dev/group_vars/all/main.yml @@ -1,4 +1,4 @@ -action_reasons_review_skip: true +--- cluster_config: networking: podSubnet: 10.95.0.0/16