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
This article describes how to deploy Defender for Endpoint on Linux using Ansible. A successful deployment requires the completion of all of the following tasks:
33
33
34
-
-[Download the onboarding package](#download-the-onboarding-package)
-[Prerequisites and system requirements](#prerequisites-and-system-requirements-applicable-to-both-the-methods)
35
+
-[Download the onboarding package](#download-the-onboarding-package-applicable-to-both-the-methods)
36
+
-[Deploy Defender for Endpoint on Linux using mde_installer.sh with Ansible](#deploy-defender-for-endpoint-using-mde_installersh-with-ansible)
37
+
-[Deploy Defender for Endpoint on Linux using Ansible by configuring repositories manually](#deploy-defender-for-endpoint-using-ansible-by-configuring-repositories-manually)
38
38
39
39
40
40
[!INCLUDE [Microsoft Defender for Endpoint third-party tool support](../includes/support.md)]
41
41
42
-
## Prerequisites and system requirements
42
+
## Introduction
43
43
44
-
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.
44
+
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.
45
+
46
+
1. Using the installer script (recommended). This method greatly simplifies the automation process and helps to install the Defender for Endpoint agent and onboard the device to the Microsoft Defender portal using just a few steps without having to configure for different distros separately.
47
+
48
+
2. Manually configuring repositories for each distro. This method allows you 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.
49
+
50
+
## Prerequisites and system requirements applicable to both the methods
51
+
52
+
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.
45
53
46
54
In addition, for Ansible deployment, you need to be familiar with Ansible administration tasks, have Ansible configured, and know how to deploy playbooks and tasks. Ansible has many ways to complete the same task. These instructions assume availability of supported Ansible modules, such as *apt* and *unarchive* to help deploy the package. Your organization might use a different workflow. Refer to the [Ansible documentation](https://docs.ansible.com/) for details.
47
55
48
-
- Ansible needs to be installed on at least one computer (Ansible calls this the control node).
49
-
- SSH must be configured for an administrator account between the control node and all managed nodes (devices that will have Defender for Endpoint installed on them), and it is recommended to be configured with public key authentication.
56
+
- Ansible needs to be installed on at least one computer (Ansible calls this computer the control node).
57
+
58
+
- SSH must be configured for an administrator account between the control node and all managed nodes (devices that have Defender for Endpoint installed on them), and it's recommended to be configured with public key authentication.
59
+
50
60
- The following software must be installed on all managed nodes:
51
61
- curl
52
-
- python-apt (if you are deploying on distributions using apt as a package manager)
62
+
- python-apt (if you're deploying on distributions using apt as a package manager)
53
63
54
64
- All managed nodes must be listed in the following format in the `/etc/ansible/hosts` or relevant file:
55
65
@@ -65,15 +75,17 @@ In addition, for Ansible deployment, you need to be familiar with Ansible admini
65
75
ansible -m ping all
66
76
```
67
77
68
-
## Download the onboarding package
78
+
## Download the onboarding package applicable to both the methods
69
79
70
80
Download the onboarding package from Microsoft Defender portal.
71
81
72
82
[!INCLUDE [Defender for Endpoint repackaging warning](../includes/repackaging-warning.md)]
73
83
74
-
1. In Microsoft Defender portal, go to **Settings > Endpoints > Device management > Onboarding**.
84
+
1. In the [Microsoft Defender portal](https://security.microsoft.com), go to **Settings**>**Endpoints**>**Device management**>**Onboarding**.
85
+
75
86
2. In the first drop-down menu, select**Linux Server** as the operating system. In the second drop-down menu, select**Your preferred Linux configuration management tool** as the deployment method.
76
-
3. Select **Download onboarding package**. Save the file as WindowsDefenderATPOnboardingPackage.zip.
87
+
88
+
3. Select **Download onboarding package**. Save the file as `WindowsDefenderATPOnboardingPackage.zip`.
@@ -94,7 +106,161 @@ Download the onboarding package from Microsoft Defender portal.
94
106
inflating: mdatp_onboard.json
95
107
```
96
108
97
-
## Create Ansible YAML files
109
+
## Deploy Defender for Endpoint using mde_installer.sh with Ansible
110
+
111
+
Before you begin, make sure to download the onboarding package and meet the prerequisites to deploy Defender for Endpoint on Linux using the installer bash script.
112
+
113
+
### Download the installer bash script
114
+
115
+
Pull the [installer bash script](https://github.com/microsoft/mdatp-xplat/tree/master/linux/installation) from Microsoft GitHub Repository or use the following command to download it.
Apply the playbook by using the following command, replacing the corresponding paths and channel per your requirements:
157
+
158
+
```bash
159
+
ansible-playbook -i /etc/ansible/hosts /etc/ansible/playbooks/install_mdatp.yml --extra-vars "onboarding_json=<path to mdatp_onboard.json > mde_installer_script=<path to mde_installer.sh> channel=<channel to deploy for: insiders-fast / insiders-slow / prod> "
160
+
```
161
+
162
+
### Verify if the deployment is successful
163
+
164
+
1. In the [Microsoft Defender portal](https://security.microsoft.com), open the device inventory. It might take 5-20 mins forthe device to show upin the portal.
165
+
166
+
2. Perform the following post-installation checks, which include checks like health, connectivity, antivirus, and EDR detection tests to ensure successful deployment and working of Defender for Endpoint.
167
+
168
+
```bash
169
+
170
+
- name: Run post-installation basic MDE test
171
+
hosts: myhosts
172
+
tasks:
173
+
- name: Check health
174
+
ansible.builtin.command: mdatp health --field healthy
175
+
register: health_status
176
+
177
+
- name: MDE health test failed
178
+
fail: msg="MDE is not healthy. health status => \n{{ health_status.stdout }}\nMDE deployment not complete"
179
+
when: health_status.stdout != "true"
180
+
181
+
- name: Run connectivity test
182
+
ansible.builtin.command: mdatp connectivity test
183
+
register: connectivity_status
184
+
185
+
- name: Connectivity failed
186
+
fail: msg="Connectivity failed. Connectivity result => \n{{ connectivity_status.stdout }}\n MDE deployment not complete"
187
+
when: connectivity_status.rc != 0
188
+
189
+
- name: Check RTP status
190
+
ansible.builtin.command: mdatp health --field real_time_protection_enabled
fail: msg="EICAR file not deleted. MDE deployment not complete"
218
+
when: eicar_test.stat.exists
219
+
220
+
- name: MDE Deployed
221
+
debug:
222
+
msg: "MDE succesfully deployed"
223
+
224
+
225
+
```
226
+
227
+
### How to uninstall Microsoft Defender for Endpoint on Linux Servers
228
+
229
+
Create uninstallation YAML file (for example: /etc/ansible/playbooks/uninstall_mdatp.yml) which uses mde_installer.sh. You can also download the file directly from [GitHub](/defender-endpoint/linux-support-events)
Run the following command to uninstall Defender for Endpoint by using the playbook:
254
+
255
+
```bash
256
+
ansible-playbook -i /etc/ansible/hosts /etc/ansible/playbooks/uninstall_mdatp.yml --extra-vars "mde_installer_script=<path to mde_installer.sh>"
257
+
```
258
+
259
+
## Deploy Defender for Endpoint using Ansible by configuring repositories manually
260
+
261
+
Follow the steps in this section after downloading the onboarding package and meeting prerequisites to deploy Defender for Endpoint by manually configuring the repositories for each Linux distribution.
262
+
263
+
### Create Ansible YAML files
98
264
99
265
Create a subtask or role files that contribute to a playbook or task.
100
266
@@ -183,7 +349,7 @@ Create a subtask or role files that contribute to a playbook or task.
183
349
184
350
- Create the Ansible install and uninstall YAML files.
185
351
186
-
- For apt-based distributions use the following YAML file:
352
+
- For apt-based distributions, use the following YAML file:
187
353
188
354
```bash
189
355
cat install_mdatp.yml
@@ -216,7 +382,7 @@ Create a subtask or role files that contribute to a playbook or task.
216
382
state: absent
217
383
```
218
384
219
-
- For dnf-based distributions use the following YAML file:
385
+
- For dnf-based distributions, use the following YAML file:
220
386
221
387
```bash
222
388
cat install_mdatp_dnf.yml
@@ -249,9 +415,9 @@ Create a subtask or role files that contribute to a playbook or task.
249
415
state: absent
250
416
```
251
417
252
-
## Deployment
418
+
## Apply the playbook
253
419
254
-
Now run the tasks files under `/etc/ansible/playbooks/` or relevant directory.
420
+
In this step, you apply the playbook. Run the tasks files under `/etc/ansible/playbooks/` or relevant directory.
255
421
256
422
- Installation:
257
423
@@ -277,15 +443,34 @@ Now run the tasks files under `/etc/ansible/playbooks/` or relevant directory.
1. For information on how to find the log that's generated automatically when an installation error occurs, see [Log installation issues](linux-resources.md#log-installation-issues).
451
+
452
+
2. For information about common installation issues, see [Installation issues](/defender-endpoint/linux-support-install).
453
+
454
+
3. If health of the device is `false`, see [Defender for Endpoint agent health issues](/defender-endpoint/health-status).
281
455
282
-
See [Log installation issues](linux-resources.md#log-installation-issues) for more information on how to find the automatically generated log that is created by the installer when an error occurs.
456
+
4. For product performance issues, see [Troubleshoot performance issues](/defender-endpoint/linux-support-perf).
457
+
458
+
5. For proxy and connectivity issues, see [Troubleshoot cloud connectivity issues](/defender-endpoint/linux-support-connectivity).
459
+
460
+
6. To get support from Microsoft, open a support ticket, and provide the log files created by using the [client analyzer](/defender-endpoint/run-analyzer-macos-linux).
461
+
462
+
## How to configure policies for Microsoft Defender on Linux
463
+
464
+
You can configure antivirus or EDR settings on your endpoints using following methods:
465
+
466
+
- See [Set preferences for Microsoft Defender for Endpoint on Linux](/defender-endpoint/linux-preferences).
467
+
- See [security settings management](/mem/intune/protect/mde-security-integration) to configure settings in the Microsoft Defender portal.
283
468
284
469
## Operating system upgrades
285
470
286
471
When upgrading your operating system to a new major version, you must first uninstall Defender for Endpoint on Linux, install the upgrade, and finally reconfigure Defender for Endpoint on Linux on your device.
287
472
288
-
## References
473
+
## See also
289
474
290
475
- [Add or remove YUM repositories](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/yum_repository_module.html)
291
476
@@ -295,6 +480,6 @@ When upgrading your operating system to a new major version, you must first unin
0 commit comments