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

@ -140,28 +140,34 @@ Create a subtask or role files that contribute to an playbook or task.
```bash ```bash
- name: Add Microsoft APT key - name: Add Microsoft APT key
apt_key: apt_key:
keyserver: https://packages.microsoft.com/ keyserver: https://packages.microsoft.com/
id: BC528686B50D79E339D3721CEB3E94ADBE1229CF id: BC528686B50D79E339D3721CEB3E94ADBE1229CF
when: ansible_os_family == "Debian" when: ansible_os_family == "Debian"
- name: Add Microsoft apt repository for MDATP - name: Add Microsoft apt repository for MDATP
apt_repository: apt_repository:
repo: deb [arch=arm64,armhf,amd64] https://packages.microsoft.com/[distro]/[version]/prod [channel] main repo: deb [arch=arm64,armhf,amd64] https://packages.microsoft.com/[distro]/[version]/prod [channel] main
update_cache: yes update_cache: yes
state: present state: present
filename: microsoft-[channel].list filename: microsoft-[channel].list
when: ansible_os_family == "Debian" 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 - name: Add Microsoft yum repository for MDATP
yum_repository: yum_repository:
name: packages-microsoft-com-prod-[channel] name: packages-microsoft-com-prod-[channel]
description: Microsoft Defender for Endpoint description: Microsoft Defender for Endpoint
file: microsoft-[channel] file: microsoft-[channel]
baseurl: https://packages.microsoft.com/[distro]/[version]/[channel]/ baseurl: https://packages.microsoft.com/[distro]/[version]/[channel]/
gpgcheck: yes gpgcheck: yes
enabled: Yes enabled: Yes
when: ansible_os_family == "RedHat" when: ansible_os_family == "RedHat"
``` ```
- Create the Ansible install and uninstall YAML files. - 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 ```Output
- hosts: servers - hosts: servers
tasks: tasks:
- include: ../roles/onboarding_setup.yml - include: ../roles/onboarding_setup.yml
- include: ../roles/add_apt_repo.yml - include: ../roles/add_apt_repo.yml
- apt: - apt:
name: mdatp name: mdatp
state: latest state: latest
update_cache: yes update_cache: yes
``` ```
```bash ```bash
@ -200,13 +206,13 @@ Create a subtask or role files that contribute to an playbook or task.
``` ```
```Output ```Output
- hosts: servers - hosts: servers
tasks: tasks:
- include: ../roles/onboarding_setup.yml - include: ../roles/onboarding_setup.yml
- include: ../roles/add_yum_repo.yml - include: ../roles/add_yum_repo.yml
- yum: - yum:
name: mdatp name: mdatp
state: latest state: latest
enablerepo: packages-microsoft-com-prod-[channel] enablerepo: packages-microsoft-com-prod-[channel]
``` ```
```bash ```bash
@ -216,7 +222,7 @@ Create a subtask or role files that contribute to an playbook or task.
- hosts: servers - hosts: servers
tasks: tasks:
- yum: - yum:
name: mdatp name: mdatp
state: absent state: absent
``` ```