diff --git a/apps/accounts/automations/change_secret/host/aix/main.yml b/apps/accounts/automations/change_secret/host/aix/main.yml index 984b9de8e..ee64a352c 100644 --- a/apps/accounts/automations/change_secret/host/aix/main.yml +++ b/apps/accounts/automations/change_secret/host/aix/main.yml @@ -41,6 +41,7 @@ password: "{{ account.secret | password_hash('des') }}" update_password: always ignore_errors: true + register: change_secret_result when: account.secret_type == "password" - name: "Get home directory for {{ account.username }}" @@ -83,6 +84,7 @@ user: "{{ account.username }}" key: "{{ account.secret }}" exclusive: "{{ ssh_params.exclusive }}" + register: change_secret_result when: account.secret_type == "ssh_key" - name: Refresh connection @@ -101,7 +103,9 @@ become_password: "{{ account.become.ansible_password | default('') }}" become_private_key_path: "{{ account.become.ansible_ssh_private_key_file | default(None) }}" old_ssh_version: "{{ jms_asset.old_ssh_version | default(False) }}" - when: account.secret_type == "password" and check_conn_after_change + when: + - account.secret_type == "password" + - check_conn_after_change or change_secret_result.failed delegate_to: localhost - name: "Verify {{ account.username }} SSH KEY (paramiko)" @@ -112,5 +116,7 @@ login_private_key_path: "{{ account.private_key_path }}" gateway_args: "{{ jms_asset.ansible_ssh_common_args | default(None) }}" old_ssh_version: "{{ jms_asset.old_ssh_version | default(False) }}" - when: account.secret_type == "ssh_key" and check_conn_after_change + when: + - account.secret_type == "ssh_key" + - check_conn_after_change or change_secret_result.failed delegate_to: localhost diff --git a/apps/accounts/automations/change_secret/host/posix/main.yml b/apps/accounts/automations/change_secret/host/posix/main.yml index 8b991307b..1ca6fc47b 100644 --- a/apps/accounts/automations/change_secret/host/posix/main.yml +++ b/apps/accounts/automations/change_secret/host/posix/main.yml @@ -41,6 +41,7 @@ password: "{{ account.secret | password_hash('sha512') }}" update_password: always ignore_errors: true + register: change_secret_result when: account.secret_type == "password" - name: "Get home directory for {{ account.username }}" @@ -83,6 +84,7 @@ user: "{{ account.username }}" key: "{{ account.secret }}" exclusive: "{{ ssh_params.exclusive }}" + register: change_secret_result when: account.secret_type == "ssh_key" - name: Refresh connection @@ -101,7 +103,9 @@ become_password: "{{ account.become.ansible_password | default('') }}" become_private_key_path: "{{ account.become.ansible_ssh_private_key_file | default(None) }}" old_ssh_version: "{{ jms_asset.old_ssh_version | default(False) }}" - when: account.secret_type == "password" and check_conn_after_change + when: + - account.secret_type == "password" + - check_conn_after_change or change_secret_result.failed delegate_to: localhost - name: "Verify {{ account.username }} SSH KEY (paramiko)" @@ -112,5 +116,7 @@ login_private_key_path: "{{ account.private_key_path }}" gateway_args: "{{ jms_asset.ansible_ssh_common_args | default(None) }}" old_ssh_version: "{{ jms_asset.old_ssh_version | default(False) }}" - when: account.secret_type == "ssh_key" and check_conn_after_change + when: + - account.secret_type == "ssh_key" + - check_conn_after_change or change_secret_result.failed delegate_to: localhost diff --git a/apps/accounts/automations/push_account/host/aix/main.yml b/apps/accounts/automations/push_account/host/aix/main.yml index 92c8a5658..51c563fd8 100644 --- a/apps/accounts/automations/push_account/host/aix/main.yml +++ b/apps/accounts/automations/push_account/host/aix/main.yml @@ -41,6 +41,7 @@ password: "{{ account.secret | password_hash('des') }}" update_password: always ignore_errors: true + register: change_secret_result when: account.secret_type == "password" - name: "Get home directory for {{ account.username }}" @@ -83,6 +84,7 @@ user: "{{ account.username }}" key: "{{ account.secret }}" exclusive: "{{ ssh_params.exclusive }}" + register: change_secret_result when: account.secret_type == "ssh_key" - name: Refresh connection @@ -101,7 +103,9 @@ become_password: "{{ account.become.ansible_password | default('') }}" become_private_key_path: "{{ account.become.ansible_ssh_private_key_file | default(None) }}" old_ssh_version: "{{ jms_asset.old_ssh_version | default(False) }}" - when: account.secret_type == "password" and check_conn_after_change + when: + - account.secret_type == "password" + - check_conn_after_change or change_secret_result.failed delegate_to: localhost - name: "Verify {{ account.username }} SSH KEY (paramiko)" @@ -112,6 +116,8 @@ login_private_key_path: "{{ account.private_key_path }}" gateway_args: "{{ jms_asset.ansible_ssh_common_args | default(None) }}" old_ssh_version: "{{ jms_asset.old_ssh_version | default(False) }}" - when: account.secret_type == "ssh_key" and check_conn_after_change + when: + - account.secret_type == "ssh_key" + - check_conn_after_change or change_secret_result.failed delegate_to: localhost diff --git a/apps/accounts/automations/push_account/host/posix/main.yml b/apps/accounts/automations/push_account/host/posix/main.yml index b47e6745e..ed01280db 100644 --- a/apps/accounts/automations/push_account/host/posix/main.yml +++ b/apps/accounts/automations/push_account/host/posix/main.yml @@ -41,6 +41,7 @@ password: "{{ account.secret | password_hash('sha512') }}" update_password: always ignore_errors: true + register: change_secret_result when: account.secret_type == "password" - name: "Get home directory for {{ account.username }}" @@ -83,6 +84,7 @@ user: "{{ account.username }}" key: "{{ account.secret }}" exclusive: "{{ ssh_params.exclusive }}" + register: change_secret_result when: account.secret_type == "ssh_key" - name: Refresh connection @@ -101,7 +103,9 @@ become_password: "{{ account.become.ansible_password | default('') }}" become_private_key_path: "{{ account.become.ansible_ssh_private_key_file | default(None) }}" old_ssh_version: "{{ jms_asset.old_ssh_version | default(False) }}" - when: account.secret_type == "password" and check_conn_after_change + when: + - account.secret_type == "password" + - check_conn_after_change or change_secret_result.failed delegate_to: localhost - name: "Verify {{ account.username }} SSH KEY (paramiko)" @@ -112,6 +116,8 @@ login_private_key_path: "{{ account.private_key_path }}" gateway_args: "{{ jms_asset.ansible_ssh_common_args | default(None) }}" old_ssh_version: "{{ jms_asset.old_ssh_version | default(False) }}" - when: account.secret_type == "ssh_key" and check_conn_after_change + when: + - account.secret_type == "ssh_key" + - check_conn_after_change or change_secret_result.failed delegate_to: localhost