Skip to content

Commit d4d38ad

Browse files
authored
Merge pull request #93805 from ThomVanL/patch-5
Update onboard-ansible-playbooks.md
2 parents d8fea11 + 83e9bbc commit d4d38ad

File tree

1 file changed

+20
-35
lines changed

1 file changed

+20
-35
lines changed

articles/azure-arc/servers/onboard-ansible-playbooks.md

Lines changed: 20 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -29,68 +29,53 @@ Before you can run the script to connect your machines, you'll need to do the fo
2929

3030
If you are onboarding machines to Azure Arc-enabled servers, copy the following Ansible playbook template and save the playbook as `arc-server-onboard-playbook.yml`.
3131

32-
```
32+
```yaml
3333
---
3434
- name: Onboard Linux and Windows Servers to Azure Arc-enabled servers with public endpoint connectivity
3535
hosts: <INSERT-HOSTS>
36+
vars:
37+
azure:
38+
service_principal_id: 'INSERT-SERVICE-PRINCIPAL-CLIENT-ID'
39+
service_principal_secret: 'INSERT-SERVICE-PRINCIPAL-SECRET'
40+
resource_group: 'INSERT-RESOURCE-GROUP'
41+
tenant_id: 'INSERT-TENANT-ID'
42+
subscription_id: 'INSERT-SUBSCRIPTION-ID'
43+
location: 'INSERT-LOCATION'
3644
tasks:
37-
- name: Download the Connected Machine Agent on Linux servers
45+
- name: Download the Connected Machine Agent on Linux servers
3846
become: yes
3947
get_url:
4048
url: https://aka.ms/azcmagent
4149
dest: ~/install_linux_azcmagent.sh
4250
mode: '700'
4351
when: ansible_system == 'Linux'
44-
- name: Download the Connected Machine Agent on Windows servers
45-
win_get_url:
46-
url: https://aka.ms/AzureConnectedMachineAgent
47-
dest: C:\AzureConnectedMachineAgent.msi
52+
- name: Download the Connected Machine Agent on Windows servers
53+
win_get_url:
54+
url: https://aka.ms/AzureConnectedMachineAgent
55+
dest: C:\AzureConnectedMachineAgent.msi
4856
when: ansible_os_family == 'Windows'
4957
- name: Install the Connected Machine Agent on Linux servers
5058
become: yes
5159
shell: bash ~/install_linux_azcmagent.sh
5260
when: ansible_system == 'Linux'
5361
- name: Install the Connected Machine Agent on Windows servers
54-
path: C:\AzureConnectedMachineAgent.msi
62+
win_package:
63+
path: C:\AzureConnectedMachineAgent.msi
5564
when: ansible_os_family == 'Windows'
5665
- name: Connect the Connected Machine Agent on Linux servers to Azure Arc
5766
become: yes
58-
shell: sudo azcmagent connect --service-principal-id <INSERT-SERVICE-PRINCIPAL-CLIENT-ID> --service-principal-secret <INSERT-SERVICE-PRINCIPAL-SECRET> --resource-group <INSERT-RESOURCE-GROUP> --tenant-id <INSERT-TENANT-ID> --location <INSERT-REGION> --subscription-id <INSERT-SUBSCRIPTION-ID>
67+
shell: sudo azcmagent connect --service-principal-id {{ azure.service_principal_id }} --service-principal-secret {{ azure.service_principal_secret }} --resource-group {{ azure.resource_group }} --tenant-id {{ azure.tenant_id }} --location {{ azure.location }} --subscription-id {{ azure.subscription_id }}
5968
when: ansible_system == 'Linux'
6069
- name: Connect the Connected Machine Agent on Windows servers to Azure
61-
win_shell: '& $env:ProgramFiles\AzureConnectedMachineAgent\azcmagent.exe connect --service-principal-id <INSERT-SERVICE-PRINCIPAL-CLIENT-ID> --service-principal-secret <INSERT-SERVICE-PRINCIPAL-SECRET> --resource-group <INSERT-RESOURCE-GROUP> --tenant-id <INSERT-TENANT-ID> --location <INSERT-REGION> --subscription-id <INSERT-SUBSCRIPTION-ID>'
70+
win_shell: '& $env:ProgramFiles\AzureConnectedMachineAgent\azcmagent.exe connect --service-principal-id "{{ azure.service_principal_id }}" --service-principal-secret "{{ azure.service_principal_secret }}" --resource-group "{{ azure.resource_group }}" --tenant-id "{{ azure.tenant_id }}" --location "{{ azure.location }}" --subscription-id "{{ azure.subscription_id }}"'
6271
when: ansible_os_family == 'Windows'
6372
```
6473
65-
<!--If you are onboarding Linux servers to Azure Arc-enabled servers, download the following Ansible playbook template and save the playbook as `arc-server-onboard-playbook.yml`.
66-
67-
```
68-
---
69-
- name: Onboard Linux Server to Azure Arc-enabled servers with public endpoint
70-
hosts: <INSERT-HOSTS>
71-
tasks:
72-
- name: Download the Connected Machine Agent
73-
become: yes
74-
get_url:
75-
url: https://aka.ms/azcmagent
76-
dest: ~/install_linux_azcmagent.sh
77-
mode: '700'
78-
when: ansible_system == 'Linux'
79-
- name: Install the Connected Machine Agent
80-
become: yes
81-
shell: bash ~/install_linux_azcmagent.sh
82-
when: ansible_system == 'Linux'
83-
- name: Connect the Connected Machine Agent to Azure
84-
become: yes
85-
shell: sudo azcmagent connect --service-principal-id <INSERT-SERVICE-PRINCIPAL-CLIENT-ID> --service-principal-secret <INSERT-SERVICE-PRINCIPAL-SECRET> --resource-group <INSERT-RESOURCE-GROUP> --tenant-id <INSERT-TENANT-ID> --location <INSERT-REGION> --subscription-id <INSERT-SUBSCRIPTION-ID>
86-
when: ansible_system == 'Linux'
87-
```-->
88-
8974
## Modify the Ansible playbook
9075
9176
After downloading the Ansible playbook, complete the following steps:
9277
93-
1. Within the Ansible playbook, modify the fields under the task **Connect the Connected Machine Agent to Azure** with the service principal and Azure details collected earlier:
78+
1. Within the Ansible playbook, modify the variables under the **vars section** with the service principal and Azure details collected earlier:
9479
9580
* Service Principal Id
9681
* Service Principal Secret
@@ -99,7 +84,7 @@ After downloading the Ansible playbook, complete the following steps:
9984
* Subscription Id
10085
* Region
10186
102-
1. Enter the correct hosts field capturing the target servers for onboarding to Azure Arc. You can employ Ansible patterns to selectively target which hybrid machines to onboard.
87+
1. Enter the correct hosts field capturing the target servers for onboarding to Azure Arc. You can employ [Ansible patterns](https://docs.ansible.com/ansible/latest/user_guide/intro_patterns.html#common-patterns) to selectively target which hybrid machines to onboard.
10388
10489
## Run the Ansible playbook
10590

0 commit comments

Comments
 (0)