Skip to content

Commit

Permalink
Update onboarding_setup.yml
Browse files Browse the repository at this point in the history
Move onboarding into a conditional block that gets skipped on uninstall.
  • Loading branch information
deekayen committed Dec 1, 2023
1 parent 4b41a96 commit c31025b
Showing 1 changed file with 43 additions and 43 deletions.
86 changes: 43 additions & 43 deletions tasks/onboarding_setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit c31025b

Please sign in to comment.