You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -34,7 +34,19 @@ This article describes how to deploy Defender for Endpoint on Linux using Ansibl
34
34
35
35
[!INCLUDE [Microsoft Defender for Endpoint third-party tool support](../includes/support.md)]
36
36
37
-
## Prerequisites and system requirements
37
+
## Introduction
38
+
39
+
Deploy Microsoft Defender for Endpoint on Linux Servers using Ansible to automate the deployment process for machines at scale. Following are the two methods to automate.
40
+
41
+
1. Using installer script (recommended)
42
+
43
+
This method greatly simplifies the automation process and helps to install the MDE agent as well as onboard the device to security portal using just a few steps without having to configure for different distros separately.
44
+
45
+
2. Manually configuring repositories for each distro
46
+
47
+
This method allows to automate the deployment process by manually configuring repositories, installing the agent and onboarding the device for each distro. This method gives more granular control over the deployment process.
48
+
49
+
## Prerequisites and system requirements applicable to both the Methods
38
50
39
51
Before you get started, see [the main Defender for Endpoint on Linux page](microsoft-defender-endpoint-linux.md) for a description of prerequisites and system requirements for the current software version.
40
52
@@ -60,7 +72,7 @@ In addition, for Ansible deployment, you need to be familiar with Ansible admini
60
72
ansible -m ping all
61
73
```
62
74
63
-
## Download the onboarding package
75
+
## Download the onboarding package applicable to both the methods
64
76
65
77
Download the onboarding package from Microsoft Defender portal.
66
78
@@ -89,43 +101,171 @@ Download the onboarding package from Microsoft Defender portal.
89
101
inflating: mdatp_onboard.json
90
102
```
91
103
92
-
## Create Ansible YAML files
104
+
## Deploy MDE using mde_installer.sh with Ansible
93
105
94
-
Create a subtask or role files that contribute to a playbook or task.
106
+
Follow the steps below after [downloading the onboarding package]() and completing [pre-requisites]() to deploy MDE using installer bash script
95
107
96
-
- Create the onboarding task, `onboarding_setup.yml`:
108
+
### Download the installer bash script
97
109
98
-
```bash
99
-
- name: Create MDATP directories
100
-
file:
101
-
path: /etc/opt/microsoft/mdatp/
102
-
recurse: true
103
-
state: directory
104
-
mode: 0755
105
-
owner: root
106
-
group: root
107
-
108
-
- name: Register mdatp_onboard.json
109
-
stat:
110
-
path: /etc/opt/microsoft/mdatp/mdatp_onboard.json
111
-
register: mdatp_onboard
112
-
113
-
- name: Extract WindowsDefenderATPOnboardingPackage.zip into /etc/opt/microsoft/mdatp
114
-
unarchive:
115
-
src: WindowsDefenderATPOnboardingPackage.zip
116
-
dest: /etc/opt/microsoft/mdatp
117
-
mode: 0600
118
-
owner: root
119
-
group: root
120
-
when: not mdatp_onboard.stat.exists
121
-
```
110
+
Pull the [installer bash script](https://github.com/microsoft/mdatp-xplat/tree/master/linux/installation) from Microsoft Github Repository or use the below command to download
### Deploy MDE using the above playbook using the command
151
+
152
+
Replace the corresponding paths and channel in the below command as per your requirement
153
+
154
+
```bash
155
+
ansible-playbook -i /etc/ansible/hosts /etc/ansible/playbooks/install_mdatp.yml --extra-vars "onboarding_script=<path to mdatp_onboard.json > mde_installer_script=<path to mde_installer.sh> channel=<channel to deploy for: insiders-fast / insiders-slow / prod> "
156
+
157
+
158
+
```
159
+
160
+
### Verify deployment
161
+
162
+
a. Go to __[Microsoft Defender Security Portal]()__ inventory. It might take 5-20 mins for the device to show up on the portal.
163
+
164
+
b. Perform the below post-installation checks which includes checks like health, connectivity, AV/EDR detection tests to ensure successful deployment and working of MDE
165
+
166
+
```bash
167
+
168
+
- name: Run post-installation basic MDE test
169
+
hosts: myhosts
170
+
tasks:
171
+
- name: Check health
172
+
ansible.builtin.command: mdatp health --field healthy
173
+
register: health_status
174
+
175
+
- name: MDE health test failed
176
+
fail: msg="MDE is not healthy. health status => \n{{ health_status.stdout }}\nMDE deployment not complete"
177
+
when: health_status.stdout != "true"
178
+
179
+
- name: Run connectivity test
180
+
ansible.builtin.command: mdatp connectivity test
181
+
register: connectivity_status
182
+
183
+
- name: Connectivity failed
184
+
fail: msg="Connectivity failed. Connectivity result => \n{{ connectivity_status.stdout }}\n MDE deployment not complete"
185
+
when: connectivity_status.rc != 0
186
+
187
+
- name: Check RTP status
188
+
ansible.builtin.command: mdatp health --field real_time_protection_enabled
Run the below command to uninstall MDE using the above playbook
252
+
253
+
```bash
254
+
ansible-playbook -i /etc/ansible/hosts /etc/ansible/playbooks/uninstall_mdatp.yml --extra-vars "mde_installer_script=<path to mde_installer.sh>"
255
+
```
256
+
257
+
## Deploy MDE using Ansible by configuring repositories manually
258
+
259
+
Follow the steps below after [downloading the onboarding package]() and completing [pre-requisites]() to deploy MDE by manually configuring the repositories for each Linux distribution
260
+
261
+
### Create Ansible YAML files
122
262
123
263
- Add the Defender for Endpoint repository and key, `add_apt_repo.yml`:
124
264
125
-
Defender for Endpoint on Linux can be deployed from one of the following channels:
126
-
- *insiders-fast*, denoted as `[channel]`
127
-
- *insiders-slow*, denoted as `[channel]`
128
-
- *prod*, denoted as `[channel]` using the version name (see [Linux Software Repository for Microsoft Products](/linux/packages))
265
+
- Defender for Endpoint on Linux can be deployed from one of the following channels:
266
+
- *insiders-fast*, denoted as `[channel]`
267
+
- *insiders-slow*, denoted as `[channel]`
268
+
- *prod*, denoted as `[channel]` using the version name (see [Linux Software Repository for Microsoft Products](/linux/packages))
129
269
130
270
Each channel corresponds to a Linux software repository.
131
271
@@ -134,17 +274,17 @@ Create a subtask or role files that contribute to a playbook or task.
134
274
135
275
In order to preview new features and provide early feedback, it's recommended that you configure some devices in your enterprise to use either *insiders-fast* or *insiders-slow*.
136
276
137
-
> [!WARNING]
277
+
> [!WARNING]
138
278
> Switching the channel after the initial installation requires the product to be reinstalled. To switch the product channel: uninstall the existing package, re-configure your device to use the new channel, and follow the steps in this document to install the package from the new location.
139
279
140
-
Note your distribution and version and identify the closest entry for it under `https://packages.microsoft.com/config/[distro]/`.
280
+
Note your distribution and version and identify the closest entry for it under `https://packages.microsoft.com/config/[distro]/`.
141
281
142
-
In the following commands, replace *[distro]* and *[version]* with the information you've identified.
282
+
In the following commands, replace *[distro]* and *[version]* with the information you've identified.
143
283
144
-
> [!NOTE]
284
+
> [!NOTE]
145
285
> In case of Oracle Linux and Amazon Linux 2, replace *[distro]* with "rhel". For Amazon Linux 2, replace *[version]* with "7". For Oracle Linux, replace *[version]* with the version of Oracle Linux.
0 commit comments