17
17
"/CommunityGalleries/cocopreview-91c44057-c3ab-4652-bf00-9242d5a90170/"
18
18
"Images/ubu2204-snp-host-upm/Versions/latest"
19
19
)
20
- # AZURE_SNP_VM_IMAGE = "/CommunityGalleries/cocopreview-91c44057-c3ab-4652-bf00-9242d5a90170/Images/ubu2204-snp-host-upm/Versions/latest"
21
20
AZURE_SNP_VM_LOCATION = "eastus"
22
21
AZURE_SNP_VM_OS_DISK_SIZE = 64
23
22
AZURE_SNP_VM_SSH_PRIV_KEY = "~/.ssh/id_rsa"
@@ -98,11 +97,7 @@ def delete_resources(resources):
98
97
to_delete = [r for r in resources if r ["type" ] == t ]
99
98
100
99
if to_delete :
101
- print (
102
- "Prioritising {} resources of type {}" .format (
103
- len (to_delete ), t
104
- )
105
- )
100
+ print ("Prioritising {} resources of type {}" .format (len (to_delete ), t ))
106
101
107
102
for r in to_delete :
108
103
delete_resource (r ["name" ], r ["type" ])
@@ -123,6 +118,7 @@ def list_all(azure_cmd, prefix=None):
123
118
124
119
return res
125
120
121
+
126
122
# -----------------------------------------------------------------------------
127
123
# Ansible functions
128
124
# -----------------------------------------------------------------------------
@@ -153,7 +149,11 @@ def ansible_prepare_inventory(prefix):
153
149
lines = ["[all]" ]
154
150
for v in all_vms :
155
151
# Include VM name for debugging purposes
156
- lines .append ("{} ansible_host={} ansible_user={}" .format (v ["name" ], v ["public_ip" ], AZURE_SNP_VM_ADMIN ))
152
+ lines .append (
153
+ "{} ansible_host={} ansible_user={}" .format (
154
+ v ["name" ], v ["public_ip" ], AZURE_SNP_VM_ADMIN
155
+ )
156
+ )
157
157
158
158
file_content = "\n " .join (lines )
159
159
@@ -164,6 +164,7 @@ def ansible_prepare_inventory(prefix):
164
164
fh .write (file_content )
165
165
fh .write ("\n " )
166
166
167
+
167
168
# -----------------------------------------------------------------------------
168
169
# Entrypoint tasks
169
170
# -----------------------------------------------------------------------------
@@ -186,11 +187,15 @@ def deploy(ctx):
186
187
187
188
188
189
@task
189
- def setup (ctx , vm_name = "sc2-snp-test" ):
190
+ def setup (ctx , vm_name = "sc2-snp-test" ):
190
191
ansible_prepare_inventory (vm_name )
191
192
192
193
vm_playbook = join (ANSIBLE_ROOT , "vm.yaml" )
193
- run (f"ansible-playbook -i { ANSIBLE_INVENTORY_FILE } { vm_playbook } " , shell = True , check = True )
194
+ run (
195
+ f"ansible-playbook -i { ANSIBLE_INVENTORY_FILE } { vm_playbook } " ,
196
+ shell = True ,
197
+ check = True ,
198
+ )
194
199
195
200
196
201
@task
0 commit comments