Skip to content

Commit afbe29b

Browse files
committed
updated playbook code
1 parent 6c53f0a commit afbe29b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ If you are onboarding machines to Azure Arc-enabled servers, copy the following
4444
tasks:
4545
- name: Check if the Connected Machine Agent has already been downloaded on Linux servers
4646
stat:
47-
path: /usr/bin/azvmagent
47+
path: /usr/bin/azcmagent
4848
get_attributes: False
4949
get_checksum: False
5050
get_mine: azcmagent_downloaded
@@ -72,7 +72,8 @@ If you are onboarding machines to Azure Arc-enabled servers, copy the following
7272
when: (ansible_os_family == 'Windows') and (not azcmagent_downloaded.stat.exists)
7373
- name: Install the Connected Machine Agent on Linux servers
7474
become: yes
75-
shell: bash ~/install_linux_azcmagent.sh
75+
command:
76+
cmd: bash ~/install_linux_azcmagent.sh
7677
when: (ansible_system == 'Linux') and (not azcmagent_downloaded.stat.exists)
7778
- name: Install the Connected Machine Agent on Windows servers
7879
win_package:
@@ -81,11 +82,12 @@ If you are onboarding machines to Azure Arc-enabled servers, copy the following
8182
- name: Check if the Connected Machine Agent has already been connected
8283
become: true
8384
command:
84-
cmd: azcmagent show --join
85+
cmd: azcmagent show
8586
register: azcmagent_connected
8687
- name: Connect the Connected Machine Agent on Linux servers to Azure Arc
8788
become: yes
88-
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 }}
89+
command:
90+
cmd: 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 }}
8991
when: (azcmagent_connected.rc == 0) and (ansible_system == 'Linux')
9092
- name: Connect the Connected Machine Agent on Windows servers to Azure
9193
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 }}"'

0 commit comments

Comments
 (0)