From c31025b5a096269d7a1f036ea7c3b51320c84226 Mon Sep 17 00:00:00 2001 From: David Norman Date: Fri, 1 Dec 2023 14:51:10 -0500 Subject: [PATCH] Update onboarding_setup.yml Move onboarding into a conditional block that gets skipped on uninstall. --- tasks/onboarding_setup.yml | 86 +++++++++++++++++++------------------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/tasks/onboarding_setup.yml b/tasks/onboarding_setup.yml index 620939e..efc06b7 100644 --- a/tasks/onboarding_setup.yml +++ b/tasks/onboarding_setup.yml @@ -10,47 +10,47 @@ tags: - onboarding -- name: Extract onboarding package. - unarchive: - src: "{{ onboarding_source }}" - dest: /etc/opt/microsoft/mdatp - creates: /etc/opt/microsoft/mdatp/MicrosoftDefenderATPOnboardingLinuxServer.py - mode: 0600 - owner: root - group: root - remote_src: "{{ '://' in onboarding_source }}" - register: unarchive_out - ignore_errors: yes - when: not uninstall - tags: - - onboarding - - molecule-notest - -- name: Create licence file - command: - cmd: /usr/bin/python3 /etc/opt/microsoft/mdatp/MicrosoftDefenderATPOnboardingLinuxServer.py - creates: /etc/opt/microsoft/mdatp/mdatp_onboard.json +- name: Extract and validate the onboarding package. + block: + - name: Extract onboarding package. + unarchive: + src: "{{ onboarding_source }}" + dest: /etc/opt/microsoft/mdatp + creates: /etc/opt/microsoft/mdatp/MicrosoftDefenderATPOnboardingLinuxServer.py + mode: 0600 + owner: root + group: root + remote_src: "{{ '://' in onboarding_source }}" + register: unarchive_out + ignore_errors: yes + tags: + - onboarding + - molecule-notest + + - name: Create licence file + command: + cmd: /usr/bin/python3 /etc/opt/microsoft/mdatp/MicrosoftDefenderATPOnboardingLinuxServer.py + creates: /etc/opt/microsoft/mdatp/mdatp_onboard.json + + - name: "DEBUG: output from onboarding unzip attempt." + debug: + var: unarchive_out + verbosity: 3 + when: + - unarchive_out is defined + tags: + - onboarding + - molecule-notest + + - name: Custom error handling for configuration unzip. + fail: + msg: "mdatp configuration json did not unzip successfully." + when: + - unarchive_out is defined + - unarchive_out.failed + - not 'Failed to find handler' in unarchive_out.msg + tags: + - onboarding + - molecule-notest + when: not uninstall - -- name: "DEBUG: output from onboarding unzip attempt." - debug: - var: unarchive_out - verbosity: 3 - when: - - unarchive_out is defined - - not uninstall - tags: - - onboarding - - molecule-notest - -- name: Custom error handling for configuration unzip. - fail: - msg: "mdatp configuration json did not unzip successfully." - when: - - unarchive_out is defined - - unarchive_out.failed - - not 'Failed to find handler' in unarchive_out.msg - - not uninstall - tags: - - onboarding - - molecule-notest