format ansible code examples and add DNF/YUM key instructions

Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>
This commit is contained in:
Thomas Sjögren 2021-01-02 22:19:46 +01:00
parent 2a3e536a5c
commit 160a681717

View File

@ -14,9 +14,9 @@ author: dansimp
ms.localizationpriority: medium
manager: dansimp
audience: ITPro
ms.collection:
- m365-security-compliance
- m365initiative-defender-endpoint
ms.collection:
- m365-security-compliance
- m365initiative-defender-endpoint
ms.topic: conceptual
---
@ -140,28 +140,34 @@ Create a subtask or role files that contribute to an playbook or task.
```bash
- name: Add Microsoft APT key
apt_key:
keyserver: https://packages.microsoft.com/
id: BC528686B50D79E339D3721CEB3E94ADBE1229CF
when: ansible_os_family == "Debian"
apt_key:
keyserver: https://packages.microsoft.com/
id: BC528686B50D79E339D3721CEB3E94ADBE1229CF
when: ansible_os_family == "Debian"
- name: Add Microsoft apt repository for MDATP
apt_repository:
repo: deb [arch=arm64,armhf,amd64] https://packages.microsoft.com/[distro]/[version]/prod [channel] main
update_cache: yes
state: present
filename: microsoft-[channel].list
when: ansible_os_family == "Debian"
apt_repository:
repo: deb [arch=arm64,armhf,amd64] https://packages.microsoft.com/[distro]/[version]/prod [channel] main
update_cache: yes
state: present
filename: microsoft-[channel].list
when: ansible_os_family == "Debian"
- name: Add Microsoft DNF/YUM key
rpm_key:
state: present
key: https://packages.microsoft.com/keys/microsoft.asc
when: ansible_os_family == "RedHat"
- name: Add Microsoft yum repository for MDATP
yum_repository:
name: packages-microsoft-com-prod-[channel]
description: Microsoft Defender for Endpoint
file: microsoft-[channel]
baseurl: https://packages.microsoft.com/[distro]/[version]/[channel]/
gpgcheck: yes
enabled: Yes
when: ansible_os_family == "RedHat"
yum_repository:
name: packages-microsoft-com-prod-[channel]
description: Microsoft Defender for Endpoint
file: microsoft-[channel]
baseurl: https://packages.microsoft.com/[distro]/[version]/[channel]/
gpgcheck: yes
enabled: Yes
when: ansible_os_family == "RedHat"
```
- Create the Ansible install and uninstall YAML files.
@ -173,13 +179,13 @@ Create a subtask or role files that contribute to an playbook or task.
```
```Output
- hosts: servers
tasks:
- include: ../roles/onboarding_setup.yml
- include: ../roles/add_apt_repo.yml
- apt:
name: mdatp
state: latest
update_cache: yes
tasks:
- include: ../roles/onboarding_setup.yml
- include: ../roles/add_apt_repo.yml
- apt:
name: mdatp
state: latest
update_cache: yes
```
```bash
@ -200,13 +206,13 @@ Create a subtask or role files that contribute to an playbook or task.
```
```Output
- hosts: servers
tasks:
tasks:
- include: ../roles/onboarding_setup.yml
- include: ../roles/add_yum_repo.yml
- yum:
name: mdatp
state: latest
enablerepo: packages-microsoft-com-prod-[channel]
name: mdatp
state: latest
enablerepo: packages-microsoft-com-prod-[channel]
```
```bash
@ -216,7 +222,7 @@ Create a subtask or role files that contribute to an playbook or task.
- hosts: servers
tasks:
- yum:
name: mdatp
name: mdatp
state: absent
```