-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathimportant.yml
executable file
·41 lines (37 loc) · 1.44 KB
/
important.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# call reset API to generalize VM
- name: Call REST API - VirtualMachines_Generalize
azure_rm_resource:
api_version: '2017-12-01'
method: POST
resource_group: "{{ resource_group }}"
provider: compute
resource_type: virtualmachines
resource_name: "{{ vm_name }}"
subresource:
- type: generalize
# use command to generalize VM
- name: generalize the vm
command: "az vm generalize --resource-group {{ openshift_azure_resource_group_name }} --name {{ openshift_azure_vm_name }}"
- name: Set expiration period
set_fact:
sas_time_start: '{{ ansible_date_time.iso8601_micro }}'
sas_time_expire: >-
{{ ('%Y-%m-%dT%H:%M:%S'
| strftime(ansible_date_time.epoch|int + 120))
~ (ansible_date_time.iso8601_micro | splitext)[1] }}
- name: Generate access signature
azure_rm_resource:
resource_group: '{{ az_resource_group_name }}'
method: POST
url: "/subscriptions/{{ lookup('env','AZURE_SUBSCRIPTION_ID') }}\
/resourceGroups/{{ az_resource_group_name }}/providers/\
Microsoft.Storage/storageAccounts/\
{{ az_storage_account_name }}/ListServiceSas/"
body:
canonicalizedResource: '/blob/{{ az_storage_account_name }}/{{ az_container_name }}/{{ az_file_name }}'
signedResource: b
signedPermission: r
signedStart: '{{ sas_time_start }}'
signedExpiry: '{{ sas_time_expire }}'
register: storage_sig
test